Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor.

learn more… | top users | synonyms

9
votes
2answers
5k views

VIM: How to configure Solarized colorscheme in Konsole

I am trying to configure Solarized for use in VIM in Konsole (KDE terminal). This is the result that I get: Note that Solarized looks fine in GVIM on the same machine: I suspect that it is ...
9
votes
3answers
2k views

iTerm2 Vim alt+right/left arrow

As a Linux user, I am very used to jump from word to word in vim/nano using ALT+left or right. This doesn't seem to work properly using iTerm, I am using zsh, I tried adding; bindkey -e bindkey ...
8
votes
7answers
3k views

Emacs equivalent to VIM ci"?

Does emacs have the equivalent of VIMs ci" command? Basically I want to replace the text inside a set of quotation marks. In vim I can ci) or ci] or ci} to "change inner *"...
8
votes
5answers
6k views

Vim: insert empty line above current line (not open, i.e. without entering Insert mode)

is there a way of inserting a new line above the current, without opening the line (so without entering Insert mode)? That is, like "O", but without opening.
8
votes
3answers
3k views

How to paste from multiple clipboards vim without leaving insert mode?

Suppose you are typing in vim and there are 5 common expressions that you need to insert into the text over and over. Is there a way you can tell vim to paste from multiple clipboards without ...
8
votes
5answers
2k views

bashrc: how to know X window is available or not?

There is a part in my ~/.bashrc, which sets $EDITOR to be gvim. It works fine when I am in X window. However, if I ssh to my workstation (from another workstation) gvim starts to complain "cannot open ...
8
votes
4answers
5k views

How to I use Textmate color themes with vim?

I have a textmate color theme I really like this, But I am a hardcore vim user. Is there an easy (painless) way for me to use this color scheme with vim?
8
votes
2answers
5k views

How do you change the default colorscheme in gvim?

In GVIM for Windows I know you are supposed to be able to add something to the $VIM/_vimrc file in order to customize the start up and I have managed how to figure out a few neat tricks with that but ...
8
votes
4answers
2k views

No syntax highlight on .md files?

Vim properly highlights .markdown files, but it seems unfamiliar with .md filetypes. A comment on at the question http://stackoverflow.com/questions/10964681 seems to imply that .md is the wrong file ...
8
votes
3answers
1k views

GNU Screen - Removing vim window after quit

I use urxvt with GNU screen with X11 on my mac. I like it a lot. My only issue, is that when I quit vim, it puts the shell prompt underneath the vim window. This isn't a huge issue, but it ...
8
votes
2answers
567 views

Write vim file as super-user?

This is a usability problem that happens often to me: I open a read-only system file with vim, even editing it, because I'm not attentive enough, or because the vim on the system is badly configured. ...
8
votes
6answers
5k views

Custom vim highlighting

I am editing some xml right now and I have been leaving myself some comments of things to come back to. Like this <!-- Question: bla bla --> I am editing with vim right now and I would like ...
8
votes
1answer
239 views

How to navigate 'logical' lines individually in vim?

I know that there is a setting for this in vim, I just can't find it now... Basically, I like set wrap. I like it alot. I'm less fond of it skipping down to each actual line, rather than the more ...
8
votes
3answers
2k views

vim and TeX filetypes: plaintex vs. tex

I open .tex files with Vim, but some files are recognized as filetype=plaintex and others as filetype=tex. Why is this? What is the trigger that recognizes the file as tex, which has the highlighting ...
8
votes
7answers
3k views

Dvorak hotkey remapping in vim, worth it?

I've been trying to learn the dvorak keyboard layout of late and I have been making some good progress this time around. The trouble I am finding now is that all of my hotkeys are all in the wrong ...
8
votes
2answers
3k views

textwidth=0 and wrapwidth=0 in .vimrc.local not being respected

