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

learn more… | top users | synonyms

1
vote
4answers
115 views

Symlink everywhere

Is there any way for me to symlink a particular file so that it appears in every directory on the system? So if I symlink /tmp/scratch No matter where I am I can type vi scratch?
26
votes
9answers
1k views

How to find out which file is currently opened in vim?

This may sound trivial but, on more than one occasion, I have found myself having forgotten which file in vim I have open (e.g. when I am looking through different log files and such) and the only way ...
4
votes
1answer
200 views

vim stops sending text to * (X11) register?

I recently started using VcXsrv with the hope of being able to grab text from vim (console mode) to the Windows clipboard via X11 forwarding (and the * register). It works...to an extent. As soon as I ...
3
votes
1answer
64 views

show part of wraped lines in vim instead of hiding it with the @ character

I use vim not only for coding but also for text writing. In this context I use the wrap and linebreak options to wrap my text. Since lines - forming paragraphs in text writing - can be very long a ...
1
vote
1answer
121 views

Vim paste string with non-ASCII characters

I am trying to paste a string from a register in VIM which contains non-ASCII characters such as Ctrlr, how can I paste this string into a file, but escape the non-ASCII characters automatically? ...
4
votes
2answers
219 views

Difference in behavior of `<Esc>` and `inoremap jk <Esc>` in vim

I just installed Ubuntu 12.04 on a new computer and apt-get install[ed] vim and I'm having some weird behavior with my aliased Esc - if I'm in INSERT mode and I type the Esc key, I exit INSERT mode ...
2
votes
2answers
300 views

Is there a way to count the number of matches in Vim using :g?

I know this works: :%s/<string>//gn But it seems a bit strange to use the substitution command to count, rather than global..
1
vote
2answers
82 views

How can I go forward in a file? What is the oposite of ctrl+O

If I jump to a file e.g. by gf I know that I can do ctrl+O to go back. But how do I go forward? I.e. what is the opposite of ctrl+O so as to go forward to the file I was earlier to which I jumbed to ...
3
votes
1answer
120 views

vim - Store a backup before each write

I want to create a backup of the file I'm editing before each write. For example, if I am editing some file.txt, when I go to write the file with :w, I want vim to first save a backup of file.txt ...
3
votes
2answers
345 views

vim: Execute BundleInstall without showing the vim interface

I have a installation script that I use to initalize my vim plugins when I'm on a new machine #!/bin/bash # Clone vundle into the directory if it's not already if [[ ! -e bundle/vundle/.git ]] then ...
2
votes
1answer
1k views

vi creating a swap files before create a new file

This is a strange problem. the swap file get created for the new files. so, my directory is empty there is no file exist and then when I vi test.txt I get the swap file message. It looks like the vi ...
6
votes
2answers
437 views

Is there a method for making Google Chrome open textareas in vim?

I used to use Firefox on a daily basis but have switched to Google Chrome, and have been using it for 2+ years now. The one plugin that I miss is this one, It's All Text!. This plugin allowed for the ...
0
votes
0answers
102 views

How can I enable mouse in Vim?

How can I use mouse with panes in vim? I tried :set mouse=a but it does not seem to work when doing :sp or :vsp or vim -O
0
votes
1answer
34 views

Adjust pane size in vim

I know I can use :sp or :vsp to open files in vim in splitted panes. But how can I increase/decrease the size of each pane?
1
vote
1answer
179 views

vim syntax region: How to use strings as start / end patterns?

