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

learn more… | top users | synonyms

7
votes
2answers
674 views

vim spell checker?

Is there a way to spell check a file using vim?
7
votes
2answers
1k views

How to make vim apply /var/log/messages syntax highlighting to any file called “messages” or “messages-*”?

I love vim's colorization of /var/log/messages, but it only works for that – the absolute filename. It doesn't work for older rotations of messages (e.g. /var/log/messages-20120610) or for messages ...
7
votes
1answer
2k views

Setting vim filetype with modeline not working as expected

As per the accepted answer to this question, I'm attempting to use modelines in vim to force filetype detection in some files. For example, at the top of a file named gitconfig (note there is no ...
7
votes
3answers
435 views

Vim to print file on terminal and exit

I would like vim to do this in order to have syntax highlight as set up in vim (or without need for extra tools). So instead to use cat file | <some_sh_tool> I would use vim +"some_opts" +"..." ...
7
votes
3answers
337 views

VIM see regular expressions matches as you type

If I type /regex then the cursor temporarily jumps to the first match and all matches are highlighted. This updates as I type. Is it possible to get this behavior when I'm getting ready to make a ...
7
votes
1answer
2k views

How can I disable bells/visualbells in vim?

How can I disable bells/visualbells in vim? I've tried: set noeb set novb .. but nothing has changed afaik. Just to be clear, I'm referring to the visual bell I get in vim when I do something ...
7
votes
1answer
147 views

Navigate through a stack of locations in vim?

Typing `` at location X brings you back to the last visited location in the text file. Hitting it again brings you back to X This switching is similar to Ctrl+6 to open the last opened file. But how ...
7
votes
3answers
4k views

disabling mouse support in `vim` in a `gnome-terminal` environment

Edit: The problem of an enabled mouse in vim appears to be specific to gnome-terminal (version 3.4.1.1-1; I am using gnome 3 fallback mode). If I run xterm, mouse support in vim is disabled by ...
7
votes
1answer
5k views

Switch VI to use backspace key instead of Control+H for backspace?

I'm on Solaris 10 and by default vi version SVR4.0, Solaris 2.5.0 is installed. The system was set up so that when I ssh to it Control+H does backspace, and backspace outputs ^? I added stty erase ...
7
votes
2answers
95 views

How do I only undo pasted text in vim?

TL;DR; version - How do I undo text that was pasted in from my OS copy buffer without undoing other text that was typed in since I went into insert mode? Longer description: Put something in your ...
7
votes
1answer
231 views

VIM: folding bullet points

I'm quite new to VIM, but have been trying to teach myself over the past week, yet I'm encountering a problem which has proven to be quite frustrating: Currently I'm mostly using VIM to take notes, ...
7
votes
1answer
1k views

Select lines using ranges in Vim?

I would like to select lines visually. Usually I'd SHIFT-V and select with j and k to highlight the lines. How do I do it using a colon-range command? e.g. :10,12<?> to select lines 10 - 12 ...
7
votes
3answers
447 views

Block motion for any bracket type?

If I want to, say delete a block, I can use text object motions. I.e if my text looks like this: (let [a 1 b {:x 3 :y 4}] a) And the cursor is for example on character 3. If I type diB ...
7
votes
1answer
396 views

Case-preserving search and replace in vim?

In vim, I know I can search with or without case sensitivity. But if I want to search for a string in either upper or lower case, and replace it with a replacement of the same case, is that possible ...
7
votes
1answer
164 views

making vim fold also hide newline after function

How can one make vim's fold function - when using foldmethod=syntax - also hide one newline after each function, if-else and struct (using Go).
7
votes
1answer
434 views

Note-taking and outlining using Vi: On startup, highlight tags and display tags in a preview window [duplicate]

I am using vi as a note-taking and outlining tool and therefore I thought that this stackexchange site would be appropriate to ask this question. I am constructing the "tags" file by myself. What I ...
6
votes
5answers
769 views

