vim (Vi IMproved) is a text editor supporting different editing modes.

learn more… | top users | synonyms

0
votes
1answer
16 views

Highlight Vim escape characters e.g. \n

I'm using the Jellybeans vim colorscheme but it doesn't highlight any escape characters. For example if I'm using C++ and have the following... std::string word = "hello\n"; ... the whole string ...
0
votes
3answers
42 views

Vim Search and Replace - Regex

I want to perform a search and replace. A newline before any non-digit should be replaced with tab. I tried %s/\n\D/\t/g but it replaced the first character of the word following the newline, which ...
1
vote
2answers
30 views

VIM: function that checks if external program is running

Using a vim function, I would like to check if a program is running using pgrep, and if it is not running then do something. In particular, I want to achieve something like this: function! ...
1
vote
0answers
6 views

Vimdiff copy above/below

do and dp are kinda limited to take one or another version of the conflict, in many cases it's just java imports when you need both changes, is there any way to make a map that copies the other side'...
0
votes
0answers
16 views

How to give an arbitrary name for a register in vim

Is there any possible way to give an arbitrary name for a register in vim. I am able to use "[a-z]p while pasting. But, I would like to know, if there is anyway by which we can use arbitrary names for ...
3
votes
1answer
63 views

Vi undo updated file?

I just deleted a bunch of text on a file and saved it. Is it possible to recover the older version of file back? I know I should have taken a backup, just trying my luck.
0
votes
1answer
32 views

System messages in vim

O/S: Arch Linux (Kernel 4.3.3-2-ARCH) While editing files with VIM 7.4 it occassionally happens that system messages appear on the screen, ruining my workflow but obviously not altering the ...
2
votes
1answer
23 views

Automatically set number in vim without modifying vimrc because of limited permission

Hi since I dont have permission to modify vimrc. But I really need to view the line numbers every time. Is there an alternative way to do the following without modifying the vimrc file?Thank you! :...
2
votes
1answer
26 views

Opening files within archives from vim

I know that vim can open files within zip or tar{,.gz} archives interactively: open the archive first, then navigate to the correct entry and press enter. lesspipe (https://github.com/wofr06/lesspipe)...
0
votes
0answers
34 views

Trying to execute vim function from plugin - can't get syntax correct

I found a pretty neat VIM plugin which adds functionality for managing Perl scripts; it's called Perl-Support. I got it installed fine, and I'm trying to take advantage of all the custom functions/...
0
votes
0answers
23 views

Vim goes haywire inside tmux

I am using vim-airline and have enabled tab line. I have set TERM=screen-256color in .tmux.conf and I can see that being printed in and out of tmux. Vim with airline works perfectly fine outside of ...
1
vote
1answer
52 views

Vim color scheme not being applied

I am installing this theme using these instructions. $ vim --version VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 08 2016 11:38:28) Included patches: 1-1689 Here is my ~/.vim/colors: xxx@xxx:~/...
0
votes
2answers
44 views

How to fetch all the even lines and odd lines from a file and save them into two different files such as Evenfile & Oddfile? [duplicate]

The question is very simple. Suppose I've a file named "a.txt" and it has 100 lines. Now I want to extract odd lines i.e lines 1,3,5...etc and save them to a different file such as Odd.txt and the ...
2
votes
0answers
30 views

Benefits of using vim buffers over tmux panes / dwm terminals

What are the benefits of using vim buffers over separate instances in several terminals? I've been using vim for quite some time, but at the same time I've been using tiled window manager (dwm/xmonad)...
1
vote
1answer
28 views

trigger vi mode key binding in normal mode only

I've created some custom key bindings for bash vi mode. They trigger while I'm in insert mode and I want them instead to trigger when I'm in normal mode. I'm using vi mode set -o vi in a terminal ...
1
vote
3answers
42 views

how to make a large command line broke in two lines be executed as a single line inside of a script

I am very begginer with Unix. I am using IBM z/OS390 and I am using the OMVS shell. I don't have "vi" installed at all so I use "oedit". If I try to initialize the app.jar straigh from OMVS shell it ...
0
votes
2answers
30 views

How to tell if tabs or spaces are being used in vim [duplicate]

