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

learn more… | top users | synonyms

5
votes
2answers
915 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 ...
0
votes
2answers
1k views

Vim freezes for a short time

When I work in vim, it happens (often) that it freezes for a second or two... after that it comes back to a normal life, executing all what I have typed when it was frozen I saw this behavior on two ...
3
votes
1answer
218 views

VIM -Change waiting time for combined key maps

In VIM, When I map for example <F9><F10> to a command and <F9> to another command , it waits for 1-2 seconds when I press F9 to allow me press <F10> to access the command ...
1
vote
1answer
654 views

Multiply certain numbers in a text -file by certain constant

I want an alternative solution to this jQuery hack, tasting a bit reinventing the wheel -- look I am sure I could do this with some one-liner using basic *ix tools. Look much easier and ...
4
votes
1answer
461 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 ...
9
votes
2answers
2k views

why inode value changes when we edit in “vi” editor?

When I edit a file in "vi" editor the inode value of the file is changing. But when edited with cat command the inode value is not changing.
13
votes
3answers
2k views

Vim interface on web browser input fields?

I am looking for a browser plugin which inputs textin of input boxes with the same keyboard interface of the Vim text editor. I have adopted Vimium which makes general navigation much more effective, ...
3
votes
1answer
2k views

Vim visual mode to system clipboard?

Using the vim text editor, I am looking for a method to copy content highlighted in visual mode to the system clipboard (i.e. I would then be able to Ctr-v that content say in a browser window). Is ...
1
vote
1answer
193 views

vimrc mapping line numbers

I have these lines in my .vimrc file: :map <F9> :exe ':!gdbset bp "%:'.line(".").'"'<CR><CR> :map <F8> :exe ':!gdbset clear bp "%:'.line(".").'"'<CR><CR> They ...
6
votes
2answers
372 views

Indent the middle of multiple lines

I often run into situations like this: title : Jekyll Bootstrap tagline: Site Tagline author : name : Name Lastname email : blah@email.test github : username twitter : username feedburner : ...
1
vote
0answers
82 views

Using VIM, how do I remap directional keys from right hand to left hand?

This is the best solution I've seen so far: " Map Right Directionals to Left Commands noremap s h noremap d k noremap f j noremap g l " Map Left Commands to Right Directionals noremap h s noremap k ...
5
votes
1answer
6k views

Replace using VIM, reuse part of the search pattern

I am working with VIm and trying to set up a search and replace command to do some replacements where I can re-use the regular expression that is part of my search string. A simple example would be a ...
5
votes
3answers
1k views

Run a vim macro from inside a bash script

In a bash script I want to edit a file. Is there a way to write a macro in vim, save it and then call it in bash script?
2
votes
1answer
577 views

Using vim/gvim as editor for Thunderbird

Is there a way to use vim/gvim as an editor for thunderbird? There was an add-on for it but it is now very out of date.
1
vote
2answers
144 views

Saving files on lost focus in Vim

I have been trying to setup the shell version of vim to save any changed files when the shell window loses focus. Following these instructions does not work. Even though I am using OS X, I figure ...
3
votes
3answers
2k views

Problem with vim when logged in as root

When I login as root or edit a file by sudo mode all of the options in my /etc/vimrc are not working (e.g. highlight line-number etc.)
2
votes
1answer
306 views

Vim - Bind a key to a bash command

In VIM, is there a way to bind a key to a shell command? For example when F3 is pressed git commit -a -m "test" should be executed.
0
votes
1answer
39 views

Make gVim use last compiled version of vim

I've compiled the latest version of vim with some options. Is there a way to make gVim use the same vim as in the console ?
2
votes
0answers
174 views

Vim - Cursorline turns on after saving a remote file

Using vim scp://.... I open a remote file. cursorline is not shown until I save the file(:w). When I type :w and enter password, cursorline appears.If I type :set nocursorline it disappears but again ...
13
votes
3answers
2k views

How different is Elvis from Vim?

I've been using Slackware for a while now, which ships with Elvis as its default editor. Most other Linux distributions seem to ship with Vim, instead of Elvis. Having gotten quite used to Elvis, ...
3
votes
6answers
760 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 ...
5
votes
2answers
721 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 ...
8
votes
3answers
2k views

How to make a symbolic link to /usr/bin/vim but with start-up parameters?

After I make&make install vim from source, I found many symbolic links of vim in /usr/local/bin, such as evim, rvim, view... The vim(1) man page said that "rvim" is equivalent to "vim -Z" and so ...
1
vote
2answers
604 views

How can I unset non standard vim options?

On a hosted system I logged in via SSH and edited a file with vim. Usually once I'm in insert mode I can just paste from my local clipboard into the ssh window and VIM accepts it fine, but for some ...
1
vote
1answer
97 views

Is “temp” a reserved system name?

I was doing homework on a remote server, and I realized that I had my header and cpp files swapped. So, I wanted to change the names. I began by renaming my header file 'temp'. Then, weird things ...
4
votes
4answers
16k views

“Swap file xxx already exists” when editing apache configuration file in vim?