I want something like this in one of my syntax files: let s:mask1="some chars here" let s:mask2="and some chars here" syntax region MyOwnRegionName start=s:mask1 end=s:mask2 (the idea is to use ...
3
votes
1answer
106 views

Changing gVim behaviour on Red Hat

I recently had to change my Linux work environment from a personal Ubuntu system (having full admin rights) to a corporate Red Hat system (having very limited control on the system). Both running ...
5
votes
2answers
153 views

Make vimdiff display different lines as different lines (not partially different)

vimdiff has an annoying habit of displaying two almost-completely-different lines as the same partially-different line just because they share a character in common at the beginning or end. For ...
0
votes
2answers
93 views

Map a shell command to execute it into vim

I want to map, in my ~/vimrc file, the key <F4> in vim in order to execute the indent program on the file which I'm currently editing. How can I do it? If I do this,the compatibility with vi ...
11
votes
4answers
631 views

How am I supposed to edit files on a network with Vim?

Currently I'm doing it by SSHing into a server, and executing Vim on the server. This has the benefit of not having to deal with cumbersome syntax of opening files from a remote server over SCP, and, ...
2
votes
1answer
421 views

How to Replace Path in Search field using VIM

I'm trying to replace this text in VIM Actual Path /home/omipenguin/Servers\ Information/systemscript.sh/sysinfo.txt with this new path /home/sysinfo I tried %s/\/home\/omipenguin\/Servers\ ...
1
vote
1answer
56 views

Rewriting lines from the ending

I want to read a file and write its lines from the ending (which means that I want to replace the first line with the last line, the second line with the penultimate line and so on) just by using VIM ...
5
votes
1answer
321 views

Idle terminal safe character

I'm using iTerm2 on a Mac to do Linux work. In order to avoid losing terminal connections, I turned on "When idle, sent Ascii code". The default is 0. This works like a charm to keep connections ...
5
votes
2answers
819 views

Lowercase all but the first (Uppercase) letter from UPPERCASE in cyrillic

To make all letters a lower case except the first letter. The first letter would look like "Uppercase" after I changed (from UPPERCASE in cyrillic). The rest (not UPPERCASED) leave unchanged. I'm ...
2
votes
2answers
293 views

Setting programming font in RHEL 5 + gvim

I am working on RedHat RHEL5. I want to change the font in GVIM. The only font format that my GVIM accepts is *-courier-medium-r-normal-*-*-140-*-*-m-*-* It refuses to use Courier\ New or ...
2
votes
1answer
305 views

How can I set check interval for set autoread option in VIM

How can I set check interval for set autoread option in VIM? Is it possible?
1
vote
1answer
64 views

Vim key binding to cycle through windows

How do I bind one single key to cycle through the windows? For example, each time I want to switch a window, I have to click ctrl-a (default was ctrl-c) then use arrow key up/down/left/right to ...
4
votes
2answers
114 views

How can I use caps lock to change language in VIM

Can I use capslock for changing languages in VIM instead of Ctrl + 6 in case of "keymap=russian-jcukenwin"? How can I do it? Maybe something like mapping it in the $VIMRC file? How can I map ...
1
vote
1answer
2k views

How can I select all copy from vim and paste to other program e.g. mail client?

How can I do the following? Copy all text from vim and paste it to an external program e.g. mail Outlook? I tried +y and gg*yG but the paste does not work.
1
vote
1answer
57 views

vim flag to append a line and save

I'm trying to mock an editor as part of writing feature tests for a CLI that I'm working on. I need to mock an editor which is opened and quit directly without saving, as well as an editor which ...
49
votes
6answers
8k views

Exit vim more quickly

I use Vim mainly for quick edits rather than long work sessions. In that sense, I find the keyboard sequence for quitting especially laborious: Esc, Shift + ;, w, q, Enter. How to quit Vim (possibly ...
1
vote
2answers
2k views

gvim on RHEL (Red Hat Enterprise Linux) install in home directory

How to install gvim on a RHEL server that doesn't have it (for use with SSH with X11 forwarding*)? No sudo access is available, so it has to be in the user's home directory. *Getting all the ...
0
votes
2answers
524 views

(g)vim - NerdTree and tagbar above each other left to edited file?

Any chance to get (g)vim displaying NerdTree and tagbar above each other left to edited file? +-----------+-------------+ | nerd tree | edited file | | contents | | +-----------+ ...
1
vote
1answer
82 views

Can vim warn on a tabpagemax overflow?

If I open a collection of files in vim tabs using a glob pattern, I'd like to be warned if the number of files matching the pattern exceeds the value of tabpagemax. For example, if the following, $ ...
5
votes
2answers
1k views

Carriage return vs newline in vim

In vim, when I opened a file, I wanted to add two empty lines at the end of each current line. I used the following switch: %s/$/\n\n/ Apparently, this does not work, but what does work is: ...
4
votes
2answers
392 views

VIM substitute occurrences of pattern after a particular word in a line

I have such lines in my text. text before pattern = garbage** text after pattern is pattern If in VIM I do %s/pattern/saturn/ it replaces all occurrences of pattern. But I only want to replace ...
6
votes
4answers
3k views

less command and syntax highlighting

I need to use the less command with the syntax highlighting of the vim command for python, C, bash and other languages. How do I apply syntax highlighting colors according to vim colors for less ...
4
votes
2answers
492 views

Sudoedit Vim force write (update) without quit

I'm doing some scripting with Vim and I've just started using sudoedit. Problem is, when I :w it writes to the temp file, so any testing of the script can't happen unless I quit the editor. How can ...
1
vote
1answer
424 views

Managing multiple Vims (vim and MacVim)

My machine came with Vim 7.3 and I just installed MacVim 7.4, so now I'm juggling both and I'm not sure how to manage the two. I'm plagued by questions like: Should I remove the older version? Where ...
4
votes
4answers
2k views

vim search numbers containing specific number of digits

I need to find specific length numbers in a big document. I tried to use regex for this. For example, If I need to search for numbers with exactly 2 digits, I use /d/d (i.e. /d twice followed by a ...
3
votes
1answer
790 views

How to insert both vimscript variable and string into vim search and replace

I've only just found out about Vimscript's existence as of today, so forgive me if this question is more basic than it seems, but I've been struggling to find an answer to this question for the better ...
1
vote
2answers
596 views

Vim: searching upward/downward in file from specific point/position

I want to search a word from my current cursor position in vim to upward in file. How to achieve this? Also how to do same for downward in file.
2
votes
2answers
113 views

Vim autocomplete to include punctuation between words

I'm currently programming in Tcl/Tk. I have some widgets called .entry,stdin and .entry,stdout and I'm using supertab for autocompletion. The comma is there because I'm using a package called gridplus ...
3
votes
2answers
145 views

Vim alerts after a few seconds when no event occurred

I use Vim in a tmux session, and recently I've noticed that Vim is raising an alert after a few seconds when I switch to another tmux window. Nothing has happened in Vim after I move windows - usually ...
19
votes
5answers
8k views

vim - better colors so comments aren't dark blue?

Mostly I edit ruby files, although shell script file comments are also # Currently my comments show as dark blue on black which is really hard to read. See screenshot. How can I change their color? ...
5
votes
3answers
1k views

vim - how can i do a 'change word' using the current paste buffer

I have some text in my paste buffer, e.g. I did a yw (yank word) and now I have 'foo' in my buffer. I now go to the word 'bar' and I want to replace it with my paste buffer. To replace the text ...
3
votes
1answer
92 views

Make vim open files as nomodifiable, under certain conditions

How can I make open files as readonly and nomodifiable, if they're in a certain folder hierarchy, but do NOT contain a certain extension? For example, if I open files on /server/(production|uat)/* I ...
2
votes
1answer
224 views

Use of ! in VIM

I have seen that sometimes :q works but sometimes we have to use :q!. This is the case for many commands. I was wondering what is the general use of ! in vim and when to use it. I tried to google ...
1
vote
4answers
55 views

Exracting fields in file and storing it in different file in vim

I have file int the following format: . . . Name:abc Occupation:def . . Name:xyz Occupation:ghi . . I want to extract the name and occupation field and save it in another file out.txt ...
2
votes
0answers
118 views

Tmux is not able to distinguish between insert and shift-insert

Insert when in xterm, gives ^[[2~ and, Shift+Insert gives ^[[2;1~ All this is good until I start tmux. Note that the $TERM variable remains the same, so this issue should not be related to ...
0
votes
1answer
50 views

is there a vim shortcut or can I create one for 'tabe other_file'

When possible I create 1 or 2 letter abbreviations for aliases and the like, e.g. x for exit or p for pwd at the command line. When using vim and doing multiple tabs for different files (which I can ...