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

learn more… | top users | synonyms

1
vote
0answers
16 views

Fetch patches from mailing list with mutt and vim

How can I fetch patches from a subscribed development mailinglist with mutt and vim so that they can be applied with "git am" or "git apply" command easily? Is it either possible to save it ...
0
votes
0answers
11 views

Plugin to fix vim's key bindings in terminal

Is there somewhere a plugin for vim which fixes all (most of) the keys issues related with using vim in terminal?
1
vote
3answers
242 views

Alt mappings for vim in urxvt

My mappings which contain Alt aren't working in vim when using in urxvt. They work fine in gvim. An example of such mapping map <silent> <A-h> <C-w>< In insert mode when I type ...
30
votes
3answers
3k views

Why does Vim indent pasted code incorrectly?

In Vim, if I paste this script: #!/bin/sh VAR=1 while ((VAR < 10)) do echo "VAR1 is now $VAR" ((VAR = VAR +2)) done echo "finish" I get these strange results: ...
2
votes
1answer
23 views

Using 256 colour themes not working in vim/putty

PuTTY shows the the correct xterm-256color. Colours section shows "Allow Terminal to specify ANSI colours" and "Allow terminal to use xterm-256-colour mode". Yet when I use themes, they don't work, ...
3
votes
1answer
35 views

What is the difference between .exrc and .vimrc?

I know from experience that the ~/.exrc file can be used to configure vim. I also know that the ~/.vimrc file can be used for the same purpose. However, If I use .exrc to configure vim, this leads ...
1
vote
1answer
34 views

Installing VIM with Python support locally without sudo

I'm trying to install VIM with Python support on Linux without sudo, but for some reason VIM always gets installed without python ( -python in vim --version ) I first installed Python locally by ...
3
votes
2answers
191 views

Why do I receive a “/bin/bash cannot find command” error for an alias?

I am using multiple python, I alias python3 to py: alias py="/opt/python3.4/bin/python3" I want to run python in vim so I write this: map <F9> :call SpecialCompileRun()<CR> func! ...
1
vote
2answers
40 views

Is there a way to edit a password-protected file without having to retype the password all the time?

I want to encrypt a text file using a password and a way to safely edit that file. The problem I am having is that I haven't managed to find a simple way to do that while only requiring the password ...
1
vote
1answer
32 views

my Vimrc disabled the copy/paste action using mouse right click

Am using an open source .vimrc file from https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim, but it is screwing up my default mouse right click copy paste actions. Whenever I do a right click, ...
2
votes
1answer
17 views

Vim and unified diffs

In my daily work, I only deal with unified diffs, so I would like to define the alias alias diff='diff -puN' in my .zshrc. This alias is not respected when I use the shell from the vim command ...
18
votes
1answer
285 views

Why does exporting vim as EDITOR in zsh disable keyboard shortcuts?

My .zshrc looks like this: export EDITOR="/usr/bin/vim" Now when I open a terminal and enter a keyboard shortcut like ctrla to go to the beginning of the line, it doesn't work. Instead, the string ...
3
votes
1answer
30 views

How can I uniquely identify different GVim instances?

With gnome-terminal, I can use the --role command line argument to make the new terminal window uniquely identifiable by the window manager or other applications, for example: gnome-terminal ...
1
vote
1answer
38 views

Background color mismatch in vim and tmux

I'm having trouble getting the full range of colors to work in vim when I'm running through tmux. I belive that it's some sort of trouble with TERM variables or 256colors, but I've done everything I ...
0
votes
1answer
27 views

Why whitespace isn't include in vim backreference wrapped content?

I got some code with the format looks like: print 'hi' # sample comment. And I used :%s/^\([^#]*\)\(#.*\)/\2\r \1/gc to change their format in vim. By the command above, I got the result ...
3
votes
3answers
97 views

What is the correct way to access a specific help file in Vim?

In Vim, if you type :help into the status bar, you get a window with this (contents truncated to the relevant bits): *help.txt* For Vim version 7.4. Last change: 2012 Dec 06 ...
2
votes
1answer
59 views

What is the difference between vim and vim-lite?

