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

learn more… | top users | synonyms

5
votes
1answer
322 views

vim.googlecode.com SSL certificate change

I am building vim from source and keep having to update the SSL hostfingerprints of my ~/.hgrc file. It's getting a little silly and large – see below. The pattern is the same: run update, ...
5
votes
2answers
405 views

vim: create file with +x bit

Is there any way to set +x bit on script while creating? For example I run: vim -some_option_to_make_file_executable script.sh and after saving I can run file without any additional movings. ps. ...
5
votes
2answers
995 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 ...
5
votes
1answer
393 views

As we call `#!/bin/perl` 'shebang', what we call `-*- perl -*-`?

The first line of a script may be in format of #! interpreter, so the shell will execute the script using the specific interpreter. This is so called shebang or shbang. Similarly, there can be some ...
5
votes
2answers
144 views

Can I get vim-stlye (hjkl) navigation for GNU info?

The layout of my netbook's keyboard means that using the arrow keys for navigation is slightly uncomfortable. Is there a way to make GNU Info pages use vim-style hjkl navigation? I know I can info ...
5
votes
1answer
259 views

What is the point of Virtual replace mode in Vim?

The help says that virtual replace mode commands in Vim gr & GR replace characters in screen estate and not in file. :help Virtual-Replace-mode I am understanding this as something like ...
5
votes
2answers
2k views

Change colors in console/virtual terminal

Is there a way to alter all the available colors in console / virtual terminal? By console, I mean what you get after pressing CTRL + ALT + F1 and not anything like xterm or urxvt. So, I guess that ...
5
votes
2answers
484 views

exact match in regrex when using vim, man, or less

when using vim, man, or less, I want to do some exact match in regrex for example, when using man, I want to check the argument '-c' if I use /'-c' the matching could be -cim ...
5
votes
3answers
3k 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 ...
5
votes
3answers
231 views

vim regex not need \ to escape

In Vim is there an option to write regexs in the same style as Awk for example/sp\{0,\}/ Would be /sp{0,}/
5
votes
1answer
1k views

vim auto indenting even after setting noai option

I am using vim 7.2 from putty terminal. Even if I run set noai it seems vim still trying to indent code. I am copying my code from Notepad++ to vim. following is from Notepad++ and following what I ...
5
votes
1answer
501 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 ...
5
votes
2answers
508 views

Does using ctrl+c instead of esc to exit insert mode break anything in vi?

When using vi, you can exit insert mode with Ctrl + C instead of the more traditional Esc. Are there any situations where it would be undesirable to use for former instead of the latter? Does it break ...
5
votes
2answers
764 views

Is it possible to create and use menus in (terminal-based) vim?

I'm setting up virtualized Linux boxes (as local development servers) for developers at a company that is primarily Windows-based, and some of developers make negative cracks about vim (among other ...
5
votes
2answers
797 views

vim custom pop up menu

How do I create a custom completion pop up menu. I would like to be able to begin typing a part of a string then press a custom key combination to bring up a pop up completion of just a certain group ...
5
votes
2answers
286 views

Make vim / curl recognize https:// links

I recently noticed vim/vimdiff can open links (using curl, it seems), which is an awesome feature. I wanted to use it today, like this: vimdiff deps ...
5
votes
1answer
256 views

Why doesn't vim ask for password when reopenning an encrypted file?

If I run Vim and then open an encrypted file it asks for the encryption password. If I close the window where the file was opened (without closing vim) and then reopen the file, the password prompt is ...
5
votes
1answer
4k views

Vim 7.3 with Lua: How do I use it?

The latest Vim release is awesome! I compiled it with --enable-luainterp=yes and it does have the Lua feature: % gvim --version | egrep '\+lua' +linebreak +lispindent +listcmds +localmap +lua +menu ...
5
votes
2answers
176 views

Lowercase all but the first (Uppercase) letter from UPPERCASE in cyrillic

To make all letters a lower case except the first letter. The first letter would look like "Uppercase" after I changed (from UPPERCASE in cyrillic). The rest (not UPPERCASED) leave unchanged. I'm ...
5
votes
3answers
3k 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 ...
5
votes
1answer
383 views

Conditional search and replace on a line in vim?

Let' say I want to comment and uncomment a line. I know I can :s!^!//! and then :s!^//!! Now what if I want this as an one-liner? Basically, if a line starts with // then remove it, else add ...
5
votes
2answers
41 views

How do I pick up a previous modification in VIM?

If I did several modifications to the original file, i.e. 1 delete a line 2 insert some text 3 delete another line 4 delete the text added in step 2 5 insert some other text 6 ... Now I want to ...
5
votes
2answers
439 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 ...
5
votes
3answers
1k views

In vim, search backwards for matching braces/parens

As most of you probably know, you can use % to search forwards on the line to find the next paired brace/bracket/paren and move to its matched partner: |a|rray[index] = value; " |e| is the cursor; ...
5
votes
2answers
145 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 ...
5
votes
2answers
153 views

Carriage return vs newline in vim

In vim, when I opened a file, I wanted to add two empty lines at the end of each current line. I used the following switch: %s/$/\n\n/ Apparently, this does not work, but what does work is: ...
5
votes
2answers
146 views