Terminal and Vim

I open a terminal then I open Vim. Then I work on my source code, but unfortunately I click on the close button of the terminal title bar and my work is lost. Is it possible to configure Vim such that ...
6
votes
5answers
5k views

vi command for adding blank line?

In vi, I can use o or O to add a blank line and go into insertion mode. But what if I want to stay in command mode, is there a command for this? In googling, I'm seeing suggestions to add stuff to my ...
6
votes
5answers
1k views

Indent several lines with VIM?

For eample, I'm editing this code: <html> <body> <script> var a = 10; a += 100; </script> </body> </html> now I need to indent the script line: ...
6
votes
4answers
5k views

Auto indent / format code for Vim?

I'm trying to use Vim more and more when I can. One of my biggest grip between Vim and an IDE like Aptana is the ability to auto indent. Is there a means of auto formatting code (HTML, CSS, PHP) so ...
6
votes
2answers
2k views

Is there a way to place a comment in a file which vim will process in order to set filetype?

For example, if I want to have a file with the name gitconfig (no leading .) be recognised by vim as being of filetype=gitconfig, is there a means of indicating this in a comment or something similar ...
6
votes
4answers
969 views

vim search around line breaks

When I am editing a LaTeX document in vim, often times I want to search for a phrase. Because I have LaTeX setup to wrap lines, sometimes half of the phrase will be on one line while the other half ...
6
votes
4answers
946 views

Block editing *live* in Emacs or Vim

jEdit supports block editing, but Emacs and Vim seem to have some serious usability issues on the same subject. If someone could fill in the unknowns here it would be much more bearable to use either ...
6
votes
2answers
347 views

vim - don't highlight search term after a search & replace?

After performing a search and replace, my installation of GVIM highlights any text remaining that still matches the search pattern. Example input text: foo foo fighters I run :%s/foo/bar/gc and ...
6
votes
3answers
520 views

Looking for a centred, full-screen terminal

There exist out there several different 'distraction-free editors' for writing: these provide a fullscreen, minimal environment with the goal of forcing oneself to focus on the task at hand. I want ...
6
votes
4answers
3k views

How to split and edit patches?

Sometimes I need to split a big patch into smaller (disjoint) ones, e.g. for every separate feature included. Usually I do it via standard vim yank/dd commands and split-window switching. But are ...
6
votes
5answers
3k views

vim editing/switching between multiple files efficiently in large directory structures

I am by no means a vim power user, I am just beginning to grasp the advanced motions and commands with vim. But there's one drawback that I can't seem to get around. I grew up with graphical ...
6
votes
2answers
414 views

Remove all Vim undo files in all but one directory

I just realized that I have tons of Vim undo (.un~) files sprinkled around my file system. I'd like to delete all of these files except in one directory—~/.tmp. My first problem is that I can't seem ...
6
votes
1answer
806 views

Is there an equivalent to whitespace-mode in emacs for vim?

Is there a way I can see spaces and tabs wonderfully visualized in vim, like I can in emacs by toggling whitespace-mode?
6
votes
2answers
1k views

red-green color blindness compatible vim theme

I am looking for a vim theme accessible to users with red green color blindness. In particular, the red text on a dark terminal background all but disappears. Do any of you know of a good theme? Or ...
6
votes
3answers
3k views

Transaction check error in installing vim?

I recently updated my fedora to 20 and wanted to install vim.but running sudo yum install vim returned this error: Transaction check error: file /usr/share/man/man1/vim.1.gz from install of ...
6
votes
3answers
4k views

Vim :s replace first N < g occurrences on a line

In vim, I sometimes have occasion to replace the first few occurrences of a match on a line, but not every one like g would. e.g.: a a a a a to b b b a a I know I could use ...
6
votes
2answers
218 views

How to write a column of consecutive integers in Vim over existing text?

