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

learn more… | top users | synonyms

4
votes
3answers
341 views

Any way to provide a separate vimrc file just for 1 session

I would like to know, if there is a way in vim/vi to provide a different vimrc file. I am looking at managing 2 different vimrc files. For the contents I checkout/checkin in version control I want to ...
2
votes
3answers
91 views

Replace string with another string in vi editor

I have a template.php file where I want to change every occurence of apple with grape throughout the file. At the moment,I am having to painstakingly edit the entire file to find where to change. ...
0
votes
1answer
38 views

Localized wrapping in vim

I have wrapping turned on in vim, but is it possible to disable it for certain regions in the file I'm editing? To be specific, I'm editing LaTeX files, I would like the contents of some environments ...
6
votes
6answers
11k views

How to comment multiple lines at once? [duplicate]

How can I select a bunch of text and comment it all out? Currently I go to the first line, go to insert mode then type # left-arrowdown-arrow and then I repeat that sequence, perhaps saving a few ...
1
vote
1answer
94 views

Set makeprg to gradlew

First a bit of context for those who don't know gradle. It's basically like make except that you don't have to have gradle installed on your computer. It ships with projects as a file called gradlew. ...
1
vote
1answer
66 views

How to hardcopy to multiple pages per sheet?

Let's suppose I have a single sheet of text to print (8.5''x11''). Can I create multiple hardcopies of said text and scale them so that I can fit 4 copies per print sheet using VIM? ex. ___________ ...
8
votes
3answers
5k views

Transaction check error in installing vim?

I recently updated my fedora to 20 and wanted to install vim.but running sudo yum install vim returned this error: Transaction check error: file /usr/share/man/man1/vim.1.gz from install of ...
1
vote
1answer
113 views

Show status lines of vim and tmux on the same line

