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

39
votes
4answers
21k views

256 color support for vim background in tmux

while using vim within tmux I can see that 256 color support is enabled. with $tput colors However changing the colorscheme in vim while in tmux will change the colorscheme on a per line basis but ...
21
votes
2answers
8k views

How to get shift+arrows and ctrl+arrows working in Vim in tmux?

This is all in iTerm2 on OS X. I used to have export TERM='xterm-256color' in my .bashrc. This meant Vim in tmux did use 256 colors. And once I added set -g xterm-keys on then keyboard ...
10
votes
1answer
4k views

How to select a rectangular range in VIM?

Assuming I have a text like abc121313131abc abc13153545464abc abc4325435345abc abc343535353535353abc I want to select the abcs in front of the 4 lines.How can I do this?
8
votes
4answers
2k 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 ...
1
vote
4answers
840 views

Trying to remove the first column of a document

I'm using this command below to remove the first column of a document: %s/^[^\t]*\zs\t[^\t]*\ze//g but it says command not found. Any idea?
15
votes
10answers
3k views

Good vim tutorial? [closed]

I've constantly heard good things about vim, and now I'm intrigued. The only thing that's putting me off is it's irregular keyboard controls. Does anyone know of any good beginners tutorials for vim?
21
votes
3answers
7k views

How can I keep the code formated as original source when I paste them to vim?

When I copy some code from webpages and paste it to VIM,I find it becomes a mess style like a ladder as follows xxxxxx xxxxxx xxxxxx xxxxxxxxxx Since it messed so regularly so I ...
11
votes
3answers
2k views

I'm an Emacs user. How do I learn Vim?

Most of the time, I use Emacs. However, I've decided to try to learn Vim. I'm happy with Emacs, I just am trying to avoid having it turn into Maslow's Hammer. I've seen a few tutorials, but I have ...
17
votes
3answers
4k views

copy-paste not working in MacVim when launched in tmux

MacVim's copy-paste stops working when I launch it from a tmux terminal (on zsh). If I exit tmux and then launch MacVim copy-past works. Any idea how to fix this?
13
votes
2answers
3k views

How can I use the Homebrew Python with Homebrew MacVim on Mountain Lion?

I originally asked and answered this question: How can I use the Homebrew Python version with Homebrew MacVim? These instructions worked on Snow Leopard using Xcode 4.0.1 and associated developer ...
14
votes
4answers
4k views

Using Vim/Gvim with multiple GUI windows

Is it possible to have 2 or more (G)vim windows for the same session, or at least share some buffers. Here, "window" refers to a Gnome(or KDE, or Windows etc.) window, not a VIM window. I use two ...
16
votes
2answers
9k views

How does one switch between windows on VIM?

I'm using both Vim and MacVim (or well, trying to). I installed the Tagbar plugin but find it impossible to switch to the actual Tagbar window to make my selection. I've been reading loads about ...
5
votes
6answers
2k views

vim like navigation on Adobe Acrobat Reader

Adobe Acrobat Reader is currently one of the good pdf readers available on Linux platform. xpdf and evince to their job well, but acrobat's display seems to be better. I am used to vim editor and I ...
3
votes
5answers
4k views

Messed up keys in vim when running inside tmux

I have been playing with tmux and I'm loving it. However, there's an annoying issue when running vim inside it. Somehow the arrow keys get remapped, but only on certain times, like when firing up ...
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 ...
7
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 ...
10
votes
4answers
5k views

Remove VIM search highlight

After a search I've done, all the matches for the respective query remain highlighted and it's annoying. This happens even after I close the respective file (normal behavior?). How to I remove this?
10
votes
3answers
2k views

vim: enable folds but don't automatically close them

