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

learn more… | top users | synonyms

1
vote
1answer
294 views

Vim Visual Mode - is there a way to change the background color only when in visual mode?

I forgot which mode I am in using VIM so I set this up in my .vimrc so that I easily know I am in Insert mode as the background changes to Yellow :au InsertEnter * hi Normal term=reverse ...
0
votes
1answer
60 views

cw and . does not work as expected in vim on character deletion

If I have the following non-sense text: Hi woman! What is your name? I know what you mean... Yeap. Yeap. Again :) Hi woman! What i s your name? I know what you mean... Yeap. Yeap. Again ...
2
votes
3answers
868 views

Running external commands in vim

It seems that if I run the following inside the vim: :w !wc -w I get the word count of the file. But I don't understand the syntax. How does this work and how would I specify that I want the ...
1
vote
2answers
533 views

Can not edit .vimrc file

I have just installed spf13 plugin for vim and I want to customize .vimrc file. When ever I try to save the edits it says: ".vimrc" E166: Can't open linked file for writing syntastic: info: no ...
3
votes
1answer
411 views

Vim powerline with broken encoding

I trying to learn using vim, I am enjoining a lot, but I copied the vimrc from github and I would like to understand what is causing the break of powerline encoding. . In the vimrc file I have: set ...
2
votes
1answer
113 views

How to right or left shift a block of text by a specific number of columns?

If I use vim, put the cursor on the beginning of a line, and then input 3>> or 3<< I can left or right shift 3 lines by 8 columns If I just want to shift 4 columns, what should I ...
2
votes
1answer
99 views

Vim command mapping help

I'm a relatively recent convert to Vim, so I don't know a whole lot. My question is about mapping a multi-part command to a single key combo. In my .vimrc, I've got the following line: nnoremap ...
1
vote
1answer
81 views

incorrect/overwritten margins when using vim in GNU screen

When ssh'd into a work server via PuTTY I'm seeing strange behavior with the left margins when using GNU screen and vim. For example, I'll open up a Python script and all indentations will be gone ...
0
votes
2answers
59 views

Vim autocommand creates weird file

I've just set up slackware 14 on a virtualbox. As one does, I immediatly created/altered my .bashrc and, more importantly, my .vimrc files. To avoid writing huge lines of code, I usually add ...
2
votes
2answers
133 views

Any unix utility/tool to auto backup files before saving?

I would like to know if there is any existing unix utility or tool that would make a backup of a file with a date/timestamp appended to the filename. Basically I am looking to automatically make ...
0
votes
1answer
271 views

How to change search result highlight in vi?

The scenario: I log on a server using ssh, and search for keywords in a log file using vi. The problem: at the moment, the results of a search is only highlighted by a cursor _ below the searched ...
0
votes
1answer
218 views

VIM(Mercurial) +python3.2 on debian wheezy: Could not load library function PySys_SetArgv

> ./configure --enable-python3interp=dynamic --enable-gui=gtk2 > --with-python3-config-dir=/usr/lib/python3.2/ make vim --version|grep pyth +cryptv +linebreak -python ...
1
vote
0answers
108 views

Modify .inputrc to fix Mac Terminal bug with vi mode

I currently have a bug in my Mac's Terminal (I actually use iTerm2 but it's still there), where once I press left arrow after typing, I can't go past the last character. Is there a way I can modify ...
3
votes
2answers
87 views

Vim global search in a project

I started using vim two weeks ago switching from sublime and I am a ruby developer I know for a fact that Ack and Ag work very good on a Mac while they're not optimized for my Ubuntu machine. These ...
1
vote
2answers
49 views

Adding commands to VIM?

I keep accidentally entering W instead of w as the command to save my changes. Is it possible to create a shortcut, alias, or command to write, and give it the hotkey of W?
4
votes
3answers
591 views

`grep -l .. | xargs vim` generates a warning, why?

If I run a command like grep -rl test . | xargs vim I get a warning "Vim: Warning: Input is not from a terminal." But I am still able to edit the files. Why the warning?
5
votes
1answer
340 views

