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

learn more… | top users | synonyms

10
votes
4answers
1k views

How can I paste (overwriting) with vim?

In vim I use yy and p all the time to yank and paste lines. However, if I want to replace one line multiple places in the file, I can't use yy p dd p because the dd deletes the line to the clipboard ...
2
votes
2answers
271 views

Tab spacing in VIM

I want to change tab key spacing to 4 spaces in VIM editor on CVS server. I know the :set tabstop=4 command is used for that but it does not have a permanent effect. After restarting VIM it changes ...
2
votes
1answer
230 views

Vim: mouse support lost after using netrw in xterm

Every time I access the filesystem using: :tabe dirname (e.g.: :tabe .) :vsp dirname :sp dirname in order to open some file while editing another one, I lose the mouse support inside the Vim ...
4
votes
3answers
848 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
2answers
303 views

vim horizontal line count

Using set number you can turn on vertical line count. Is there also a command to turn on horizontal line count? I hate talking my hands away from typing and would like to be able to quickly address ...
5
votes
2answers
262 views

Provide user name when using vim with scp

I was reading about SSH here http://blogs.perl.org/users/smylers/2011/08/ssh-productivity-tips.html and found that you can use vim to directly modify a file on a remote server that you can ssh into. ...
5
votes
2answers
3k views

Why can't vim find syntax.vim on my fresh Ubuntu installation?

I'm trying to make some basic customizations to vim. All I want is some syntax highlighting, etc. Basically, not just plain text. My .vimrc file consists of 7 lines: backspace=2 syntax on filetype ...
2
votes
2answers
1k views

sv_SE.UTF-8 Problems with Bash and VIM in iTerm2

Two specific issues, despite me running iconv -f iso-8859-15 on my old files when converting from sv_SE.iso8859-15 to sv_SE.utf-8 I still get distorted characters. And I believe it's because of Vim ...
2
votes
1answer
626 views

Vim shared copy register

When working with Vim I often work from multiple monitors and multiple split terminals so I have multiple instances of VIM running at all time. Is there a way to have a persistent shared register that ...
4
votes
1answer
121 views

How to write any Unicode Key without Pre-programmed key for it in kbd?

I am trying to find some Unix tool to input any Unicode key. I am fine with X application or console but I use Vi/m and it may have this property. For example, suppose I want to input key "U+0303" or ...
4
votes
1answer
218 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?
3
votes
2answers
188 views

Open up many files in panes at once

When I need to edit multiple files, it's really a pain to have to open them one by one. Is there a way to open multiple files in VIM from the commandline?
2
votes
2answers
719 views

How to Display Hidden Characters While Typing?

How can I configure vim to display hidden characters like tabs or spaces ONLY while those characters are typed? I do not want tabs and/or space replaced with special characters like ">" or "_" when ...
2
votes
1answer
60 views

How to Re-Create Missing Vim Directory?

The /etc/vim directory and the symlinks from /usr/share/vim to it are missing. Does anyone know how to re-create the directory and links?
3
votes
2answers
1k views

(G)VIM uses a different $PATH than my system

Because Ubuntu provides no up-to-date packages for TeXLive, I installed it manually. However, some programs need TeXLive as dependency. So what I did is I installed the TeXLive package from the Ubuntu ...
4
votes
2answers
1k views

How to install light-weight vim and to be able to efficiently load files into one instance vim?

On my laptop with Ubuntu I'm able to have just one instance of vim, launched with vim --servername VIM After this I'm able to open files from console with vim --remote-silent filename I use ...
1
vote
2answers
74 views

VIM: Create a function to generate several lines of buffer

I have about ninety configuration files that I need to add an almost identical block of additional code to, with only two instances of a single word differing each time. I would very much like to ...
3
votes
5answers
1k views

vi - how to join differents specific lines

I'm looking for a solution about a "paste" problem on vi/vim . How to join specific lines in a text file? I have a file like this: 15/10/2011 Revolution day 16/10/2011 About Rome - differents ...
5
votes
3answers
258 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,}/
21
votes
2answers
15k views

How can I set VIM's default encoding to UTF-8?

I'd like to contribute to an open source project providing translated strings. One of their requirements is that contributors must use UTF-8 as the encoding for the PO files. I'm using VIM 7.3 on ...
9
votes
1answer
798 views

Why am I getting 'Name collision between …' errors and how can I fix them?