I really like the folding in Vim, but there are a couple non-file buffers (command-t plugin's window for one) that I really don't want it folding, as the normal fold commands don't work there. If I ...
7
votes
2answers
23k views

Install Vim in Cygwin

I have installed Cygwin on my Windows machine and I have also selected some additional packages as part of my installation (like GCC etc). Now I want to add Vim also to my existing Cygwin setup. What ...
3
votes
1answer
920 views

PDF-XChange Viewer, pdflatex, Windows XP Pro SP3

Howto make pdfxcview.exe not lock PDF files when opening them or force pdflatex ignore locks (and thus be able to overwrite PDF while generating content with pdflatex or simply manipulating content ...
2
votes
2answers
888 views

Use of hash (#) on OS X with UK MacBook Pro

I have MacVim on a UK MacBook Pro. I can use the hash on TextMate by typing alt 3 but in vim this does not work. Do you know how I can type a hash using VIM on a UK MacBook Pro? The problem is ...
5
votes
4answers
128 views

How do I sort multiple blocks of text by the first line in each block in Vim?

I have multiple blocks of text, or in other words, multiple functions like this: def ==(other) ... end def to_s(full=false) ... end def to_a ... end def to_hash ... end def inspect ... ...
5
votes
1answer
2k views

Backspace key not working in vim

I am using vim under Terminal.app and just a few days ago the backspace key stopped working. Whenever I am in insert mode, the backspace key does nothing. However, when I am in normal mode, the ...
4
votes
2answers
2k views

when running screen on OSX, command+r messes up arrow keys in vim across all screens

How do you unwind this? because you wind up pressing command r all the time to reload your browser, and often you're in the terminal. Since I haven't figured out how to re-enable the arrow keys, I ...
2
votes
5answers
3k views

Make text bold in vim

I am working on Ubuntu and using vim to make C files. I want to make the entire text in the editor bold. How can I do that without installing any plugin? I am not looking to make specific words bold. ...
2
votes
3answers
2k views

Select all in vim through PuTTY

I'm PuTTYing into a Linux machine from a Windows computer. I'm opening up a large log file in vim and am having enormous difficulty trying to figure out how to select all the text and copy it into a ...
9
votes
2answers
8k views

Vim Stuck In Insert Mode

I've been using Vim for several months now via my web host (they allow putty access). All of a sudden, the escape key has become unresponsive. I cannot exist insert or any other mode by simply hitting ...
5
votes
1answer
3k views

nerdtree and current directory

How can I achieve this situation? Open vim in my home folder. Navigate somewhere with NERDTree Run the :!ls command and see the contents of the directory in that NERDTree is displaying
4
votes
1answer
433 views

Is there an easy way to use Vim text-objects on camel case words?

Often I'll be doing a quick edit to a camel case word in some code and wish I could use something like text-objects to select one part of the camel case word. For example, given this snippet: class ...
3
votes
2answers
502 views

How to remember multiple tabs' session in terminal in ubuntu?

I have opened many files in vim and there I am editing and tracing the program flow using ctags and I don't want to lose all those info in next reboot, I can't keep my system on for few weeks or ...
2
votes
3answers
2k views

Opening first lines of large files in VIM

I run Windows XP and gvim7.2. I want to inspect a large (130 MB) XML file with VIM. Is it possible to simply open the first 1000 lines of the file?
1
vote
2answers
135 views

Maintain cursor position in window when typing (Using vim on Windows and/or Linux)

When typing text I don't like the way the cursor slowly descends towards the bottom of the screen. Instead I would prefer if the cursor stayed in the same place and the text above the cursor moved up. ...
1
vote
3answers
2k views

Mapping specific keyboard key to vim

I've got a tremendous keyboard: Microsoft Ergonomic keybord 4000. I'm also a intensive vim user on fedora. The keyboard have a switch - FLock - that change the value for all - keys. Once switch they ...
1
vote
3answers
941 views

Custom Vim Highlighting (only works with specific file types)

I have this in my vimrc: "on will override defaults set. Enable will allow you to set defaults." syntax enable ... "attempting to highlight specific keywords so it is easy to see in code." "see ...
0
votes
3answers
125 views

VIM - How to Bold, Italic, Underline and Hypertext Specific Words?

I am new in VIM. I am writing some files using VIM. I did enough research but didn't get the answer anywhere! I just wanted to know how can I Bold, Italic and Underline a word in VIM. Also I want to ...
0
votes
0answers
120 views

Vim scripting with Tcl: encoding mismatch

I am trying to write a plugin for Vim using Tcl as the backend language. I have written and tested most of the code and it seems to work fine except for one hurdle I can't seem to get over: encoding. ...
0
votes
0answers
424 views

MacVim with Mac Keyboard: Where Is the Right CTRL Key? [duplicate]

Possible Duplicate: Emulating the ‘right ctrl’ key on MacBook Pro keyboard (which lacks an actual ‘right ctrl’ key) I can't seem to find it... and I want to use it for MacVim to facilitate ...
23
votes
6answers
10k views

Vim: How to synchronize NERDTree with current opened tab file path?

When I open a new tab with different path from the previous file in VIM, NERDTree will still remains the same directory hierarchy of the previous file. Is there a sync shortcut to change the current ...
15
votes
3answers
10k views

Mousing and Page-Up/Down in Terminal for Mac OS X

Compared to *nix, Terminal.app seems pretty lame. How can I get it to: Send Page-Up/Down to an application, instead of just scrolling the terminal output Mouse around in vim. set mouse=a isn't ...
19
votes
3answers
8k views

How do I customize zsh's vim mode?

Ok, so I finally made the great change. In my .zshenv, I changed my EDITOR: export EDITOR=vim There are a couple of questions I have that are so minor that I didn't want to start separate ...
17
votes
7answers
11k views

Vimperator copy/pasting

I'm trying out Vimperator. I mainly wanted it for the hjkl scrolling, and I like its "hint" system for following links. These two features are really all I need; I think. I don't mind the other ...
33
votes
9answers
26k views

How can I get (g)Vim to display the character count of the current file?

I like to write tutorials and articles for a programming forum I frequent. This forum has a character limit per post. I've used Notepad++ in the past to write posts and it keeps a live character ...
23
votes
3answers
11k views

How to setup a line length marker in vim/gvim?

Some GUI text editors have a vertical line which serves as line length marker (it helps keeping lines shorter than 80 chars in source code files). Is is possible to have something similar in ...
15
votes
3answers
9k views

In vim, how can I quickly switch between tabs?

In gnome-terminal, I can just press Alt + (1, 2, 3, etc.) to switch to specific tabs. I can also use Ctrl + (PgUp / PgDn) to cycle through tabs (admittedly less convenient, but it can be remapped). ...
37
votes
5answers
5k views

Invoking vi through find | xargs breaks my terminal. Why?

When invoking vim through find | xargs, like this: find . -name "*.txt" | xargs vim you get a warning about Input is not from a terminal and a terminal with pretty much broken behaviour ...
31
votes
1answer
9k views

How to get vim to open multiple files into tabs at once

Is it possible to get vim to open multiple files into tabs, similar to the way the args <path> command will open multiple files into buffers? Doing something like :tabe ./* results in the error ...
17
votes
6answers
5k views

How do I replace-paste yanked text in vim without yanking the deleted lines?

So I usually find myself copying text from one point to another while overwriting old text where the new is pasted: blah1 newtext blah2 wrong1 blah3 wrong2 blah4 Suppose I visual-mark newtext and ...
13
votes
1answer
4k views

vim delete all lines that do NOT contain a certain word

In vim I can delete all lines that contain the word "price" with this :g /price/d How can I delete all lines that do NOT contain the word "price"?
23
votes
8answers
17k views

How to remove this symbol “^@” with vim?

I have some files that are corrupted with this symbol: ^@ It's not part of the string; it's not searchable. How do I substitute this symbol with nothing, or how do I delete this symbol? Here ...
19
votes
1answer
2k views

Can't resize vim splits inside tmux

Everything is working fine outside of tmux. But in tmux I can't resize vim splits with the mouse. I have set mouse=a in my .vimrc. Is there a solution for this? .tmux.conf: $ cat ~/.tmux.conf ...