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

learn more… | top users | synonyms

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 ...
6
votes
6answers
4k 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. ...
3
votes
1answer
210 views

TERM=(linux|xterm) vi in an xterm or the AAABBBBBBCCDDD-problem

Usually when I want to run vim in a desktop konsole session, I make sure the TERM variable is set to linux as the arrow keys don't work in insert mode with TERM=xterm. They show capital A..D instead ...
4
votes
7answers
850 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: ...
5
votes
2answers
392 views

How to re-run vim auto-indentation on a tex file?

I have a LaTeX source file with its indentation messed up. I am looking for a way to force vim (may be through one of vim-latex-suite commands) to re-run the automatic indentation commands over the ...
4
votes
1answer
125 views

How can I jump to files from vim opening them in a separate tab?

I have installed tags so I can jump to a function body in another file via CTRL + ] I know that I can do gf to jump to another file. I know that I can do CTRL-w s to split the vim window. What I don't ...
1
vote
3answers
59 views

Pasting with spaces added into heads of lines (analogy to comment-chars)?

Please, consider a situation, where you find a nice example and want to copy it to your existing code to see, how it works. The indentation is almost never right right away. If there are several ...
2
votes
1answer
90 views

Vim gg=G (reindent whole file) without losing current position

Recently my main work was editing .xml files. Google told me that for re-indenting a file I need to press gg=G in normal. But moving to gg is something that I don't want. Is there any way to do the ...
1
vote
1answer
54 views

Deleting Word text-objects in VIM

In the expression (word (first-Word second-Word)) on typing diW with the cursor on f, I get (word second-Word)) when I would like just the Word first-Word deleted. On typing diW with the cursor on s ...
1
vote
1answer
377 views

syntax highlighting in vim over ssh

When I ssh from work to the local network, I can turn syntax on in my vim instance and it works. When I go home and ssh in, I turn on syntax highlighting and nothing happens. While at home, if I use ...
1
vote
3answers
76 views

Applying a change to every line?

How to add 4 spaces to every line between marks (bound with m-letter and current line). How to do the same when using visual block?
1
vote
1answer
115 views

vim regex to search for lines containing string1 AND string2

How in vim/vi can I search for all lines that contain string1 and string2, where either string can appear anywhere on the line separated by whitespace and possibly other words? I would also like to ...
6
votes
1answer
224 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.
3
votes
2answers
95 views

How to switch to editing command in text editor [duplicate]

When typing a complicated command that started on the command line in Bash, how do I switch to editing it with ViM?
6
votes
3answers
347 views

Looking for a centred, full-screen terminal

There exist out there several different 'distraction-free editors' for writing: these provide a fullscreen, minimal environment with the goal of forcing oneself to focus on the task at hand. I want ...
3
votes
2answers
122 views

How can I create my own spelling file for vim?

At the moment I'm writing a document where need to use a lot of acronyms, technical language, and non German words. Now I was thinking if I could create a spelling file (tech_speak) which checks for ...
8
votes
2answers
563 views

What is meant by a shell is in “vi” mode or “emacs” mode?

This question follows directly from the answer to one of my previous questions here. I am newbie to unix world and this site has helped a lot to understand some core concepts. In this case I am ...
2
votes
1answer
71 views

Counting number of lines I type in vim