What is the point of Virtual replace mode in Vim?

The help says that virtual replace mode commands in Vim gr & GR replace characters in screen estate and not in file. :help Virtual-Replace-mode I am understanding this as something like ...
3
votes
1answer
70 views

Vim settings within ncftp edit

I'm using the ncftp utility. It has an edit command which handles the get, edit, put sequence for me as in GUI ftp clients. It's great except for one thing, I get vanilla vim, with none of my ...
2
votes
1answer
103 views

SED Showing CRLF While Vim Not Showing

Why sed l\;q shows a CRLF while opening the file in Vim with :set list doesn't show any CRLF
0
votes
3answers
285 views

Text editor with indented word wrapping

I've been using Notepad++ in windows for a while and it has a cool feature for word wrapping so that the wrapped text is indented. That is the start of the sentence starts at column 1, but wrapped ...
5
votes
3answers
2k views

vi / vim - how to automatically strip trailing spaces on save?

Is there a .vimrc setting to automatically remove trailing whitespace when saving a file? Ideally (to be safe) I would like to only have this functionality for certain files, e.g. *.rb
0
votes
1answer
94 views

vi / vim - extra indents when pasting text? [duplicate]

I can copy characters in other apps such as browsers with ctrlc. I can then press i to enter insert mode in vim and press shiftctrlv to paste the text in. The problem is that each line gets indented ...
4
votes
1answer
100 views

Vim syntax highlight length-delimited fields

I'm trying to write a vim syntax file for SVN dump files. The part I can't figure out is the section like this: Fooprop: Val1 Text-content-length: 20 Barprop: Val2 ...
-1
votes
1answer
358 views

Can't uninstall vim [closed]

I've got a problem with vim deinstallation. I've done sudo apt-get remove on vim, vim-common, vim-tiny and actually anything starting with 'vim' in the package list, but still can run vim from command ...
4
votes
1answer
118 views

Can I access X11's clipboard from tty1-6?

Sometimes, when I'm running on battery and don't need a window manager, I'll log into tty1, fire up fbterm and Vim and work. Later, if I need the window manager, I'll use the log in GUI but switch ...
3
votes
1answer
56 views

Expanding functionality of case switching commands in Vim

In my current work of refactoring a fairly large codebase, I find myself wanting to replace apostrophes and quotes with each other from time to time. Up until now I've been applying s/"/'/g for ...
3
votes
1answer
91 views

How do I save all vim buffers on tmux window change?

Is it possible to hook up vim save all command on tmux window change? I know that gui vim has option to save on focus lost. I'd like to have similar behavior in console.
2
votes
1answer
114 views

File no longer available when trying to edit in vim via <()

When working with mercurial, I frequently do things like vim <(hg cat -r 42 somefile) However, if I try this with a file larger than several hundred lines, I get a Read Error in vim, and only ...
1
vote
2answers
201 views

Why does Vim only activate my highlight configuration after I source my .vimrc manually?

I was cleaning up my vimrc today, splitting it into separate files to make it easier to maintain. On completion of these changes, all my configuration, mappings and plugins appear to be working, ...
1
vote
1answer
83 views

Set auto completion for a new filetype

I have a file, which contains lines of function name, now I want to use them for code auto completion, and only for file names end with .XXX. How should I do it, is it possible to work with ctags or ...
4
votes
2answers
323 views

vim shortcut to open a file under cursor in an already opened window

In vim you can open a file under the cursor by using the gf command. One can also easily open that file in a new split window by hitting <c-w> f. This is a really nice and time saving feature. ...
3
votes
2answers
158 views

Vim - loop through files in cope

how can I lop through buffers in quickfix list :copen and make some actions with it. Or any alternative way to put those files to args list and I can use argsdo.
4
votes
4answers
253 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 ...
0
votes
2answers
258 views

Calendar.vim E492: Not an editor command: Calendar

I am trying to install the calendar.vim plugin on mac osx snow leopard running gvim. I have pathogen.vim installed, so I followed the instructions on github to install calendar.vim from the terminal: ...
2
votes
1answer
251 views

