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

learn more… | top users | synonyms

2
votes
2answers
127 views

Vim markers and macros

Is there a way to make a macro operate up to a marker? I know if I do 5@a my macro will operate on 5 lines. Example: set marker with `mc` record a macro with `qa` ... now what? Obviously 'c@a just ...
3
votes
3answers
485 views

Open another file with split windows, and switch between them

If I open vim with: $ vim -o a.ext b.ext I get a window that looks like this +----------------------+ | a | | | | a.ext ---------------+ | b ...
6
votes
5answers
2k 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: ...
8
votes
1answer
178 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).
9
votes
2answers
344 views

Vim, context-sensitive comment/uncomment behavior

I edit a lot of PHP code with Vim, and I've run into a snag with some macros in my .vimrc. I currently use these two macros to comment/uncomment in C-style "c-style (//) comment (press the [.] key) ...
2
votes
4answers
995 views

Turn NumLock on on startup?

I usually edit in Vim,and when pressing +, I'd rather move my hand to the right part of the keyboard where + resides rather than doing shift + =. But when NumLock is not on, in Vim it just opens a ...
7
votes
2answers
329 views

How do I get just the user-manual for Vim

To get the vim user-manual I am doing vi test and then, once the file is opened, I do :help user-manual This opens up a split window, which makes reading manual inconvenient to read. How do I ...
2
votes
1answer
428 views

Fall-back for $VIM is invalid

I am working directly on a dev server and want to build my own vim, for my purposes, not for all system users. The build scenario is: hg clone https://vim.googlecode.com/hg/ vim cd vim/src ...
1
vote
3answers
306 views

vim/emacs plugin to view recursive grep search search results?

Suppose I have a file formatted like this: file1:123 file2:4444 some/other/file:2233 This represents the search results from a grep (i.e. file:line-number). I'd like to have a vim plugin which ...
2
votes
2answers
879 views

ZSH tab completion: only complete files and not binaries

Is it possible to make a custom zsh completion file,so when hitting tab for filenames it avoids completing the binaries? For example,I have 2 files , myprogram.c and myprogram,the binary,is it ...
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 ...
4
votes
2answers
5k views

How to map ALT key in .vimrc?

In order to be able add blank lines without going into insertion mode, I'm trying to map ALT-o and ALT-O to o<ESC> and o<ESC> I've tried the following in my .vimrc map <M-o> ...
7
votes
5answers
6k 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 ...
9
votes
4answers
2k views

Why would vim return non-zero exit code if I exit immediately after opening?

I'm running into a bit of a strange problem w/ vim on Snow Leopard: I get a non-zero exit code from simply running vim and then quitting. $ vim # exit immediately using :q $ echo $? 1 However, if I ...
4
votes
2answers
480 views

Vim keybinding to delete up to (but not including) the next period

I've noticed a common idiom in my editing is a desire to delete everything up to, but not including, the next period. After a bit of researching online, I found the following command will work (I ...
4
votes
1answer
639 views

Quit VIM is slow, usually 2 seconds, it shows

On quit, vim shows that: ".netrwhist" [Not edited] --No lines in buffer-- This process usually takes 2s. How to turn this thing off? --- Update --- I noticed that netrw is installed as ...
1
vote
1answer
603 views

Documentation for vifm?

vifm looks like a good file manager, but it lacks documentation. Is there a manual or tips on how to use it? I'm looking for information on copying/moving a dir, creating a new empty file, editing a ...
12
votes
4answers
445 views

Is there a vim shortcut for <name of current file>?

In vim, if I'm working on a Python script, I will commonly type: :! python this_script.py to execute the script. Is there a shortcut for the name of the current file? If not, can I easily make one? ...
4
votes
2answers
230 views

Vim - buffer names in the cmd line area

When I edit files with vim there is always this in the cmd line area,under the status line,all buffers' names(image : ) Is there any way I can remove it?
1
vote
3answers
2k views

Is it possible to execute a VIM script in a non-interactive mode?

The Gnats bug tracker has a command (edit-pr) that opens a ticket in $EDITOR. My $EDITOR is VIM, and when this command opens the ticket in $EDITOR, I'd like to automatically perform some scripted ...
4
votes
2answers
244 views

Indenting multiple files

I want to indent multiple files which are poorly indented and indent them properly as would vim do when I type gg=G. Is there someway to enter the = command or its alias in the command mode? i.e ...
11
votes
4answers
12k views

How to select/delete until end of file in vim/gvim?

Accidentally I managed to copy-paste a paragraph in vim a zillion times. How do I select and then delete the text from my current position to the end of file? In Windows, this would be ...
3
votes
3answers
2k views

How to copy from one vim instance to another using registers

How can I select the + register? I have problems following the instructions below to copy/paste text from vim to another vim: In the vim, highlight, select + register, and yank (save) to it: Shift-v ...
2
votes
1answer
112 views

Script for opening corresponding pdfs for bibtex keys in Vim

Context I currently write research articles in LaTeX using Vim. I have bibtex keys in my articles like \cite{smith2000sometopic} and I have corresponding pdf versions of most articles in a subfolder ...
6
votes
1answer
157 views

Sending commands to dbx from Vim

Using this information, I've been able to debug code using dbx and display the code from within Vim. What would be really cool is if I could send commands (step, next, print, stop in ... etc) to dbx ...
1
vote
2answers
134 views