I have a file that has data such as: 1 Foo 2 Bar 3 Kazam Is it possible using vim to know if a space is being used a delimited vs a tab?
1
vote
1answer
35 views

tmux: how to bind a key to launch shell command?

I use tmux to develop, with two panes: one to edit the code, and one to compile it. I need to switch pane very often to launch the compile command (say "mvn install"). How can I bind a key (say "Ctrl+...
1
vote
0answers
69 views

Strange VIM behaviour

I recently installed a minimal version of Fedora 23 Server edition. I use VIM as editor, and I noticed a strange behavior when I edit any text file that is not a new file during. Whenever I open ...
0
votes
1answer
74 views

Nano vs Vim or Vi [closed]

I have been using nano for quite a while now and I prefer using it anyway. But still I don't understand why people still emphasize on vi or vim. Can anybody specify me the reason why vim editor is ...
20
votes
4answers
1k views

How to invoke vim editor and pipe output to bash

Sometimes I need to write text and then pipe that text into another command. My usual workflow goes something like this: vim # I edit and save my file as file.txt cat file.txt | pandoc -o file.pdf # ...
0
votes
0answers
16 views

urxvt, vim and X clipboard [duplicate]

I would like to setup my rxvt-unicode with the following behavior Be able to paste primary clipboard with the keyboard (whatever combination is normally used) Copy selected text to primary clipboard ...
1
vote
1answer
61 views

zsh fails at path completition when command is vim

When I try to autocomplete files (with vim as argument 0): vim ~/.conf <TAB> It shows: _arguments:450: _vim_files: function definition file not found _arguments:450: _vim_files: function ...
19
votes
3answers
1k views

In Vim , how can I copy from several lines? (not a range);

Assume I have 1 - funct1 2- funct 2 3 - funct 3 4 line 4 how can I copy line 1 and 3 (not a range of lines) and paste them, for example at line 8? If I do this in way with | arg like ( 1y|3y), I ...
2
votes
3answers
191 views

sed regular expression behaving differently than in vim and perl?

Here's a sample 'test.txt' abcdX1yad45das abcdX2fad45das abcdX3had45das abcdX4wad45das abcdX5mad45das sample desired output: X1yad X2fad X3had X4wad X5mad I could get it working in vim with: :% ...
1
vote
1answer
46 views

Why vim is pasting 50 lines instead of 96?

I had a file of 96 lines i selected all lines and paste with vim in new file but..paste only first 50 lines. What to check? I see this only on newest version of vim on slackware-current,the old 14.1 ...
3
votes
2answers
27 views

How do I prevent vim from automatically editing my input?

Sometimes I copy/paste from one .cpp to another in vim, and vim, confident that it knows what I want to do better than me, edits my entry. For example, if I copy/paste this: // A comment. Some(code); ...
0
votes
1answer
45 views

Vim saved file not updating on webpage

I am attempting to update an HTML file on my server, but when I do so it doesn't appear to be updating, but rather, serves an old copy instead. I went through the usual process of pressing :w and ...
2
votes
1answer
44 views

Different vim colors and styles in Tmux and Gnome

I am using tmux, and recently found out that the same vim colorshemes inside and outside of tmux have different colors Left is tmux in gnome-terminal, right is plain gnome-terminal, gnome-terminal ...
2
votes
1answer
50 views

Using accents in Vim seamlessly

Very often I need to write text/program in foreign languages that need accents and special characters in vim, but sometimes it is very hard to get that working. What are the best alternatives to ...
0
votes
1answer
43 views

How to Execute !gvim current line in Viewer?

Code find-xargs(less)-gvim %http://unix.stackexchange.com/a/277889/16920 find . -name "*.tex" -exec grep -il "agent" {} + | less -s -M +Gg Output ./InfectiousDiseases/1.4.2016.tex ./...
0
votes
0answers
28 views

Send-keys across tmux panes in vim in Cygwin is painfully slow

I am using vimux or vim-tbone to send code to an interpreter in another pane. It works fine with any shell, but I can't get it to work properly in windows. I can't have a VM, so I use cygwin at work ...
7
votes
1answer
90 views

What is the historical origin of CTRL + P for up and CTRL + N for down?

I am a moderately experienced vim user, who is now beginning to use GNU emacs. At about the same time as I learned that Ctrl-p and Ctrl-n are the default for up and down in emacs, I also learned they ...
3
votes
0answers
21 views

Open multiple files from ranger in vim

When I highlight multiple files in ranger from the same dir, I can open them all in vim with r and than 0 or @ and than add vim. But if I highlight files from different dirs, than this doesn't work. ...
1
vote
1answer
27 views

ack executed through vim

I am trying to execute ack from vim. But for some reason vim decides to stop after executing ack. How can I stop vim from stopping? (on some systems what I call ack is called ack-grep) What I am ...
0
votes
0answers
21 views

How do I add a vim configuration to a user who is restricted to a specific directory?

So basically, I have created a user that only has access to a specific folder with: useradd --home /some/dir username Now what I would like to do is add my vim configuration to this user's "home" ...
0
votes
1answer
67 views

problem editing utf8 text file with vim

I have a problem editing a html file on a server via vim. The file is utf-8 encoded. While editing with vim (v7.3, no plugins active) I can see umlauts and editing and saving a line before the umlaut ...
0
votes
0answers
22 views

vim + tmux: some shortcuts broken?

When I am using vim inside of tmux, some of my shortcuts are broken. E.g. I have bound Ctrl + up/down and Shift + up/down in my .vimrc and when I'm running vim inside of tmux these shortcuts do not ...
0
votes
0answers
25 views

vim: map capital 'Y' in .vimrc does not work

If I try to map capital 'Y' in my vimrc, this is getting ignored. For example, if I put something like nmap Y :w<CR> in my vimrc, this has no effect. However if I run vim and I enter :nmap Y ...
0
votes
1answer
32 views

shell commands with quotation marks in ranger

I like to open the highlighted file in ranger in split of remote vim session. :shell vim --remote-send "<C-\><C-n>:vsp %d/%f<CR>" Rather than file /path/to/directory/highlighted-...
1
vote
1answer
96 views

Execute a command in zsh vim mode

In zsh in vim mode, I write something foo foo bar bar Then I hit Esc to go in normal mode and type : foo foo bar bar execute: _ Then, I assume I can do that, I want to search and replace bar ...
3
votes
2answers
706 views

In vi/vim, how do I append to a file instead of overwriting it?

I know I can write to a file by simply doing :w <file>. I would like to know though how can I write to a file by appending to it instead of overwriting it. Example use case: I want to take some ...
1
vote
1answer
48 views

Copy path from vim netrw

I use vim's netrw to explore some files. How can I copy the absolute path of the currently selected directory in netrw to a register and use it to paste into another buffer?
1
vote
1answer
47 views

Two different versions of VIM

When I install just about any distribution of linux it's accompanied with an unorthodox version of vi. I most recently dealt with this on Ubuntu 14.04. I can vi a file but a number of the "hot" keys ...
0
votes
1answer
59 views

vi replacing characters on file opening

Whenever I open an existing file with vim, the first non-blank character in one of the lines gets replaced with a g. I am a beginner with vim and I might have entered a command by mistake (since I ...
2
votes
0answers
32 views

OpenLayers autocompletion with Tern

I use Tern with Vim and a plugin called YouCompleteMe. I develop principally with two JavaScript libraries: jQuery and OpenLayers. The first one is already supported by Tern. OpenLayers is not. In ...
0
votes
0answers
43 views

Vim not loading color scheme file at all

I have exactly same two CentOS 6 boxes. Trying to install vim and enable color scheme file. Same thing, same vim versions used but the color scheme works in one machine and not in other. Here are ...
0
votes
1answer
19 views

sequentially number a line of linked images with vim or other?

I have over 400 lines of html containing this code for images: <a class='gallery' href="galimages/boards/board34.jpg" alt="board large"><image src ="galimages/boards/thumbs/34.jpg" alt="...
3
votes
2answers
48 views

vim: Force specific syntax via command-line argument

When I want to easily read my PostgreSQL schema, I dump it to stderr and redirect it to vim: pg_dump -h localhost -U postgres dog_food --schema-only | vim - This gives: vim does not have a ...