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

learn more… | top users | synonyms

4
votes
1answer
162 views

How to automatically refresh Vim on buffer/window focus?

I often use Control+L to redraw the screen in Vim. In particular, when I come out of sleep or change monitor configurations I often find that Vim needs to be redrawn. I thought it might be simpler to ...
4
votes
2answers
174 views

Modeless vs modal editors

I just started learning Linux and all my previous experience of programming has been using the Windows platform. I came across Vim editor and read that it is modal editor unlike notepad which is ...
4
votes
1answer
143 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 ...
4
votes
2answers
162 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 ...
4
votes
3answers
164 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,}/
4
votes
2answers
1k views

Using vim to view the contents of a directory file

As I understand, in Linux directories are mostly normal files w/ some special handling (e.g. 'rm' a file is ok; 'rm' a dir will complain w/o -r). When I execute the following bash commands: mkdir ...
4
votes
2answers
170 views

Indenting multiple files

I want to indent multiple files which are poorly indented and indent them properly as would vim do when I type gg=G. Is there someway to enter the = command or its alias in the command mode? i.e ...
4
votes
1answer
262 views

Why is Vim eating up Ctrl when used with Ctrl+v and how to fix it?

I'm using Vim /etc/zsh/zshrc to add key bindings for zsh because it doesn't work with inputrc. In my terminal with tmux when I type Ctrl+v then Ctrl+LeftArrow the shell will show ^[OD. However, when ...
4
votes
1answer
886 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 ...
4
votes
1answer
24 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 ...
4
votes
1answer
137 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 ...
4
votes
1answer
230 views

Only one file name allowed error

Sometimes I forget to do sudo vim and open files to which I don't have write permission. I saw this post and it was really helpful. When I did :w !sudo tee % it asked me for a password and then the ...
4
votes
2answers
272 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 ...
4
votes
2answers
372 views

Can I make Tmux tell Vim when its pane loses focus?

I use Vim and Bash side-by-side in Tmux. I have Vim configured to autosave files as I switch between them, but I'd really like it to autosave when I switch to the Bash pane. Is there a way to get ...
4
votes
4answers
132 views

Vim: copy, then paste more than once

I use the highlight mode in vim to copy a few characters. I then want to paste more than once. My current technique does not work well. Sample text: Linux Solaris Irix HP-UX Suppose I want to copy ...
4
votes
1answer
207 views

Repeat the nth last command in vim

I've noticed vim can be pretty intuitive, but I'm having trouble finding a way to repeat the second-to-last command (or third-to-last, fourth-to-last, etc.). By typing . in normal mode it will repeat ...
4
votes
1answer
98 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
97 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 ...
4
votes
1answer
210 views

How to add a feature to Vim if it's not compiled with that feature?

I am trying to use clewn (full gdb support in the vim editor), but the vim I have on my box doesn't have the netbeans_intg feature enabled. Is it possible to enable it without recompiling vim? I am ...
4
votes
1answer
200 views

Match word containing characters beyond a-zA-Z

To match a word one can use \v(\w+) From the vim help :h \w: \w word character: [0-9A-Za-z_] This works exactly as described in the manual. However, I want to match words that contain ...
4
votes
1answer
429 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 ...
4
votes
1answer
247 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 ...
4
votes
1answer
176 views

Configure vim's :make to switch or open tabs on error

When I run :make from vim and there's an error, it opens that file on the error line number in the current buffer. If possible, I would prefer it switch tabs to the file if it's already open, or make ...
4
votes
2answers
226 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 ...
4
votes
2answers
605 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 ...
4
votes
1answer
122 views

Rewrite a Vim function to a one-line map

This works: nmap <silent> <S-t> :call InventTab()<CR> function InventTab() set expandtab! if &expandtab retab echo 'spaces' else retab! ...
4
votes
2answers
687 views

Fixing CTRL-* in vim under GNU screen

When running vim under GNU screen, I'm finding that combinations of CTRL with the arrow and Pg* keys don't work as expected. I'm using the Ubuntu 10.10 vim-gnome package. On a different machine, ...
4
votes
1answer
403 views

viewing info documentation with vim

I'm trying to use the ManPageView addon to view info documentation within vim. Although I find ManPageView very useful for, well, viewing manpages, its info-reading functionality doesn't seem to work ...
4
votes
4answers
246 views

Export terminal display to PDF

I want to include the display of my terminal in a beamer presentation. Simply taking a screenshot, however, produces a fairly low-resolution png that looks poor in the presentation. I would like it ...
4
votes
2answers
87 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 ...
4
votes
1answer
107 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 ...
4
votes
1answer
444 views

How can I search for and highlight multiple strings in VIM?

In VIM, how can I search for multiple strings and have a different color highlight for each match?
4
votes
2answers
811 views

Vim NERDTree re-size vsplit

I am using the NERDTree plugin for Vim. When using the s: open vsplit command, is it possible to resize the windows so that the file takes up a larger portion of the screen than the directory tree?
4
votes
1answer
109 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.
4
votes
1answer
132 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 ...
4
votes
1answer
634 views

GNU Screen makes Vim ESC key slow

Screen makes my ESC key wait for more commands I beleive, and if it does not get those commands, it sends it to my terminal Session (which I am running VIM in). ESC is used alot in VIM and currently ...
4
votes
1answer
244 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 ...
4
votes
1answer
174 views

How can I make VIM a full fledged IDE [closed]

How could I make VIM a full fledged IDE by using different supported plugins for YUI, JQuery and git integration etc.
3
votes
6answers
408 views

Add consecutive numbers succintly and elegantly to index lines

I usually do this $ wc questions 33 36 3105 questions $ seq 1 33 > nums $ paste nums questions 1 Content 2 ... . . 33 End Content but I feel there could be faster way to do ...
3
votes
3answers
303 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?
3
votes
5answers
2k views

vi command for adding blank line?

In vi, I can use o or O to add a blank line and go into insertion mode. But what if I want to stay in command mode, is there a command for this? In googling, I'm seeing suggestions to add stuff to my ...
3
votes
2answers
534 views

In Vim, how can I delete all text from the current cursor position until the next space?

In Vim, I know 'd$', that deletes everything to the end of line. But how can I delete all text from the current cursor position until the next space? dw doesn't work, since it treats symbols like ...
3
votes
2answers
801 views

vim - but with scrolling, clickable text, and copy-paste

I like vim. I think touching mice is dirty. But sometimes when my hand is already on a mouse, it sure would be nice to be able to scroll the text or click a location in the text and have the cursor ...
3
votes
2answers
151 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: ...
3
votes
2answers
254 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.
3
votes
2answers
163 views

Why does the substitution of newlines using g/re/p only apply to every other line in Vim?

Consider: foo bar .... bar baz Then: :g/bar/s/\n/\r\r/g unexpectedly returns: foo bar bar bar bar bar ... baz when I want newlines after every bar. Yet: :g/bar/p returns: bar bar ... ...
3
votes
2answers
550 views

How to do a text replacement in a big folder hierarchy?

I want to search and replace some text in a large set of files excluding some instances. For each line, I want a prompt asking me if I need to replace that line or not. Something similar to vim's ...
3
votes
1answer
156 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 ...
3
votes
3answers
324 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
2answers
2k 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 ...

1 2 3 4 5 10