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

learn more… | top users | synonyms

2
votes
1answer
180 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.
1
vote
2answers
49 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
47 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
84 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
338 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
106 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
139 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
177 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
190 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
117 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
238 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 ...
11
votes
3answers
470 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
126 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
27 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 ...
1
vote
1answer
964 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
93 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
57 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
74 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
126 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 ...
0
votes
1answer
539 views

How to install vim-gtk in debian wheezy

this is the terminal trace root@wheezy:/home/me# sudo apt-get install vim-gtk Reading package lists... Done Building dependency tree Reading state information... Done ...
1
vote
2answers
50 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
170 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
100 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
86 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
41 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 ...
1
vote
1answer
308 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 ...
1
vote
1answer
81 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
187 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
290 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
45 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
54 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 ...
4
votes
3answers
190 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 ...
0
votes
1answer
294 views

Use remote ViM clipboard from iterm2 on Mac OS X

I have been using VNC for a long time for development and now I decided to move to iterm2 and screen. But there is a small problem. I have to ssh into a remote machine and use vim there. And I want ...
3
votes
1answer
83 views

Use a custom colourscheme in Vim

I have customized a color profile for Vim (toto.vim) in the colors folder at : /usr/share/vim/vim74/colors Now, to use it, I am obliged to call it each time I start vim, using the command : ...
12
votes
2answers
631 views

What happens if I use vi on large files?

Though we were instructed not to, a colleague of mine used vi to view a large text file (server.log 3.5 GB). This filled up /var/tmp and caused some problems on the server. What caused this? Why ...
7
votes
1answer
229 views

VIM: folding bullet points

I'm quite new to VIM, but have been trying to teach myself over the past week, yet I'm encountering a problem which has proven to be quite frustrating: Currently I'm mostly using VIM to take notes, ...
1
vote
4answers
104 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?
25
votes
9answers
859 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
158 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
47 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
99 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
151 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 ...
1
vote
2answers
85 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
65 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
81 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
253 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
627 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
304 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
90 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
30 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?