Using vim I keep getting a message saying "Swap file xxx already exists" when I'm editing an apache config. However, I don't see it in the working directory on in tmp. How do I delete this?
2
votes
4answers
257 views

xsel < /tmp/xselection not working in script

I'm trying to use the following script: #!/usr/bin/env bash # Edit xselection in gvim xsel > /tmp/xselection gvim /tmp/xselection xsel < /tmp/xselection But the final line does not seem to be ...
4
votes
1answer
785 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?
6
votes
5answers
793 views

Terminal and Vim

I open a terminal then I open Vim. Then I work on my source code, but unfortunately I click on the close button of the terminal title bar and my work is lost. Is it possible to configure Vim such that ...
9
votes
5answers
4k views

What is `^M` and how do I get rid of it?

When I open the file in vim I am seeing strange ^M characters. Unfortunately, the world's favorite search engine does not do well with special characters in queries, so I'm asking here: What is ...
9
votes
5answers
3k views

vim: replace all character till end of line

Maybe I am being daft but can you replace all the characters from where the cursor is to the end of line by one command? Then use . to do the same replace on the next line and so on.
13
votes
2answers
9k views

What does the noeol indicator at the bottom of a vim edit session mean?

I open a file using vim in ubuntu, and this is displayed at the bottom of the screen. "file.py" [noeol] 553L, 16620C What does noeol indicate ?
0
votes
2answers
400 views

Storing Abbreviations in Vim

I frequently use :ab to save typing time during coding. For e.g. :ab mat matrix to replace mat by matrix every time I type mat. Is there any way of storing and loading the abbreviations I create for ...
0
votes
1answer
416 views

Remapping keys in vim's “directory view”

The "Netrw Directory Listing" you get by opening a directory in vim (e.g. :e .) seems to use a different set of keybindings than plain vim for navigation I have my hjkl keys remapped thus: noremap d ...
1
vote
1answer
102 views

VIM - how to minimize tabindent on hilighted text

Right now, my VIM editor tab indent has some unusual behaviour. When I am in insert mode and press tab, the cursor indents about 3 spaces instead of a whole tab indent. I like this. When I ...
1
vote
2answers
1k views

Script to create files in a template

I just wrote a function in my ~/.bashrc that will let me create a folder for a new website with one command. The function looks like this: function newsite() { mkcd "$*" # mkdir and cd into it ...
3
votes
2answers
862 views

Avoid reformatting bullet lists with formatoptions+=a

I am using Vim with formatoptions +=a as described in Vim: word wrap for documents to format lines automatically while I write documents, expecially Markdown documents. My problem is that Vim wants ...
5
votes
2answers
335 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 ...
11
votes
2answers
1k views

Spell check comments in vim

I'm a C/C++ professional programmer who makes lots of spelling mistakes in comments. I want to configure vim such that the spell-checker only looks for misspelled words within comments. If necessary ...
1
vote
2answers
88 views

Graphical issues in vim

Not sure if this is the best place to ask this but does anyone know why I'm seeing those purple-ish bars in my vim? My vimrc http://dpaste.com/698999/ Also, I'm using Lion OSX
2
votes
1answer
127 views

Scroll % in Vim cmd line?

I apologize for the n00bish question, however it's one of those where the key terms are too generic to find an answer very easily. Basically on all my Linux installations, opening any file in Vim ...
10
votes
3answers
7k views

How to move to last character of the file in vim?

File: i am someone1. i am someone2. i am someone3 ~ ~ Documentation says G takes me end of the file, but it only takes me to the beginning of last line. I want to be able to come to last character ...
6
votes
1answer
810 views

gvim -p limit of opened tabs?

When I run : gvim -p *.xyz I find that not all files are opened in tabs. It feels, like a kind of tab limit? But ! When I try to open unopened with : :tabnew it is opened next to previous ...
15
votes
2answers
6k views

What is the difference between vi and vim?

As far as I know vi is more commonly found on out-of-the-box unix systems while vim often has to be installed. Also vim stands for vi improved, but improved how? What are the main differences?
18
votes
7answers
4k views

Advantages of using set -o vi

I have seen many developers using this command to set the option to vi. I never understood the real use of this? When using bash commands, what help does switching to vi provide?
2
votes
1answer
534 views

How to add additional Gnome-Shell and Unity workspace navigation shortcuts

I am very familiar with (and love) the workspace switching in Gnome-Shell and Unity (using Ctrl+Alt+[Up/Down/Right/Left]), but being a vim fan, it would also be great if I could add an additional ...
5
votes
3answers
2k 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; ...
2
votes
1answer
72 views

!fmt for current line only

When I want to format part of text with fmt in vim I usually select parts of interesting lines in Visual Mode, with: Ctrl+V Arrows, and than type !+f+m+t. When there are couple of lines they are ...
4
votes
3answers
163 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 ...
15
votes
4answers
5k views

How to get vim to work with tmux properly?

I'm trying to figure out how to get vim and tmux play together. My problem is: When I use xterm-256color I get vim to work nicely, but the background doesn't render properly. I fixed this by using ...