For example, imagine I had the following text: / apple / orange / banana / bread How could I efficiently add consecutive integers in a column to make? /1 apple /2 orange /3 banana /4 bread Note ...
6
votes
1answer
83 views

Can I specify the layout of a vsplit command?

When I do the :vsplit command, it always opens the new file on the left side of the screen. Is there a way I can specify I want the new file to open to the right?
6
votes
1answer
205 views

How can I count the number of words in a file whilst editing the file in vim

I know I can use wc for counting characters, words and lines of files at the command line. Is there any way I can can count the number of words while in vim?
6
votes
3answers
784 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 ...
6
votes
1answer
733 views

Replace unicode chars in VIM?

I got some logs from a windows machine, which contains multiple instances of <200e>, I know it's a unicode char, but how can I remove it with s command? I don't know how to input that in the ...
6
votes
1answer
1k views

In vim, how to map “command-right” and “command-left” to beginning of line and end of line on mac?

I'm trying to get it to be like default text editing in Mac. I tried map! <D-Left> 0 and map! <D-Right> $ in ~/.vimrc, but of course it didn't work. How can i do this?
6
votes
3answers
666 views

How can I open a file in VIM in readonly mode if it already has a swapfile?

When I use the command :e filename to open a file and this file is already opened by another vim instance, I get a prompt asking me if I want to open the file in read-only mode, edit anyway, recover, ...
6
votes
1answer
734 views

Only one file name allowed error

Sometimes I forget to do sudo vim and open files to which I don't have write permission. I saw this post and it was really helpful. When I did :w !sudo tee % it asked me for a password and then the ...
6
votes
2answers
352 views

Indent the middle of multiple lines

I often run into situations like this: title : Jekyll Bootstrap tagline: Site Tagline author : name : Name Lastname email : blah@email.test github : username twitter : username feedburner : ...
6
votes
1answer
186 views

Why does mapping <esc> cause arrow keys to fail in vim?

When I do inoremap <Esc> <Esc>`^ in vim, the next time I switch to insert mode (after using Esc) the arrow keys fail to move the cursor (they insert letters instead). Why does that ...
6
votes
1answer
173 views

How to highlight logs with bash coloring on vim?

I have some nicely colored logs from some tools with bash color codes. When I view them through less or similar tools it get color rendered by bash (obviously). However it is pain to watch and edit ...
6
votes
1answer
2k views

How to set the bash display to not show the vim text after exit?

My question is simple, but I am finding it hard to frame/explain it easily. I log into several Unix boxes with different accounts. I see 2 different things for user1 and user2, while editing text ...
6
votes
1answer
2k views

Vim not running inside tmux

When I try to open a file using vim inside tmux the whole window freezes. I have to kill the window with C-a &. Here are my ~/.vimrc settings: :set autoindent :set ts=4 :set number :set ...
6
votes
2answers
1k 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, ...
6
votes
1answer
532 views

tmux, Vim and Solarized

Premises Browsing around tmux, Vim and Solarized I can find lots of complains about 256 colours and "user experience". Well, I'm having the opposite "problem", i.e. Vim works well with a full ...
6
votes
1answer
272 views

vim: how do I set :match and :2match search results to different colors?

For example, I want something along the lines of: :match search /<div/ guib=Green :match search /<\/div>/ guibf=Blue only that doesn't work.
6
votes
3answers
605 views

Vim: How to get rid of filetype-specific map?

Edit: Working version. I've mapped [[ and ]] to my own functions: nmap <silent> ]] :let &tabstop += 1 <CR> :echo 'tabstop =' &tabstop <CR> nmap <silent> [[ :let ...
6
votes
2answers
307 views

Is there a method for making Google Chrome open textareas in vim?

I used to use Firefox on a daily basis but have switched to Google Chrome, and have been using it for 2+ years now. The one plugin that I miss is this one, It's All Text!. This plugin allowed for the ...