I have the following lines at the bottom of my .vimrc.local: set textwidth=0 set wrapmargin=0 However, whenever I open a new file, both these values are set to their defaults (72 and 2, ...
8
votes
2answers
6k views

How do I set the default window size in vim?

When I right click on a file and open it in Vim, the default window size is too small. How can I change the settings so that the default window size is bigger? I'm running Vim 7.3.46 in Windows 7.
8
votes
2answers
1k views

how do I copy/paste in vim ex mode

I'm increasingly frustrated by typing this :%s/some_really_long_string/some_other_really_really_long_string_that_may_or_may_not_related_to_the_first_one/gc Is there any way to copy/paste those ...
8
votes
3answers
4k views

Mouse cursor in Terminal?

I use Mac OS X Terminal.app. But the answer to this would probably apply to any typical UNIX-ish terminal emulator in a graphical environment. Question -- what do I do to: Use my mouse cursor to ...
8
votes
2answers
3k views

Notetaking file-based system for Vim

I'm looking actually for something similar to Deft, only for Vim. Does anyone know of any with which he/she has had good experiences?
8
votes
4answers
4k views

tmux copy mode - select text block

I'm using tmux with vi keys, and copy/paste works fine as long as you're selecting one line of text, or if you have only one window. When I want to select a block of text (multiple lines, but not full ...
8
votes
6answers
4k views

How can I make .vimrc read from an external file?

I'd like to modify my .vimrc to read the value of a variable from an external file. How can I do this? Specifically, a friend and I share a git repo with our .vim files, but there are a few small ...
8
votes
2answers
1k views

How can I tell vim to compile a document on save?

I'd like that vim automatically compiles a lout document (similar to LaTeX) every time I save the document. Is there a possibility to add such functionality to save? (Preferably without using ...
8
votes
1answer
8k views

Mapping Left Alt key in Vim?

I am able to map the key combination Right Alt+Left Arrow with <a-left> or by <m-left>. But I am not able to map the Left Alt key. Is there a way to do that? Edit: Just to clarity ...
8
votes
1answer
2k views

How do I do a block search-and-replace with Vim?

I have text in Vim hit Ctrl+V to put VIm in block mode highlight the text I want type : this gives the this prompt :'<,'> I add to the prompt my regex s/ /*/g. This leaves me with ...
8
votes
3answers
1k views

Can I use Vim editing mode on the command line without losing recursive history search?

I'm uzing zsh and, because I'm an avid Vim user, I just switched to using Vim-style editing on the command line. (That means if I type ls foo/bar and decide I want to cd instead, I can hit Esc ^ to ...
8
votes
4answers
3k views

How to exit help in vim

I just used the help files in vim and now I am stuck in help. :q Exits the entire program and I am getting tired of having to close and reopen vim every time I use help. I would prefer a command that ...
8
votes
2answers
1k views

How do I make vim's undo buffer persistent across sessions?

When I make an edit to a file and then leave vim, I would like to be able to undo that change when I reopen it later.
8
votes
1answer
1k views

How to refresh vim layout when split

After setting up some splits/vsplits and resizing gvim or the console running vim, splitter positions are not updated. Is there a way to force updating splitter positions (by retaining them in the ...
8
votes
4answers
3k views

How to replace vim screen buffer with previous bash activity after quitting?

I'm trying to find out what a bash (or vim) feature is. Here's the scenario. I'm in a bash terminal, then edit something with vim, then exit back to bash. In some terminals, the vim session screen ...
8
votes
2answers
2k views

Why does Vim ignore files in ~/.vim/after/ftplugin?

I seem to have a problem with my local Vim configuration but I'm not sure what it is. I need to override some filetype-specific settings. As per multiple tutorials/howtos, I created ...
8
votes
3answers
877 views

Is there a way to “lock” the viewport in vim?

I recently started using Vim with NERDTree. The annoying thing is when I close the buffer, NERDTree expands to fill the rest of the screen, and I have to open another file and reopen NERDTree to get ...
8
votes
3answers
1k views

How can I keep the color when I run the external command inside vim?

For example, for the command ls --color displays colorful results when being executed in the shell. However, when I call :!ls --color inside vim, all color information is gone. What should I do to ...
8
votes
4answers
2k views

Using VIM keys in shell (zsh or bash)

I want to use vim editing keys in my shell (zsh). With bindkey -v i get VI keys, but i want visual and more advanced key shortcuts (like change inner word (ciw), which i use all the time) btw, is ...
8
votes
5answers
5k views

How can I remap my Caps-Lock key to Escape (for Vim) in Snow Leopard?

Obviously, in Linux I can use xmodmap. On Leopard, I used an InputManager called PCKeyboardHack. But InputManagers are now broken. How can I preserve my sanity and keep on using Caps Lock to Escape ...
8
votes
3answers
3k views

Vim powerline doesn't show the current branch

I'm using the vim plugin called powerline and it isn't showing the git branch I'm on, while it's supposed to be activated by default. The fugitive plugin is installed, though I don't think it was ...
8
votes
2answers
213 views

Maintain permissions bits when writing new file with VIM

In Vim, when I write a copy of the current buffer to a new file using :w [filename], it appears that Vim uses the default (i.e. set by umask or whatever) file permissions for the new file. If the ...
8
votes
1answer
5k views

How to tell dropbox to ignore git files?

I have been keeping my vim files in Ubuntu One and since I have a lot of plugins installed as git submodules (or however vundle installs them) and I'm only interested in updating these repositories on ...
8
votes
2answers
458 views

Readline in vi mode: how can I enable up/down arrows?

When bash has vi bindings available (set -o vi), up/down arrows work in both command and insertion mode. When I setup readline's ~/.inputrc to use vi mode (set editing-mode vi), applications like ...
8
votes
2answers
597 views

Vim across multiple monitors

Does anyone have an elegant solution for having MacVim or gvim span across multiple(potentially different resolution) monitors? Having 2 sessions doesn't work well due to separate buffers and swap ...
8
votes
1answer
709 views

gvim redraw failure

I have a problem with gvim where the screen redraw partially fails. It's hard to explain but when I open a text file and page down or up the entire text file is not redraw properly. I have to move the ...
7
votes
5answers
2k views

Highlighting a search term without moving the cursor

Using Vim, I sometimes find myself staring at a section of source code for a while and suddenly want some variable on the screen to pop out. That's easy: /<var> which highlights them all. My ...
7
votes
3answers
7k views

I just got a Mac! How do I do “end” , “home”, “page up” and “page down” in my terminal/VIM editor?

I write a lot of python in my VIM, on the terminal. What do I do?
7
votes
2answers
857 views

Why is vim leaving temporary file versions all over the place?

First of all I assume those files ending with "~" which are created by vim when editing a file are indeed serving the purpose of temporary backups while editing. But every time I open a file with vim ...
7
votes
3answers
3k views

How do I get the numpad to work in vim using iterm2 on osx with term=xterm?

My numpad works in iterm2 (bash), but it inserts characters instead of numbers in insert mode for vim. How can I get vim to recognise the correct escape codes. I have tried editing the escape codes ...
7
votes
2answers
1k views

Lost left/right cursor keys in VIM insert mode?

When I edit .sql file in VIM, I can't use left/right cursor keys while in insert mode. In normal mode they work just fine. In another file types - they work fine as well. in ~/.vim/ftplugin/sql.vim ...
7
votes
3answers
6k views

What could cause strange characters in Vim?

I'm have this really strange problem in Vim using the NERD tree plugin, where, as you can see in the picture, the characters are showing up very strange. Where there is the ahat, ~V 3/4 it should be ...
7
votes
4answers
328 views

Take screenshot on every keystroke

A while ago I saw a cool animation of an explanation to do something in Vim. I would like to be able to do that by taking a screenshot of the Vim window every time I press a key (automatically), does ...
7
votes
7answers
2k views

Vim - Adding empty line between lines

How do I insert a blank line between every non-blank lines? eg. from line 1 line 2 line 3 line 4 line 5 to line 1 line 2 line 3 line 4 line 5
7
votes
3answers
5k views

Vim: how to paste a block of text at the end of multiple lines?

Say I have a block of text like this: // Comment1 // Comment2 // Comment3 And I want to append each of these lines to the end of 3 corresponding lines of code: foo = 1; bar = 2; baz = 3; So ...