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

learn more… | top users | synonyms

2
votes
1answer
82 views

Expand pattern under cursor to all files matching it

Is there anyway to let VIM expand the glob pattern to all files that match it? e.g when I type *.c, and press some key, it would become a.c b.c
2
votes
1answer
71 views

Finding parentheses with % in vim across lines

In the following text block, starting at 1 or 3, and pressing % in normal mode in vim, finds the pair of matching parentheses, and toggles between them if you press % again. Starting at 1 finds the ...
4
votes
1answer
652 views

Is there a Vim syntax file for ANSI-colored output of CLI apps?

I have quite a lot of Perl scripts which print colored output to the terminal, using Term::ANSIColor. This is the same as when a shell script does e.g. echo -e '\e[1;31mError:\e[0m Your fault.' ...
19
votes
9answers
3k views

Bash commands inside vi

Is it possible to type a bash command inside vi and get the stdout? I find it often tedious to close and reopen vi just because I want to look something up in the shell.
4
votes
1answer
567 views

Vim high CPU usage upon opening JS files

Vim and especially Gvim stops responding and utilizes 100% of CPU upon opening big .js files (1000+ lines). Pressing Ctrlc stops the process. Whatever Vim does trying to open the file, it displays the ...
2
votes
5answers
2k views

Comment all lines in a text file?

In a text file I need to comment out all lines by adding a ";" as first character of each line. What is a good way to do this? I thought of Vim's visual block mode, but I couldn't find a "select all" ...
6
votes
1answer
806 views

VIM Executing a key command in a function

I have a function, and I want to execute a key command, but I get the error Trailing characters: function! MyFunction() if condition <C-W><C-W> else :some_other_command ...
7
votes
2answers
2k views

How to allow Page Up in GNU Screen?

I use Vim to edit text files on Linux. Commonly I connect to remote Linux machines using PuTTY from Windows. I use GNU Screen commonly as well. When using Vim inside Screen I am unable to use the ...
4
votes
2answers
94 views

Editing a sequence of fields in vim