I want to install vim on my FreeBSD machine, and this other site suggests installing from FreeBSD ports like this: # cd /usr/ports/editors/vim-lite/ # make install clean This is all great, and I ...
0
votes
1answer
19 views

Where to set Vim colouring when logged into a remote machine

I do most of my development on a desktop, using Eclipse, but occasionally I have to log into the production machine to look at or edit files. Usually I use vi - which is an alias to Vim 7.2. The ...
2
votes
1answer
19 views

How to search a line contains N target characters/patterns in vim?

Today I need to search if which lines contains 4 single-quote '. But g/'\{4,4\} can only catch four continuous single-quote. So I make my code into something like ...
5
votes
1answer
48 views

Share a buffer between tmux / vim splits

+-------------+ | | | 1 | | | |=============| | | | 2 | | | +-------------+ Each tmux split has vim open. I would like to do ...
0
votes
3answers
42 views

modify file using awk or sed

I have a text file contains ldap data in the give below format, our default structure says every user must have its own respective "home directory" but in given below i found many users have the same ...
0
votes
2answers
35 views

How to copy text from vim to clipboard?

I'm trying to copy text from vim into my clipboard. I'm aware that this only works in certain circumstances, but I was able to do so twice so far, so it must be an issue with my method. Unfortunately, ...
6
votes
1answer
27 views

Copy to both X11 clipboards from vim

As far as I can see, with VIM I can choose between set clipboard=unnamed - yank to X11's primary selection buffer (middle-mouse button paste) and set clipboard=unnamedplus - yank to to X11's ...
1
vote
3answers
54 views

Join Lines using Vim Editor

I have a very long text file with the data repeated like this 510068893 510069716 620087756 ...
0
votes
1answer
36 views

Vim: Count all occurrences (including multiple on the same line) of char or word

I try to count all occurrences of a char or word in a file with Vim. This means multiple occurrences of the same word in the same line should be taken into account as well. This has been discussed in ...
0
votes
2answers
33 views

Vim: Substitute based on another match in the line

I have rather large files in which I need to substitute NX for N1 but only if the line already contains NX as a pattern. So far I do it manually by first searching for occurrences of NX with: /NX ...
0
votes
0answers
16 views

Glitch with auto chmod line in .vimrc

I found a useful line for my .vimrc file from here that makes any file beginning with #! on line 1 executable when I save it. Here's the line: au BufWritePost * if getline(1) =~ "^#!" | silent !chmod ...
0
votes
1answer
27 views

VIM switching between split buffers

i tried to split a vim in 2 buffers with 2 different files vim file1.txt :sp file2.txt but ctrl + w is not working to switch between them. giving below error E486: Pattern not found: ...
2
votes
2answers
60 views

cat command in shell does not terminate on receving EOT through serial port

I have shell/perl script which kicks off cat commands to receive incoming serial data from n external device. The external device is designed to send to send a EOT character when it's done ...
1
vote
1answer
51 views

I'd like to run a few terminal commands from inside vim

There are two common things I do when I code something. I either open that file in the browser or run it in node. So I'd like to create a couple of shortcuts inside vim to that effect. I'd like F5 to ...
1
vote
1answer
53 views

Vim keep showing error message about color scheme for no reason

Error detected while processing /usr/share/vim/vim74/syntax/synload.vim line 19: E185: Cannot find color scheme 'MyColor' Those lines of errors keep yelling about cannot find color scheme. But, ...
0
votes
0answers
21 views

Where can I find good vim synonym-antonym dictionary?

Today I learnt that by using CTRL-X CTRL-T I can find a related word of current word from vim Thesaurus dictionary, which is amazing to me. I used the famous moby thesaurus from ...
0
votes
1answer
22 views

Where can I find a reference/tutorial for all vim7.4 bulit-in functions? [closed]

Recently, I found Vim has its own functions. This trick I learnt online helps me solved a index-number change problem: :s/\d\+/\=submatch(0) + 1/ Which I'm sure that submatch() is a vim internal ...
3
votes
1answer
21 views

vipe misbehaving on bash process substitution

I have the following simple command: $ echo <(vipe) I expected it to open a vim buffer, which I can edit, then when I'm done, echo the name of the temporary file assigned to hold the vim buffer ...
2
votes
0answers
31 views

