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

learn more… | top users | synonyms

2
votes
2answers
110 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
174 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 ...
1
vote
0answers
92 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
3answers
396 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?
3
votes
2answers
80 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
47 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?
9
votes
2answers
4k views

How do I cycle through panes inside a window in tmux like in screen?

I thought Tmux - move window to pane was the same question but it doesn't seem to be. Coming from using GNU screen regularly, I'm looking for tmux to do the same things. On of the things I do ...
5
votes
1answer
254 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 ...
2
votes
3answers
119 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 ...
3
votes
1answer
59 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 ...
3
votes
3answers
1k views

vi: backspace in insert mode not erasing characters

I am new to vi, actually I have started learning vi from today and I have got stuck at the behavior of the backspace key. Actually when I fired up vi on my Ubuntu 12.04 for the first time my backspace ...
4
votes
1answer
165 views

Different vim colorscheme depending on mode

I'm often doing the same mistake in vim: I forget whether I'm in insert or command mode, then I type in, I get random commands or I modify/delete code, and I have to undo. I do this mistake really ...
1
vote
2answers
119 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 ...
2
votes
1answer
86 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
210 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 ...
3
votes
3answers
943 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
5
votes
1answer
1k 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 ...
0
votes
1answer
84 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 ...
10
votes
4answers
1k views

Preserve modified time stamp after edit

For files within a specific folder, I would like vim to never touch "modified" timestamp at all. The background is that I use Bloxsom for blogging, which uses plain text files in ~/bloxsom as source ...
5
votes
1answer
322 views

vim.googlecode.com SSL certificate change

I am building vim from source and keep having to update the SSL hostfingerprints of my ~/.hgrc file. It's getting a little silly and large – see below. The pattern is the same: run update, ...
-1
votes
1answer
266 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
98 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
2answers
133 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.
3
votes
1answer
85 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.
7
votes
1answer
5k views

Switch VI to use backspace key instead of Control+H for backspace?

I'm on Solaris 10 and by default vi version SVR4.0, Solaris 2.5.0 is installed. The system was set up so that when I ssh to it Control+H does backspace, and backspace outputs ^? I added stty erase ...
2
votes
1answer
94 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
1answer
61 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 ...
1
vote
1answer
142 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, ...
3
votes
2answers
169 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. ...
4
votes
4answers
207 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
201 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
202 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 ...
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 ...
1
vote
1answer
56 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 ...
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
135 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
486 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
126 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
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
463 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
1k 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
60 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
4answers
73 views

Editors Nano/VIM not using resources

Does anyone here know the resources it takes for editors to search and replace in a large file? The reason I am asking, is I have a 32 core server that HTOP is only showing one core at 100% when ...
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.
0
votes
0answers
87 views

Trouble with Vim Auto Commands from Learn Vimscript the Hard Way

I have been working through the examples and exercises in Steve Losh's book Learn Vimscript the Hard Way, and I have hit some serious trouble in chapter 12 on Auto Commands. I am running MacVim on ...
2
votes
3answers
709 views

Unmet dependencies

I am trying to compile vim and install with "--enable-pythoninterp" flag, which needs the python-dev package. INFO I obtained the vim source from ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2 Vim7.3 ...
2
votes
4answers
1k 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
377 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 ...
14
votes
3answers
3k views

How to fix Ctrl + arrows in Vim?

I am using Putty -> Suse box -> vim 7.2 combo for editing and want to remap Ctrl + arrows combo to a particular task. But for some reason, Vim ignores the shortcut and goes into insert mode and ...
1
vote
2answers
409 views

How do I set bash aliases and variables from within vim?

In cmdline mode, the following examples do not work for me. !alias lol='echo lol' !lol='echo lol'