I want to track number of lines I write everyday. I want that count to be visible on vim status line. It should look something like [# lines today | # lines since the beginning]. A log file that ...
0
votes
1answer
41 views

Disabling/enabling language specific mappings in Vim

I have :set keymap=russian-jcukenwin. In this keyboard mapping ` maps to ё. I want to unmap this backtick. :lmap ` l ` *@ё :lunmap ` E31: No such mapping Why lunmap ` gives an error? ...
2
votes
2answers
138 views

Is it possible to copy data from one screen session to another?

I recently needed to copy X amount of lines from a file, that I opened in vim and then paste them to another file opened in a different screen session (and different server). So on screen #1 I ran in ...
10
votes
5answers
528 views

VIM commenting out what I paste

I got this when trying to copy this gist on vim: https://gist.github.com/w0ng/3278077 I notice the same behaviour everywhere: If I paste something that includes a comment, everything that follows ...
1
vote
1answer
63 views

VIM map not working

I'm trying to map <c-y>, (from zencoding-vim) to <c-m>. I tried: map <C-m> <C-y>, map <C-m> <C-y>,<cr> But doesn't seems to be working. Maybe it's ...
1
vote
1answer
72 views

What is this VIM plugin?

It's a modified vim bar that includes current path and current git branch. I've been looking around but couldn't find anything. Found in: https://github.com/w0ng/vim-hybrid
3
votes
4answers
2k 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 ?
5
votes
2answers
145 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 ...
0
votes
2answers
150 views

How to fix weird vim polluting the terminal behaviour on arrow keys and on delete in insert mode?

My terminal gets polluted by B, C,A,D when I try to navigate within vim using arrow keys and on delete using backspace it only scrolls back without deleting the characters on screen while the ...
0
votes
1answer
79 views

Vimrc autosourcing not working

My vim configuration lives in $HOME/.vim/vimrc, which is symlinked to ~/.vimrc. Inside my vimrc I have: if has("autocmd") autocmd bufwritepost vimrc source $HOME/.vim/vimrc endif But is not ...
2
votes
4answers
98 views

how to invoke vim with line numbers shown

I know that from inside vim the command to display line numbers is :set number. Is it possible to invoke vim so that line numbers are shown from the beginning?
2
votes
1answer
232 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 ...
1
vote
1answer
164 views

urxvt map esc key to key sequence

This question is a spin-off of Rebinding "clear prompt" in mutt I use vim keybindings a lot and like using esc to abort commands. I've now moved to mutt but it is not possible to bind esc ...
-1
votes
1answer
99 views

How to use colors/colorschemes/fonts in vim effectively so that the text is as readable as possible

I am trying to be more productive in vim and as part of this I am trying to make the text presentation i.e. colors etc as nice to the eyesight as possible. Although I managed to change the default ...
3
votes
3answers
776 views

How do I make Vim behave like “tail -f”?

I would like to know if there is a way to make Vim behave like tail -f. Even the best Vim plugin I've found so far doesn't do what I expect. I really want to see the file update in real-time. Even ...
3
votes
1answer
1k views

vim is too slow when saving files

I run vi under Linux CentOS 5.3. Each time I exit from a file, I have to wait several seconds before vi saves the file. The same thing happens with vim. I ran this command: strace -odetails -ff -f ...
1
vote
3answers
503 views

Running external commands in vim

It seems that if I run the following inside the vim: :w !wc -w I get the word count of the file. But I don't understand the syntax. How does this work and how would I specify that I want the ...
3
votes
2answers
229 views

How can I use aliases in commands?

I have created aliases in my .bashrc for various frequently used long paths but I can not seem to be able to use them inside vim or with commands such as find or grep. E.g the following: db in cli ...
4
votes
1answer
90 views

Vim syntax highlight length-delimited fields

I'm trying to write a vim syntax file for SVN dump files. The part I can't figure out is the section like this: Fooprop: Val1 Text-content-length: 20 Barprop: Val2 ...
2
votes
1answer
166 views

How can I see moved lines in a file comparison with vimdiff / diff?

Moved lines are frequently annotated as deletes and adds but they can be shown as moved-from and moved-to instead. Like in this screenshot of Notepad++.
3
votes
2answers
109 views

Is there a way to configure vim to run external commands through cpanel jailshell?

I'm editing files in vim over ssh, and I'd like to save git commits and things by running external commands in vim, like :!git add % && git commit -m "update" but because my server (hostgator) ...
0
votes
3answers
153 views

Make VIM act as Notepad++ on mixed line endings

I've googled all around and found tons of weird solutions to ^M problem, but couldn't find one and simple: how could I just open any file, like in Notepad++ and work on it? I don't want to mess with ...
1
vote
1answer
235 views

Vim Visual Mode - is there a way to change the background color only when in visual mode?

I forgot which mode I am in using VIM so I set this up in my .vimrc so that I easily know I am in Insert mode as the background changes to Yellow :au InsertEnter * hi Normal term=reverse ...
4
votes
1answer
87 views

Customised vimrc for subfolders and projects

I use vim in many different contexts ... actually, probably most people do: There is the editing of configuration files, programming, documenting, email and so forth. I very frequently found myself ...
3
votes
2answers
151 views

Vim colorize edit mode

I'm trying to tailor vim to my needs and I would like vim to visually indicate when it is in some kind of edit mode (insert/replace) by, for example, coloring the background red. Is there any way to ...
1
vote
2answers
396 views

Can not edit .vimrc file

I have just installed spf13 plugin for vim and I want to customize .vimrc file. When ever I try to save the edits it says: ".vimrc" E166: Can't open linked file for writing syntastic: info: no ...
0
votes
1answer
51 views

cw and . does not work as expected in vim on character deletion

If I have the following non-sense text: Hi woman! What is your name? I know what you mean... Yeap. Yeap. Again :) Hi woman! What i s your name? I know what you mean... Yeap. Yeap. Again ...
2
votes
2answers
121 views

Live diff-mode editing in vim

I want a live view of diffs while I am editing a file. vimdiff is able to do something I want, like highlighting the differences between two files. However there are two drawbacks of vimdiff that ...
3
votes
1answer
284 views

Vim powerline with broken encoding

I trying to learn using vim, I am enjoining a lot, but I copied the vimrc from github and I would like to understand what is causing the break of powerline encoding. . In the vimrc file I have: set ...
2
votes
1answer
74 views

How to right or left shift a block of text by a specific number of columns?

If I use vim, put the cursor on the beginning of a line, and then input 3>> or 3<< I can left or right shift 3 lines by 8 columns If I just want to shift 4 columns, what should I ...
3
votes
1answer
56 views

Expanding functionality of case switching commands in Vim

In my current work of refactoring a fairly large codebase, I find myself wanting to replace apostrophes and quotes with each other from time to time. Up until now I've been applying s/"/'/g for ...
1
vote
1answer
68 views

incorrect/overwritten margins when using vim in GNU screen

When ssh'd into a work server via PuTTY I'm seeing strange behavior with the left margins when using GNU screen and vim. For example, I'll open up a Python script and all indentations will be gone ...
2
votes
1answer
83 views

Vim command mapping help

I'm a relatively recent convert to Vim, so I don't know a whole lot. My question is about mapping a multi-part command to a single key combo. In my .vimrc, I've got the following line: nnoremap ...