How to display the server time inside Vim

I want to know how to display the server time inside the Vim editor, if possible.
8
votes
2answers
741 views

vim spell checker?

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

Replacing Multiple blank lines with a single blank line in vim / sed

Question more or less says it all. I'm aware that /^$/d will remove all blank lines, but I can't see how to say 'replace two or more blank lines with a single blank line' Any ideas?
30
votes
8answers
23k 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 ...
7
votes
2answers
871 views

How to do a text replacement in a big folder hierarchy?

I want to search and replace some text in a large set of files excluding some instances. For each line, I want a prompt asking me if I need to replace that line or not. Something similar to vim's ...
3
votes
1answer
490 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 ...
2
votes
1answer
224 views

Vim config for specific filetypes

I'm struggling with using .vimrc to apply specific configurations based on the filetype. Following the autocmd FileType suggestion here, I have attempted to apply a configuration based on filetype. ...
5
votes
1answer
700 views

Trying to get vimpager (to replace less) working with nerdTREE

I'm trying to get switch over to vim as my primary editor and I've installed the nerdTree plugin, but now when I try and use vimpager to replace less I get Error detected while processing VimEnter ...
3
votes
2answers
1k views

How to map one vim command to execute bash commands based on OS?

In short, can single bash commands in the terminal contain conditionals? If so, how? I have in my vimrc (shared across systems) the following command to open my current LaTeX document in .pdf form: ...
12
votes
6answers
7k views

Are cygwin vim commands different than normal vim?

I am unable to edit text files using vim in cygwin. I have to press i many times to insert text. Sometimes it works and sometimes doesn't. Whenever I move cursor up down I have to press I many times. ...
25
votes
5answers
3k views

Why does `ESC` move the cursor back in vim?

In vim, when I hit ESC to return to command mode, the cursor moves one character to the left. This is not what I would hope for, occasional I immediately hit l to move back to that spot, perhaps to ...
8
votes
5answers
15k views

delete line in vi

How can I delete a line in VI? Here what I am doing right now: Open up the terminal alt + ctrl + t vi a.txt I move my cursor to the line which I wan to delete, then what key-combination is should ...
37
votes
5answers
3k views

Becoming root from inside Vim

Sometimes I start editing configuration files in /etc using Vim, but forget to use sudo to start Vim. The inevitable result then is that after finishing my edits I encounter the dreaded notice that I ...
6
votes
1answer
903 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?
5
votes
3answers
1k views

Vim: word wrap for documents

Whats the best way to do word wrapping for a document in vim? I'd like have each line wrap at 80 characters, not just visually wrap but enter a newline. I got this kind of working by using :set wrap ...
3
votes
2answers
773 views

The Right Distro for text-based needs

I'm searching for the right Linux Distro. My four current ideas are: Gentoo Grml Arch Debian But I'm absoluty open to more alternatives. Now a little bit more about my needs: I want it to be ...
2
votes
3answers
772 views

Unmet dependencies

I am trying to compile vim and install with "--enable-pythoninterp" flag, which needs the python-dev package. INFO I obtained the vim source from ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2 Vim7.3 ...
1
vote
4answers
8k views

How can I find and replace with a new line?

I have a CSV delimited by commas and I want to delimit it by newlines instead. Input: a, b, c Output: a b c I've written Java parsers that do this stuff, but couldn't this be done with vim or ...
4
votes
1answer
292 views

Why is Vim eating up Ctrl when used with Ctrl+v and how to fix it?

I'm using Vim /etc/zsh/zshrc to add key bindings for zsh because it doesn't work with inputrc. In my terminal with tmux when I type Ctrl+v then Ctrl+LeftArrow the shell will show ^[OD. However, when ...
9
votes
2answers
625 views

vim: use string from search in replace command

I often use vim / search command to verify my regular expressions (just to see what it matches). After that i usually use the :%s replace command, where i use that regexp from search as a string to be ...
5
votes
2answers
1k views

Is it possible to run a Vim clientserver instance over SSH+tmux

I've been a vim junkie for a year or so now and I've got some great little tricks burnt in to my memory. I do a lot of development (at the office) in a terminal on Ubuntu. One of the things I value ...
4
votes
1answer
888 views

GNU Screen makes Vim ESC key slow

Screen makes my ESC key wait for more commands I beleive, and if it does not get those commands, it sends it to my terminal Session (which I am running VIM in). ESC is used alot in VIM and currently ...
1
vote
1answer
329 views

Ctrl + Right and Right send same Sequence in Putty > Screen > Vim

I'm using putty > screen > vim, and screen is sending the same sequence for Ctrl+Right and Right in application mode for vim. There is an option to make putty send the cursor mode sequences ...
2
votes
2answers
270 views

Specify an alias as preferred editor in rc files (like .cvsrc)?

I have in my .cvsrc: cvs -q -e vim I want to create an alias (like my-vim or something like that): alias my-vim="vim -S ~/myscript.vim" And do cvs -q -e my-vim Unfortunately, this doesn't ...
2
votes
1answer
393 views

How to stop Vim from changing my directory when executing a makefile?

OK, I posted this question before I knew the extent of what was happening. Suppose I have a mix of Python and C++ code. I use a simple makefile which copies the files from my editing directory to ...