I have a file like this: INSERT INTO `example` (`name`, `location`, `height`) VALUES ('A', '', ''), ('B', '', ''), ('C', '', ''); I want to fill in the middle set of quote marks (the ones under ...
10
votes
2answers
834 views

How to set on executable bit for a particular file automatically

I want that when i make create a particular file, suppose i create it in vim editor, the created file should get executable permission as well when it gets created . I want this as i am creating some ...
1
vote
1answer
1k views

Vim powerline plugin colour of Normal mode

I installed vim-powerline and was wondering how to change the backlground colour of the normal mode -- currently set to #adf000 according to the Gimp -- to something else. I assume that the change ...
4
votes
1answer
351 views

Switching between split buffers in vim

recently starting trying to use VIM as my full-time text editor since I spent a lot of time SSH'ed anyways. Recently installed NERDTree so I can quickly swap between files in a project. Easy question ...
3
votes
2answers
204 views

place the aliased version of an existing command in /usr/bin/

I use Vim a lot, and I know how I can start vim in insert mode. So I have an alias named vii in my .bash_aliases file. On other hand I use Git a lot too, and I have this line in my .gitconfig: ...
4
votes
1answer
155 views

Using Regex in vim movment

Is there any way to use regular expression for movement in vim. For example, I want to move my cursor to the first occurrence of the pattern abc. So can I do something analogous to fa but now a ...
3
votes
2answers
192 views

Vimrc, map control-; to an action

How do I map holding down Ctrl and pressing ; in Vim? It doesn't work on my Linux terminal. Ctrl-l works fine after putting <c-l> some_action in my vimrc, but <c-;> some_action does ...
9
votes
3answers
430 views

How to `locate` multiple files and open them in vim?

Suppose that I have a file named filename123.txt and it is the single file that is named so, and I can locate it with the command locate filename123. And it returns only this file. Now I want to open ...
5
votes
2answers
267 views

gvim pipes not reading zshrc when started from desktop

I'm using zsh as my default shell and using .zshrc to modify my environment variables. When I start gvim from terminal everything is fine however if I start gvim with the desktop icon, my env ...
10
votes
1answer
381 views

Can I make vim change its cursor behavior?

I've been using vim for a few years as a secondary editor but for various reasons, I find myself using it more and more even when my primary editor is available. One problem that has always bugged me ...
4
votes
1answer
797 views

How to skip vim message “Press Enter…” after running bash commands

After running bash commands(e.g !mv file1 file2) vim outputs result of that command and prints this message: Press Enter or type command to continue Is there a way to skip this message and return to ...
12
votes
3answers
9k views

How to get VIM to display 256 colors properly

I'm trying to get 256 color theme files to work with VIM under xterm. This is peaksea how it looks for me: How it should look: I've tried following the tips on the wiki page to no avail. set ...
5
votes
1answer
3k views

Why is vim creating files with DOS line endings?

I have set fileformat=unix in my .vimrc, and yet if I create a file in vim (running in Cygwin) it persists in creating DOS files, and I have to run the little cotton-pickers through dos2unix to ...
4
votes
2answers
349 views

echo a customized message with VIM editor

How can I deltect if there is a file modification in VIM upon exiting (:q)? If there is a file modification Vim echos E37: No write since last change (add ! to override) I want to override this ...
8
votes
3answers
6k 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 ...
2
votes
1answer
4k views

I'm not getting syntax coloring in vim (using Cygwin)

I've been so far unable to figure out why vim's syntax coloring is not working for most files, and it's driving me batty. In case this is relevant: I'm working in Cygwin (more ...
0
votes
1answer
122 views

How do I get bcvi installed and working (with Cygwin and Perl 5.8.8)?

I'm trying to install bcvi (under Cygwin), and there are apparently no directions that apply to this setup. The directions at http://sshmenu.sourceforge.net/articles/bcvi/#installation state that ...
2
votes
1answer
309 views

How should I go about setting up vim-pathogen plug-ins for a group as a user with no root permissions?

I do not have root permission on a linux cluster, but I would like to share my vim-plugins to all other members of a linux group using vim-pathogen. We have a group-accessible folder, so that's where ...
3
votes
2answers
626 views

Ansi escape code in VIM

I have a log file with colored log entries, where colors are defined by ansi escape codes. When I display the file (using cat or more), terminal understands the ansi codes and logs are colorful. But I ...
0
votes
1answer
285 views

Gvim opening files in new tabs

I was wondering how I can modify the gvim.desktop file so that it opens files in new tabs. Also I want it to create a new instance of vim in case it is not supplied with any files(eg. Invoked from ...
5
votes
2answers
2k 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 ...
6
votes
3answers
5k 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?
11
votes
1answer
2k 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 ...
12
votes
4answers
3k views

Preserve modified time stamp after edit

For files within a specific folder, I would like vim to never touch "modified" timestamp at all. The background is that I use Bloxsom for blogging, which uses plain text files in ~/bloxsom as source ...
9
votes
1answer
1k views

What would cause vim not to retain command history?

On other distros I have run, vim remembers your command history even between sessions; this is especially handy when doing a lot of similar operations on different files. For some reason, it has been ...
21
votes
6answers
3k views

Using VI keys to edit shell commands in UNIX

I used to have a co-worker who was really good at UNIX. He showed me how to use Vi key bindings to edit my shell commands. He placed the command in a file that ran every time I logged in. Since ...
3
votes
1answer
188 views

How to delete in vim everything in between the cursor and the end of the line while on insert mode?

While in normal mode I can delete all the characters after the cursor by typing d$. I'd like to achieve the same but in insert mode in the same way that you can delete things to the left of the cursor ...
6
votes
1answer
352 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.
7
votes
2answers
2k 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 ...
6
votes
3answers
715 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 ...
5
votes
1answer
357 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, ...
9
votes
1answer
1k views

How to have tail -f show colored output with vim?

In this question, Gilles answered Yet another possibility is to run tail -f in an Emacs shell buffer and use Emacs's syntax coloring abilities. Because I'm a vim user, I'd like to do this with ...
3
votes
2answers
2k views

Copy & Paste over several files with vim?

Vim seems nice for most of the times and outperforms other editors in some categories. But what about Copy&Paste? (It seems to me that even MS DOS' EDIT.COM seems to outperform vim in this ...
1
vote
1answer
360 views

Map caps to esc for RHEL 5?

I have an older version of RHEL. In newer versions, there is usually an option to map the caps key to the esc key. How would I do this in an old version? Going to System Preferences -> Keyboard -> ...
3
votes
1answer
87 views

Vim mapping behaving strangely

I have the mapping shown below, in my ~/.vimrc. However, this mapping also hijacks the Enter key. So, whenever I hit Enter it executes the tabedit % command. I am using gvim 7.3 nnoremap <C-m> ...
0
votes
1answer
368 views

Vim not showing garbage characters

I copied the content of an ant build.xml document from an .odt file to Vim editor. There were no garbage characters I could observe, but the build process failed due to incorrect XML tags. I assume ...
2
votes
1answer
237 views

Beep when typing backslash in cvim normal mode

I installed the cvim plugin for vim. Almost all the cvim commands start with '\'. But I when enter this character in normal mode, all I hear is a beep. Nothing happens. What might be causing this ...
3
votes
4answers
6k views

Advantages (or downsides) of GVim over Vim to edit code

Should I install vim or GVim ? I develop mainly Ruby on Rails (I also use IDE's, but different topic). Are there any differences or advantage of using Gvim vs vim ?
8
votes
3answers
375 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 ...
5
votes
3answers
1k views

E763 with vim and spell checker

I want to add germand spell checking to vim. So I set :set spl=de_de spell then there is a dialogue, where I can create a directory called .vim/spell. And then there is another question where I can ...
2
votes
2answers
2k views

Help understanding modifiable in Vim

During a OS upgrade (Linux), Vim or some part of it has been updated as well. Now it happens that sometimes when I save a file (the file is not saved) I get this error: E21: Cannot make changes, ...
3
votes
1answer
456 views

Vim insert mode completion for sentences

I would like to have insert mode completion for sentences rather than lines in vim. C-x C-l completes lines, but cannot complete sentences that do not start with a new line. For example: I have a ...