I would like to figure out a way to get my vim statusline and tmux statusline on the same line if such a thing is possible and not immensely difficult (ideally, the vim prompt, or whatever it's called ...
7
votes
1answer
1k views

tmux, Vim and Solarized

Premises Browsing around tmux, Vim and Solarized I can find lots of complains about 256 colours and "user experience". Well, I'm having the opposite "problem", i.e. Vim works well with a full ...
13
votes
2answers
5k views

tmux, TERM and 256 colours support

Introduction My question arises from the necessity of understanding why I have now (after multiple trials) Terminal and tmux supporting 256 colours and tput colors telling me there are only 8 of ...
0
votes
2answers
117 views

vim how to keep cursor position while copying text

I am (having to) using gvim in windows. I was used to the linux environment where when I select text using mouse the cursor position wont change. Now , with gvim in windows, My problem is something ...
2
votes
2answers
609 views

vim colors not automatically loaded (probable Vundle conflict)

I've been trying to port my Windows .vimrc to Linux, to use on the command line (on gnome-terminal). Everything works fine, except for the colorscheme. It looks like it's loaded (:colorscheme returns ...
7
votes
2answers
166 views

How do I only undo pasted text in vim?

TL;DR; version - How do I undo text that was pasted in from my OS copy buffer without undoing other text that was typed in since I went into insert mode? Longer description: Put something in your ...
1
vote
1answer
801 views

Configuring Vim with clientserver and clipboard

On OS X I have vim working just fine from homebrew. The default homebrew install compiles vim with these flags. ./configure --prefix=/usr/local --mandir=/usr/local/Cellar/vim/7.4.161/share/man ...
1
vote
2answers
46 views

Vim: What is difference between motion mark shotcut `. and `"?

While reading vim info motion marker says: |`quote| `" go to the position when last editing this file |`.| `. go to the position of the last change in this file Above ...
5
votes
2answers
53 views

How do I pick up a previous modification in VIM?

If I did several modifications to the original file, i.e. 1 delete a line 2 insert some text 3 delete another line 4 delete the text added in step 2 5 insert some other text 6 ... Now I want to ...
1
vote
1answer
164 views

Mapping C-1 does not work in VIM

I'm trying to bind 1gt to CTRL + 1, so in vimrc I added nmap <c-1> 1gt But pressing these keys in normal mode does not work. Either VIM (konsole) or gVIM Anything wrong with my command?
2
votes
2answers
236 views

Command-line editing vim style [duplicate]

I recently discovered terminal's feature, you can set the keys emacs or vi style I prefer the second. so if you do set -o vi You can use k j l h keys to navigate on the command line. And you can ...
3
votes
4answers
1k views

Arrow keys spontaneously stop working in vim

I recently upgraded from OS X 10.6 (I think) to 10.9. Since then it seems, while editing in vim, the arrow keys will "spontaneously" stop working. At one point, in frustration I "mashed" one of the ...
2
votes
1answer
215 views

Auto indent C++11 lambda functions Vim

Is there any way to get Vim to auto indent C++11 lambda functions correctly? I have tried many different permutations of smartindent, cindent, etc. in .vimrc.
2
votes
2answers
98 views

Anyway to navigate percentage-wise in vim?

I often open large files, looking through logs for finding info. As all lines have timestamp in my case and I am sure of in which part of the whole file the info is present which I am interested in. ...
0
votes
1answer
53 views

Piped search queries in vim or less

I would like to be able to search a log file for lines that being with ^2014-02-18 15:30:[0-9:,]* and have UserName:someguy much later in the same line. I am sure I could do a regex to include any ...
3
votes
1answer
104 views

What does the search flag 'z' do in VIM?

I was looking for a way to show a bit of context around my searches when doing g/mysearchtext/p When I stumbled across this page Search-a-pattern-and-provide-a-context-few-lines-above-and-below ...
8
votes
2answers
492 views

Is there a command reverse search in vim?

In linux cli I can do ctrl-r and do a reverse search and choose something I have done easily. Is there something similar in vim? I mean I may run a command using : (could be anything like a long ...
2
votes
1answer
138 views

Search for “not newline” in vim?

To search for A T\n in vim I can just do /A T\n What would be the equivalent for not newline at the end? /A T[^\n] did not work.
0
votes
1answer
177 views

When I type vim in terminal my bodhi linux complains emacs is not installed (bodhi linux) [closed]

jcress@jcress$ vim The program 'emacs' can be found in the following packages: * emacs23 * emacs23-nox * e3 * emacs23-lucid * jove Try: sudo apt-get install <selected package> I can't ...
8
votes
2answers
210 views

Vim - map last shell command to the key

Is there any way to map leader-r to repeat last command sent to bash? For example, when working with C files I would like to compile and run program from vim without typing :!make or gcc. I know I ...
3
votes
2answers
464 views

How can I make shell aliases available when shelling out from Vim?

In my .zshrc, I declare some aliases. Eg, which dbstart shows the contents of that alias. If I open vim from that shell, it is a child process. In Vim, I can run shell commands with :! some_command. ...
0
votes
2answers
175 views

How can I paste something to the VIM from the clipboard

How can I paste something to the VIM from the clipboard? In Windows "*p works as expected but in Debian both "*p and "+p doesn't work with both clipboard=unnamed and clipboard=unnamedplus.
0
votes
1answer
475 views

How do I join the next line when a line matches a regex for whole document in VI?

As title, for example, I have lines like abcdefg join! abcdef no join abcdefg join! If a line matches regex ^a.+g$ then I would like them to be joined, so it would be: abcdefgjoin! abcdef no join ...
12
votes
4answers
1k views

How can I constantly see the current filename in vim?

I am using vim and I need a way to always be able to see the file that I am working on without having to do ^G. I see the file name when I start vim but when I start to work and use various functions ...
1
vote
3answers
157 views

Can Vim be made simpler? [closed]

I have a 300MB file I want to edit, search, remove duplicate lines, compare 2 files, that sort of stuff. I tried Sublime Text 3, which was slow and crashed often. I asked for recommendations and was ...
1
vote
1answer
31 views

Avoid completing directory names when changing vim buffers

Suppose I have a directory structure, such as dir ├── foo │ ├── bar.c │ ├── bar.h │ ├── foo.c │ └── foo.h └── config └── foo.conf And I have each of the files in foo/, as well as ...
2
votes
1answer
2k views

Copy/paste into SSH'd VIM from local (Windows) clipboard

I would like to copy from a local machine and paste into vim on a remote box which I am SSH'd into. That's it. I have tried "+p and "*p, mouse middle-clicking, and a couple other things to no ...
1
vote
3answers
130 views

vim avoid selecting underscore

So I know that an underscore (_) is considered part of a word in vim. Working with Python, I normally end up having a lot of underscores. Is there a way to select part of a word excluding the ...
1
vote
0answers
62 views

Blank lines of unknown origin when running vim after tput clear

I have a rather bizarre issue with terminal behaviour. If I execute tput clear to clear the screen, my cursor (as expected) goes to the top of the terminal. If I run vi after that (vim actually), ...
5
votes
1answer
93 views

How to put current line at top/center/bottom of screen in vim?

Any quicker navigation trick to place the line at which the cursor is at the moment to the top of the screen? center of the screen? bottom of the screen?
0
votes
1answer
175 views

Can not install any color scheme in Vim in Kubuntu

I have installed the latest Kubuntu. I am trying to set a nice color scheme for my terminal, but it does not work.For example I tried wombat256. I copied the wombat256mod.vim under ~/.vim/colors as it ...
1
vote
2answers
52 views

Machine keeps backups of files that I have already deleted

I recently found out that my machine keeps backups of files that I have already deleted. For example, a file called a.svg that I have deleted in the past, still exists in the directory it was deleted ...
6
votes
1answer
285 views

How to highlight logs with bash coloring on vim?

I have some nicely colored logs from some tools with bash color codes. When I view them through less or similar tools it get color rendered by bash (obviously). However it is pain to watch and edit ...
1
vote
3answers
150 views

Emacs's <C-l> vim equivalent

There's a neat Control-L hotkey in Emacs that repetitively moves the cursor to the top/middle/bottom of the screen. I'm quite sure there's a vim equivalent for that, but I couldn't find it.
2
votes
2answers
105 views

Why is vim not being opened in its own screen?

When I type vim in xterm the program is not opened in its own screen, but in the very same I am writing commands in. Let me explain: for example, lets say I type in the terminal ls -l /usr/bin and get ...
0
votes
1answer
42 views

Insert mode in all windows in VI

Suppose I am using vim with two or more files opened in split-screen mode. The open files are very similar, and I want to perform a few identical changes to all files. I already know of :windo set ...
4
votes
2answers
729 views

Can vim display ASCII characters only, and treat other bytes as binary data?

I already know vim -b, however, depending on the locale used, it displays multi-byte characters (like UTF-8) as single letters. How can I ask vim to only display ASCII printable characters, and ...
2
votes
1answer
104 views

Minimize the current width of a window in Vim

To maximize the width of a current window in Vim, we type: ctrl-w | Is there a similar alternative for minimizing a current window in Vim?
0
votes
2answers
278 views

Trouble getting help in vim

I have just finished the vimtutor and everything went fine except for the last part (Lesson 7.1: Getting Help). I type :help and the help manual is shown as it is supposed to. But then I try (as ...
1
vote
1answer
461 views

Vim colorscheme background not filling terminal

I am using vim with lxterminal, and the colorscheme kolor, and I am experiencing an issue where vim's background color does not fill the entire terminal. It can be seen clearly at the bottom of ...
1
vote
2answers
52 views

use search result in replace statement with vim substitute

I know this is gonna be a stupid question, but I've tried here, google and the official documentation. I've got a file with a whole heap of words of the form 'foo' and i want to change them to ...
4
votes
2answers
66 views

Stop vim from messing up my indentation on comments

For some reason Vim thinks all of my comments should have all indentation removed. If I add # to the beginning of a line, suddenly all leading whitespace is removed. How can I stop this? I have ...
6
votes
3answers
323 views

What is difference between w and W in escape mode of vim?

I am looking at the vim help quickref commands for moving cursor. Following lines confuse me because I find both of them working same. Could some one elaborate me difference with an example. N w ...