Every time I try to launch vim or emacs or even top (I think it's actually any command that uses ncurses) in a unix terminal (on a cluster computer over ssh), I get a a continuous stream of 'Name ...
2
votes
1answer
252 views

How to open a file in the last closed position in VI

I want to open a file which is closed in line xxx. So I can easily continue editing
7
votes
1answer
5k views

Switch VI to use backspace key instead of Control+H for backspace?

I'm on Solaris 10 and by default vi version SVR4.0, Solaris 2.5.0 is installed. The system was set up so that when I ssh to it Control+H does backspace, and backspace outputs ^? I added stty erase ...
4
votes
1answer
396 views

How to run gVim in a single instance

I want it in such a way that on double clicking an already opened file, or a new file, gVim uses the same window. From this question asked previously on Stackoverflow I figured out how to do this by ...
11
votes
3answers
3k views

ESC key causes a small delay in terminal due to its Alt+ behavior

My terminal setup is gnome-terminal + tmux + zsh with vi bindings. In applications like vim or even in the zsh's command line vi editing mode, I need to frequently hit the ESC key but there is a ...
3
votes
5answers
3k views

How can I check what version of the VI editor I have?

How can I check what version of the vi editor I have? What's the best way to upgrade it or install vim on Solaris?
2
votes
1answer
1k views

Install Gvim after vim

I would like to run vim via X11 (over SSH). Vim comes pre-installed on my NAS (running Debian), however the GUI is not. When I run vim -g, I get this error: E25: GUI cannot be used: Not enabled at ...
6
votes
4answers
909 views

Block editing *live* in Emacs or Vim

jEdit supports block editing, but Emacs and Vim seem to have some serious usability issues on the same subject. If someone could fill in the unknowns here it would be much more bearable to use either ...
6
votes
2answers
214 views

How to write a column of consecutive integers in Vim over existing text?

For example, imagine I had the following text: / apple / orange / banana / bread How could I efficiently add consecutive integers in a column to make? /1 apple /2 orange /3 banana /4 bread Note ...
4
votes
1answer
156 views

How to preserve special characters highlighting when converting to HTML?

I have an issue with the :TOhtml command. It works great, but it doesn't preserve the list option. If I do: :set list listchars=tab:>-,trail:.,extends:> :TOhtml The special characters ...
3
votes
2answers
383 views

Move to next capital letter

Is there an easy way to move to the next capital letter with vim? I'm often working with camel-cased variables and it could be useful.
4
votes
1answer
129 views

creating vim plugins

I would like to attempt my first VIM plugin and wondered where there are some good docs on this? From going threw the plugins I use it seems to me that it is a mix of BASH and some sorts of VIM api is ...
6
votes
2answers
325 views

vim - don't highlight search term after a search & replace?

After performing a search and replace, my installation of GVIM highlights any text remaining that still matches the search pattern. Example input text: foo foo fighters I run :%s/foo/bar/gc and ...
5
votes
1answer
115 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 ...
1
vote
1answer
38 views

Vim remembering settings of edited files

I read some where about creating files in vim to save things like open windows and folds. I tried to Google it but had trouble finding reference to it. What should I be looking for?
1
vote
5answers
874 views

Display output to console while grep is used

In vim I use the following command to compile a tex file: pdflatex\ \-file\-line\-error\ \-shell\-escape\ \-interaction=nonstopmode\ $*\\\|\ grep\ \-P\ ':\\d{1,5}:\ ' this works in terms of getting ...
1
vote
2answers
1k views

Filetype not detected

I'm using vim to try a template system named handlebars, and I installed a vim plugin to get some syntax-highlighting for *.handlebars. I can get coloration if I do this : :set filetype=handlebars, ...
8
votes
2answers
186 views

VIM: show all lines edited in session

Is there a command or plugin that I can use to show all the lines I have edited in a Vim session? I would like to be able to have all the changes I have made highlighted when working in co-workers ...
3
votes
3answers
473 views

Vim multiple windows / hide

If I had x or more windows open in a VIM session and I wanted to quickly hide all but the active one for a moment then return the windows to the layout I had them int how would I do it?
3
votes
3answers
190 views

What does . match?

In working with regular expressions, I have been told that a dot character . will match everything. Except for newlines \n. Are there any other exceptions? What about the NUL character \0, or the ...
7
votes
1answer
2k views

Jump to specific character in a line in VI

In VI, I know that if you do :some_number and hit enter, you will jump to the line specified by "some_number". Is there an equivalent for jumping to a specific character in a single line? ...
7
votes
1answer
430 views

Note-taking and outlining using Vi: On startup, highlight tags and display tags in a preview window [duplicate]

I am using vi as a note-taking and outlining tool and therefore I thought that this stackexchange site would be appropriate to ask this question. I am constructing the "tags" file by myself. What I ...
3
votes
1answer
298 views

Vi: On startup, highlight tags and display tags in a preview window

I am using vi as a note-taking and outlining tool. I am constructing the "tags" file by myself. What I would like to do is that when I open my notes or outline file, vi reads the tags present in this ...
3
votes
2answers
328 views

Issues with Vim while using ZSH

I just changed my shell to ZSH. However, when I tried to edit a .py file in vim I got a strange error: "test.py" [New File] Error detected while processing ...
3
votes
1answer
403 views

Select between given characters in vim

Given three sample lines: some('lorem _ ipsum'); $some['lorem _ ipsum']; <span class="some _ class"> (cursor is in _ position) Which is the fastest way to select (for pasting in other ...
2
votes
2answers
201 views

What does :p[rint] do in vim?

The help text is a little vague as to what this command achieves. Print [range] lines (default current line). Note: If you are looking for a way to print your ...
4
votes
2answers
2k views

Make sed ask for confirmation before each replacement?

Is there a way to make sed ask me for confirmation before each replace? Something similar to 'c' when using replace inside vim. Does sed do this at all?
2
votes
1answer
105 views

Getting vim to be silent when using -s {scriptin}

The vim man page describes -s {scriptin} option which allows for automation of file edits. This works fine, but I'd like for vim not to grab the console in this case (and flash the file with edits), ...
6
votes
4answers
4k views

Auto indent / format code for vim?

I'm trying to use vim more and more when i can. One of my biggest grip between vim and an IDE like aptana is the ability to auto indent. Is there a means of auto formatting code (html, css, php) so ...
7
votes
1answer
2k views

Setting vim filetype with modeline not working as expected

As per the accepted answer to this question, I'm attempting to use modelines in vim to force filetype detection in some files. For example, at the top of a file named gitconfig (note there is no ...