bash script - supervisor program

I have to write a shell-script that have to do the following tasks: -in every 5 seconds it saves:     -how many users are using joe and/or vi;     -if ...
1
vote
1answer
66 views

Wildmenu “closes” when opening a single item directory

TLDR; I want to open wildmenu with <Tab> and keep it open until I open a file. Suppose that I have the following directory structure: ./file1 ./file2 ./dir1/file3 ./dir1/dir2/file4 ...
5
votes
2answers
2k views

Change colors in console/virtual terminal

Is there a way to alter all the available colors in console / virtual terminal? By console, I mean what you get after pressing CTRL + ALT + F1 and not anything like xterm or urxvt. So, I guess that ...
2
votes
2answers
2k views

How can I set “vi” as my default editor in UNIX?

I believe I can do something like export EDITOR=vi, but I'm not sure what exactly to enter, and where. How can I set "vi" as my default editor?
1
vote
1answer
263 views

VIM: Display Hex Code Inline

I would like to have hex codes been displayed inline, no matter what filetype is activated in the current session. So far I've found something existent and suitable for my needs: ...
3
votes
1answer
733 views

vi[m] read range of lines from another file

On Linux, editing file_B in vim I want to add line 10-25 from file_A. Example: One has a whole set of HTML-Documents with quite the same header and yes, one could create a template and start from ...
0
votes
1answer
45 views

How can I hook functionality to the “go to line”-command in Vim?

I just got the idea that I wanted to make it so that Vim centered around a line when I jump to it. Is there a way to make zz be executed automatically after I have called the colon command followed ...
1
vote
2answers
586 views

How do I set vim as the default editor when I sudo?

I'm working on a CentOS 5.9 machine, and I simply want to type sudo vi somefile and have my trusty vim with syntax highlighting, etc. This seems simple enough, but after many attempts, it's ...
2
votes
1answer
2k views

How do I highlight the current line and the cursor in .vimrc?

I am trying to highlight the current line as well as the cursor position in Vim. Here's my .vimrc: set cursorline hi CursorLine ctermbg=8 ctermfg=15 "8 = dark gray, 15 = white hi Cursor ctermbg=15 ...
0
votes
1answer
173 views

Why is vim offering me spelling suggestions instead of using the completefunc?

I am trying to set up vim for writing email. I have a plugin to provide autocompletion of email addresses (notmuch abook ). If I do :set completefunc it tells me it is CompleteAddressBook as ...
0
votes
1answer
77 views

Comment the if statement and the matching endif keyword

In vim, I can find the matching if statement and prepend the appropriate comment symbol. (e.g. %s/.alarm./#\0/g), but then I am left with dangling endifs that I have to find manually. I could simplify ...
1
vote
1answer
26 views

Is it possible to affect the behavior of all vim commands in normal mode?

Is there a way to affect the behavior of all vim normal-mode commands? Say, after every command succeeds, I want to trigger some post-behavior.
2
votes
2answers
140 views

Live diff-mode editing in vim

I want a live view of diffs while I am editing a file. vimdiff is able to do something I want, like highlighting the differences between two files. However there are two drawbacks of vimdiff that ...
2
votes
3answers
151 views

Open multiple files in Vim with a filelist

I have a file 'filelist' that contains the following lines: text1.txt text2.txt text3.txt I am looking for a command line invocation that opens the 3 files in vim. I tried the following: $ cat ...
5
votes
4answers
3k views

Ctrl-s hang terminal emulator?

I came across a sentence in vimdoc: Note: CTRL-S does not work on all terminals and might block further input, use CTRL-Q to get going again. and this key indeed hangs my vim. I was ...
2
votes
1answer
653 views

Vim - how to increase each number in visual block?

I have the following SQL: update am.PERMISSIONS set PRM_ORDER = 35 PRM_VISIBLE = b'1' where PRM_ID = 3; update am.PERMISSIONS set PRM_ORDER = [35] PRM_VISIBLE = b'1' where PRM_ID = 7; update ...