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

learn more… | top users | synonyms

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 ...
12
votes
5answers
838 views

vim: hide first n letters of all lines in a file

I am analyzing log file using vim and the format looks like this YYYY-MM-DD HH:MM:SS.USEC PID Name LogText Since Most of the times I don't care about date and time. I want to hide them and just ...
10
votes
5answers
1k views

How to scroll large datafile while keeping header

Suppose I have some large datafile, which overflow the screen in both vertical and horizontal direction. How can I browse this file, while the header-lines stay on the screen? For the moment, I am ...
1
vote
1answer
81 views

How can my text file get filled with ^M characters all of a sudden?

I have a text file on a Mac machine, and I've only ever used vi/vim to edit it. Today when I opened it using vi I noticed a bunch of ^M characters everywhere. The only thing I did different today was ...
12
votes
6answers
14k views

Copy-paste for vim is not working when mouse (:set mouse=a) is on?

I was trying to copy paste something from vim to another application and also, from that application to vim using right click with mouse and then copy and paste (or with Ctrl+v and Ctrl+c and also ...
0
votes
0answers
26 views

Vim minimize current window and make remaining of equal size

I'm trying to get a mix of CTRL-W1| and CTRL-W=. I want to keep only 2 windows and make them of equal size so that they take all available space. I'm using vertical tabs all the time, but I guess ...
66
votes
9answers
28k views

Exit vim more quickly

I use Vim mainly for quick edits rather than long work sessions. In that sense, I find the keyboard sequence for quitting especially laborious: Esc, Shift + ;, w, q, Enter. How to quit Vim (possibly ...
0
votes
1answer
43 views

Vim color scheme not always working

I have changed my color scheme in vim by adding this line to .vimrc: colorscheme desert When I open .vimrc or .profile the text is colored, but when I do for example vim test.txt the text I enter is ...
0
votes
2answers
46 views

Vim writes to file without having permissions [duplicate]

$ ls sess.vim -lh -rw-r--r-- 1 root root 11K Feb 26 18:52 sess.vim I want this file to be readable for everyone and writable by no one (except by root). Thus I set its permissions to ...
0
votes
2answers
70 views

disable cursor color in putty client ssh terminal when in vi

I use putty.exe in windows 7 to connect to my Linux system. I use vi. I would like the cursor in vi to remain white all the time, and not change to green or blue around my if statement { } brackets ...
1
vote
1answer
53 views

Setting Terminal tab names in OS X and using vim

I regularly ssh into a Linux cluster from an OS X (El Capitan) Terminal, sometimes with multiple Terminal tabs. I use bash and vim. I'd like to do the following: while ssh'd, set the Terminal tab ...
82
votes
6answers
71k views

vim - better colors so comments aren't dark blue?

Mostly I edit ruby files, although shell script file comments are also # Currently my comments show as dark blue on black which is really hard to read. See screenshot. How can I change their color? ...
1
vote
1answer
19 views

Accessing to the lastly executed command and modify it before executing in VIM

Scenario. Imagine, that I want to search replace something. :%s/foo/bar/g Now, imagine that I made a mistype and executed the command :%s/fop/bar/g Every vim user knows than @: executes the ...
9
votes
2answers
3k views

Negative lookbehind/ahead assertions in Linux less pager (or vim)

I want to find all instances of "index" not followed by .php in a log using less. /index(?!\.php) does not work. Is this possible? What is the regex for less and vim (do they differ?). Is this not ...
1
vote
1answer
49 views

Gnome Terminal error with VT100 cursor movement codes

I've got an ansi escape issue with Gnome Terminal. What could be causing and how do I fix an issue like this? Since I cannot describe the issue very well I have a screenshot to show it off. When I ...
3
votes
2answers
403 views

How to effectively add a file to the args list for vim from within vim?

Really I just have a confusion between a few terms, some of which may be synonymous: buffers tabs files windows I want to understand these terms fully and any pointers in that direction would be ...
47
votes
8answers
47k views

How to copy text from vim to an external program?

I'm trying to copy-paste some text from vim. I'm doing v to enter visual mode, then y once I selected my block. It appears to copy the text into vim's clipboard, because p will paste it. But in ...
1
vote
1answer
41 views

Display replacement characters for no-break space in Vim

I'd want to display non standard spaces in Vim so that I could distinguish No-Break space (U+00A0) from Narrow No-Break space (U+202F) by using for example replacement Unicode characters like ␣ (U+...
4
votes
2answers
1k views

How can I search for and highlight multiple strings in VIM?

In VIM, how can I search for multiple strings and have a different color highlight for each match?
3
votes
1answer
687 views

How to use FileType in Vim?

In most cases, I want to use tabstop=4 while editing files. But for some types of file, like xml file, I want to use tabstop=2. I added au filetypedetect FileType xml,html,xhtml,javascript set ...
8
votes
3answers
2k views

Fixing CTRL-* in vim under GNU screen

When running vim under GNU screen, I'm finding that combinations of CTRL with the arrow and Pg* keys don't work as expected. I'm using the Ubuntu 10.10 vim-gnome package. On a different machine, ...
0
votes
1answer
20 views

How to define a shell variable as equal to the version of Vim presently installed?

I am intending to write a shell script (if specifics are required, it will be executed in Zsh) that will determine the latest Vim patch via running: git pull origin master vernew=$(git describe --...
3
votes
2answers
61 views

Inspecting vi .swp file to preview recovery

Feel free to close this as a dupe if you can find a question that deals with this case. This is NOT about HOW to recover a .swp file in vi. I'm not sure if I want to recover. I want to preview what ...
1
vote
4answers
7k views

What is a vi equivalent of vim's 'set ruler' command?

Is there a way to show the current row and column position in vi? In vim, I know there is the set ruler command, but what are my options when using vi?
0
votes
1answer
76 views

Vim color scheme not being applied

I'm trying to use this color scheme: https://github.com/Konstruktionist/vim/blob/master/colors/Kafka.vim Here is my ~/.vim/colors: xxx@xxx:~/.vim/colors$ ls -l total 16 -rw-rw-r-- 1 xxx xxx 15245 ...
1
vote
0answers
34 views

Getting Alt to Work in the Terminal with Tmux and Vim

I'm trying to make Alt + h/j/k/l switch tmux panes and vim windows. Yet for some reason my terminal (xfce4-terminal) and and Alt do not play nicely with each other. I got Alt + h/j/k/l to switch ...
1
vote
0answers
44 views

Global vim-like (hjkl) navigation with numlock & xmodmap?

I'd like to be able mimic vim's hjkl navigation everywhere in the system by utilizing num lock (or scroll lock), and making hjkl keys act as arrows whenever num lock is on, and regular behavior ...
3
votes
1answer
26 views

Vim: if specific version, then don't load plugin

I wonder what the best way is to decide whether or not some plugin should be loaded depending on some specific compilation/version of Vim. Any help would be appreciated.
2
votes
1answer
1k views

Use of ! in VIM

I have seen that sometimes :q works but sometimes we have to use :q!. This is the case for many commands. I was wondering what is the general use of ! in vim and when to use it. I tried to google this,...
6
votes
1answer
110 views

What is this view in vim?

What is this view in vim called, and what is it for? Somehow when I type colon to enter a command in vim I accidentally bring up a view that looks like this. But I can't get it to happen consistently,...
4
votes
2answers
335 views

Right-align comments in vim

I'm writing C code using vim and are searching for a possibility to right-align my comments so that they all end at col 80. To give a short example: int a = 80; /* initialize a */ int b = 7; /* ...
0
votes
0answers
67 views

Differences between Vim and Evil Mode Emacs

I normally use emacs on my system however all of the computers at my university have vim installed which I normally ignored (I know basic vim but I'm not very efficient) and used gedit when I needed ...
2
votes
2answers
50 views

vim find and replace around a string

In VIM, if, for example, I have the text http://a.com http://b.com is it possible to find all lines (the whole line) and replace it with something before and after it, such as: <a href="http://...
0
votes
1answer
77 views

Vim Powerline is only working when 2 buffers are open

I'm having some trouble with the Vim Powerline plugin. I've installed it but it is only working when I have two buffers open. Below are pictures describing the issue visually as well as my .vimrc. ...
2
votes
1answer
68 views

Vim Open file in multi split modes

I want to open 3 files in multiple split mode. For example let's say I have 3 files file1 file2 file3 I want to open file1 & file2 in vertical split mode , and both of the vertical split must be ...
0
votes
1answer
53 views

Why does piping filenames into VIM break bash when I return to the shell?

I searched for a few files with find and I wanted to open all of them in tabs in Vim. So I tried this: find . | xargs fgrep -l myExpression | xargs vim -p This worked great, except when I was done ...
0
votes
2answers
19 views

Create a macro for vim paste management

I would like to create a macro that does: set paste <paste> set nopaste This will save me from <paste> (Oh, forgot I again!) Delete. Execute the above. Over and over. :-) But I can't ...
0
votes
1answer
72 views

In vim, how to detach/open an exist window to a new tab?

For example: I'm editing a file, and I use command-line mode (:help) to open help file but this help file is be opened in the some tab with my file so, I want to open/detach this help window to a new ...
2
votes
2answers
57 views

Autocomplete from grep output

How might I more easily use a filename found by grep as an argument to vim: $ grep -r foo * lib/beatles/john.c lib/pantera/phil.c lib/pinkfloyd/roger.c lib/pinkfloyd/richard.c lib/whitestripes/...
8
votes
3answers
6k views

How to enable and use code folding in Vim?

How can I enable and do code folding in Vim? Do I have to change anything in ~/.vimrc? I type z+a and z+c and z+o and nothing happens. Here is an article about folding: Code folding in Vim.
1
vote
0answers
54 views

Vim with foreign QWERTZ keyboard

Vim is optimized for the standard US keyboard: If we want to use it with the following QWERTZ keyboard (common in Austria and Germany): What should we do? (aside from using the US keyboard map, ...
0
votes
1answer
42 views

How do I run two shell commands in one line in Vim?

I want to sort and uniq some lines. I did :'<,'>! sort -f|!uniq But it gives an error. Is possible to run two commands on one line?
10
votes
4answers
3k views

How to search the current word in all opened tabs in Vim?

I have started learning Vim word-search using * and # while the cursor is over the current word. But this search is limited to the current file buffer. Is there a command or a shortcut to extend this ...
2
votes
2answers
65 views

How to re-show this vim's welcome screen?

this screen is very beautiful, and I love But when I type a char, the screen just gone How can I manually show it again ?
3
votes
3answers
83 views

backreferences in `rename` regex

I have A LOT of files named "bar_foo.txt" in a directory, and I'd like to rename them to "foo_bar.txt" instead. In sed and vim the regex to to this would be something like 's/\(bar\)_\(foo\)/\2_\1/g',...
4
votes
1answer
203 views

“Press ENTER or type command to continue”: why am I seeing this?

I'm familiar with this message when a command's output is more than one line. However, on one of the systems I use, I see it every time I write with :w, despite having plenty of horizontal space for ...
3
votes
1answer
42 views

How to enter vim user manual without being in VIM

I want to simply browse the VIM user-manual, but the only way I get access is by opening a session of vim and the typing: help user-manual. The problem with this is that this ends up creating a screen ...
1
vote
1answer
49 views

Equivalent to 'w' in Vim to next non alphanumeric character?

I was wondering if there is a single key (like 'w') that specifies "from the current cursor position to the next non alphanumeric character". This is the scenario: In the example below, with the ...
9
votes
3answers
3k views

How to allow Page Up in GNU Screen?

I use Vim to edit text files on Linux. Commonly I connect to remote Linux machines using PuTTY from Windows. I use GNU Screen commonly as well. When using Vim inside Screen I am unable to use the ...
0
votes
2answers
28 views

In xterm(mintty,bash), how can I open a file in the exist vim process?

I used to open file in multiple tab like visual studio or eclipse do. How can I open the a file into the exist vim process ?