How to consistently start Vim's command line to make a mapping work in any mode?

I try to normalize access to Vim's command line mode from any other mode in order to simplify my actual mappings. For example to make the <f6> key work from anywhere I define the following ...
5
votes
1answer
563 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 ...
5
votes
1answer
175 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 ...
5
votes
2answers
100 views

Make vimdiff display different lines as different lines (not partially different)

vimdiff has an annoying habit of displaying two almost-completely-different lines as the same partially-different line just because they share a character in common at the beginning or end. For ...
5
votes
2answers
710 views

How can I disable terminal resizing

Vim scripts sometimes resize the whole shell (in my case the Taglist plugin). I don't want this behavior, which is possible with the shell command resize, too. Is there a way to suppress the whole ...
5
votes
1answer
107 views

Vim syntax highlight certain lines

I have php files well any file type in general that I would like vim to highlight here docs sections using a different syntax highlighting. <?php echo <<<HTMLDOC <h1> I am ...
5
votes
1answer
206 views

How to change Vim's command type mode programmatically?

Is there a simple way to switch from one command type mode to another without loosing the current command line? In my ~/.vimrc file I remap the <space> and <c-space> character, coming ...
5
votes
3answers
360 views

Search and replace next n words in vi [duplicate]

Possible Duplicate: Vim :s replace first N < g occurrences on a line In vi, how do I search and replace a word's first n occurrences with a word, say "hello", and the next m occurrences ...
4
votes
7answers
847 views

Uncommenting multiple lines of code, specified by line numbers, using vi or vim

I have learned from this Stack Overflow question that it is possible to use vi/vim to comment out a specified range of line numbers. For example, suppose I have the following bash script: ...
4
votes
3answers
1k views

vi/vim, how can I write out a number of lines to a new file

I have a bunch of lines that I want to write out to a different file. How can I do that?
4
votes
4answers
5k views

What causes swap files to be created?

As part of the program I wrote, I constantly read and write data from files. I noticed that as part of doing so, I am inadvertently creating swap .swp files. What do you think is going on? What would ...
4
votes
3answers
272 views

Any way to provide a separate vimrc file just for 1 session

I would like to know, if there is a way in vim/vi to provide a different vimrc file. I am looking at managing 2 different vimrc files. For the contents I checkout/checkin in version control I want to ...
4
votes
2answers
201 views

Sudoedit Vim force write (update) without quit

I'm doing some scripting with Vim and I've just started using sudoedit. Problem is, when I :w it writes to the temp file, so any testing of the script can't happen unless I quit the editor. How can ...
4
votes
3answers
153 views

What's the syntax for selecting a range of lines in Vim?

What's the syntax for selecting a range of lines? I want to run a command over lines 1405 until 1700. And one from 1405 until the end of file, without wanting to look up that number. Update: Is it ...
4
votes
2answers
223 views

Problem : how can I copy/paste this in vim?

I'm working with the vim editor and I found y,yw respectively to copy a line and a word but how can I do the following task in vim? www.pack.google.com From this line how can I copy and paste ...
4
votes
3answers
706 views

Vim unnamed register + or *

Im using Vim 7.3 in Ubuntu and I'm having a little problem copying to the system clipboard with the following command "+y but I'm getting the following error: E354: Invalid register name: '+' In my ...
4
votes
3answers
107 views

What is difference between w and W in escape mode of vim?

I am looking at the vim help quickref commands for moving cursor. Following lines confuse me because I find both of them working same. Could some one elaborate me difference with an example. N w ...
4
votes
2answers
909 views

Globally replace Vi with Vim on Fedora

On Debian-based systems the alternatives system handles both the vi and vim executable. So if vim is installed and you execute vi, you also get vim, which I find very nice, because I absolutely hate ...
4
votes
2answers
2k views

Turning off splitting lines in vim

One of the most annoying features of vim is splitting lines. For some reasons someone found it would be good to split lines even in whitespace sensitive formats. For example changing: echo ...
4
votes
1answer
165 views

Different vim colorscheme depending on mode

I'm often doing the same mistake in vim: I forget whether I'm in insert or command mode, then I type in, I get random commands or I modify/delete code, and I have to undo. I do this mistake really ...
4
votes
1answer
201 views

How to store Vim tabstop settings in the file?

I need different tab widths for different files when using Vim. Is there a way to store this information in the file, and let Vim apply the setting automatically?
4
votes
2answers
76 views

How can I use caps lock to change language in VIM

Can I use capslock for changing languages in VIM instead of Ctrl + 6 in case of "keymap=russian-jcukenwin"? How can I do it? Maybe something like mapping it in the $VIMRC file? How can I map ...
4
votes
1answer
97 views

Idle terminal safe character

I'm using iTerm2 on a Mac to do Linux work. In order to avoid losing terminal connections, I turned on "When idle, sent Ascii code". The default is 0. This works like a charm to keep connections ...
4
votes
2answers
138 views

VIM substitute occurrences of pattern after a particular word in a line

I have such lines in my text. text before pattern = garbage** text after pattern is pattern If in VIM I do %s/pattern/saturn/ it replaces all occurrences of pattern. But I only want to replace ...