vim arrow keys insert mode mapping

I want to move the cursor without using arrow keys in insert mode too. I've tried the following: :imap <A-h> <Left> but after moving cursor left by Alt-H from insert mode I get back to ...
1
vote
1answer
48 views

Complete language abbreviation list for vim's `set spelllang` option?

I'm starting using vim's spell check function today. But seems it treat Chinese characters as wrong spell word. Thus I did a little research, and find I should use set spelllang=X option. But the ...
2
votes
1answer
46 views

Can I re-login a disconnected session? [duplicate]

For some network reasons, my previous SSH sessions to server have disconnected. When I create a new session, I find the previous session still exist: [root@localhost ~]# who root pts/0 ...
1
vote
1answer
28 views

Search in vim for string starting and ending with a pattern

Let's say I want to highlight/search all the lines in a file opened with vim with following criteria. Criteria: Lines which start with "start123" and end with "321end". There could be anything ...
8
votes
3answers
667 views

How can I search in vim for a pattern that is NOT case sensitive?

I occasionally search through files in vim or less using / or ? but as far as I can tell, the search patterns are case sensitive. So for example, /foo won't find the same things that /FOO will. Is ...
-1
votes
3answers
91 views

How to toggle between vim buffer and command shell screen in vim?

I find it annoying to constantly press Ctrl-Z and then fg to go between these screens (where command terminal is the command line that you used to invoke vim from). It also generates unwanted fg ...
2
votes
2answers
69 views

vim: how to trace back all changes done to file during the day

Does anybody know how to setup vim (the text editor) in such a way to make it possible to trace back all the changes done to a file within a day? I need it for the cases when I have accidentially ...
3
votes
3answers
81 views

Vim want to write on a block

I have this file dvb-apps: dvb-apps: dvb-apps: dvb-apps: dvb-apps: dvb-apps: dvb-apps: dvb-apps: dvb-apps: dvb-apps: dvb-apps: ~ ...
1
vote
2answers
48 views

Vim VM-created .swp file exists and Vim ignores it

I have a file open in Vim inside a Linux virtual machine guest and I then try to open the file on the Windows host, and I do not get that warning that goes "Swap file blah.swp already exists!" (The ...
0
votes
1answer
11 views

How to assign Vim's showbreak a value locally to a buffer?

How can I assign showbreak a value locally to a buffer? The following makes it +++ for all buffers. let &showbreak="+++" I can set Vim options locally to a buffer by using setlocal instead of ...
2
votes
2answers
56 views

vim: using a for-loop-iterator-variable in a search pattern

I am trying to use a for loop iterator variable in a vim search pattern to determine for a range of words how man times they occur in a file. What I do so far is: for i in range(1,40) | %s/SiTg//gn | ...
0
votes
1answer
20 views

Why these two vim autocmd overlap each other?

I got these two autocmd config in my .vimrc autocmd FileType python highlight OverLength ctermbg=red ctermfg=white guibg=red autocmd FileType python match OverLength /\%80v.\+/ autocmd FileType ...
0
votes
2answers
22 views

How to use variables in substitution with vim regular expressions

I have a big file that contains among others serveral lines of the following form: USet07-1 USet07-2 USet08-1 USet08-2 . . . USet22-2 . . . I want to remove the hyphen/dash - from these strings in ...
0
votes
1answer
30 views

How can I get vim to return to normal tab display?

In an effort to get vim to show vertical indentation lines I ran the following command: :set list lcs=tab:\|\ Now my tabs look like this: How can I reset vim to default behaviour of not ...
1
vote
1answer
13 views

Is it able to only allow yanked content went to clipboard, meanwhile deleted content doesn't? [vim]

I got set clipboard=unnamed in my vimrc. Thus I can move vim's content to clipboard easily. But recently, I found I don't need the deleted content(with d, x, etc.) went to sys-clipboard, since it ...
2
votes
1answer
38 views

Using inotifywait along with vim

I have simple script that monitors file for changes and rsyncs it with remote copy: #!/bin/bash while inotifywait -e close_write somefile do rsync somefile user@host.domain:./somefile done It ...