Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor.

learn more… | top users | synonyms

1
vote
1answer
21 views

Vim C line comment function

The following function in ~/.vimrc is to comment out C line, and it works perfectly. function CLC() execute "normal ^i/*\<ESC>$a*/\<ESC>" endfunction But I have two questions... 1. ...
4
votes
1answer
23 views

How can I use vim to view git diffs on Windows?

I want to use vim to view the output of git diff. I am running Windows 8 and I have vim 7.4 installed. I have, for convenience, created an environment variable VIMDIR set to Vim's install directory ...
1
vote
1answer
10 views

Insert a line of text before lines matching a regex in vim

I'm attempting to add a column to an HTML table using vim so I need to add a pair of <td> tags the line before each </tr>. So far I have :186,$s/ <\/tr>/<td><\/td> \n ...
0
votes
1answer
9 views

Setting up Slimv on Windows + Vim / gVim

I intend to learn Common Lisp, and the book I plan to follow has suggested that GNU Emacs in conjunction with SLIME be used. However, I am not particularly fond of the way Emacs runs on Windows, and ...
0
votes
2answers
25 views

How do I view the content of a very large file at position in Linux?

I've got a file containing JSON data that is about 90MB of size and has one line. I need to go to position 99376229. Unfortunately vim and less both crash when I try moving to that column. How can I ...
0
votes
2answers
20 views

Vim tab size when hitting <Tab> and when autoindent applies

I decided to change my tab size from 4 to 2, because why not? Anyone else who wants to look at the code can surely use thier preferences. However, a question. If I hit the tab key, it inserts 2, but ...
0
votes
1answer
33 views

Vim line numbers in insert mode

For some reason, Vim (gVim for Windows) turns off the line numbers when I enter insert mode. This can be rather jarring, because it shifts all the code to the right or left when I leave or enter ...
1
vote
1answer
18 views

Doesn't “scrollwheelup/down” mapping work in gvim on windows OS?

I tried it all ways to make the mouse buttons ScollWheelUp/Down work in my vim. Checked in all other plugins if there is a conflicting map, no conflicting map. Tried this: :verbose map ...
0
votes
2answers
22 views

Using Vim's “autocorrect” feature

If I create mappings in vim for autocorrecting ("teh" to "the"), how will it affect Vim's speed? Also, if I were to actually want to type "teh" how would I do it without vim autocorrecting it?
0
votes
1answer
21 views

Get hotkey to type a random number as if I typed it on a keyboard on Windows?

In many cases I need to not just generate a list of random integers (which is easy), but to type random integers into various software. For example, to skip a random number of lines (1 to 100) in ...
1
vote
2answers
35 views

Adding an abbreviation for spaces in vim

I am trying to add the following abbreviation in vim, but its not working. noreabbrev <space><space> .<space> Its just like in most modern phones keypad. so can someone tell ...
0
votes
1answer
24 views

Going from insert to normal in vim causes this to appear

Whenever I go from insert to normal mode, this shows up at the bottom of my vim screen. What is it and how do I stop it?
1
vote
1answer
26 views

Vim highlighting between editing sessions

Is there a way to disable vim from carrying highlighting between editing sessions? For example, I was looking for the definition of pi (M_PI) in /usr/include/math.h and searched /PI to find ti real ...
1
vote
2answers
23 views

Vim assembly formatting

Vim is not properly indenting assembly code, regardless of if I want it to do it automatically or if I try gg=G it'll just says ## lines indented even though it didn't change anything and all my text ...
0
votes
0answers
27 views

Vim YouCompleteMe

I see that the vim plugin YouCompleteMe is a great autocompletion tool but is there a way to get it to complete not just from a file I am working on but external files as well? Like, if I go to type ...
0
votes
1answer
25 views

`:cw` command in Vim: how to avoid auto jumping to first error?

In Vim, :cw command shows the quickfix window if there are any errors and let the cursor jump to the first recognized error in the quickfix window (not in the buffer where there is an error). Is there ...
0
votes
0answers
16 views

Vim YouCompleteMe plugin usage

I recently installed the YouCompleteMe plugin, which is great...works great, etc. But I do have one question: If I have typing up a source file from start to finish, it includes everything in that ...
1
vote
2answers
22 views

Which default encoding for Vim: utf8 or latin1?

I'm writing text in European languages as French, German, Italian. All characters are compatible with latin1 encoding. Thats why I decided to set the default encoding in vim to latin1. Once in ...
1
vote
1answer
29 views

VIM only storing first 50 lines when yanking between files

When I use Y to yank lines, I can yank any reasonable amount of lines (I've never knowingly hit a limit). However, if I close the file and then try to paste p into another file, only the first 50 ...
0
votes
1answer
22 views

Vim inserting C style comments

:command Linecomment :normal ^i/*<ESC>$a*/<ESC> The above command is one that I came up with in order to comment out an entire line in C, normally for debugging purposes and whatnot. I ...
0
votes
2answers
26 views

Changing vim/terminal open location

Before I dove into learning ruby my .vimrc file had this at the very end cd data It was perfect because the home directory is shared with my mac. I tried changing my home directory in OSX. This was ...
0
votes
3answers
24 views

Vim insert-mode abbreviations with normal mode commands

I am looking to make a vim abbreviation s that if I type "prf" in insert mode it prints printf(""); and immediately throws me back int insert mode but between the two quotes. I can't quite figure out ...
0
votes
1answer
15 views

Disable scrolling when launching an app (Vim) inside Windows console window

In Windows, when I'm using the command prompt and launch Vim, I have a habit of trying to scroll through files using the mouse-wheel (which of course works in gVim but not inside the terminal). Is ...
1
vote
2answers
34 views

Jump in vim on same line

I have log files of format 'date' 'filename' 'something 'return status' Often status goes beyond my screen. While I am reading 'something' I press End to see status and Home to see filename. But ...
0
votes
2answers
40 views

SSH'd (via Cygwin) vim to write to local file

Okay, so I'm trying to solve the problem of getting the contents of a yanked register from a SSH'd session in Vim, to go to the Windows clipboard. Here's the scenario: SSH into development ...
-2
votes
1answer
29 views

In Vim (with YouCompleteMe), can I limit the number of possible completions shown?

I am using YouCompleteMe for identifier completion in Vim. I would like to limit the size of the completion popup so that it is never more than 5 entries. Can this be done?
0
votes
3answers
93 views

How to set colors in OS X (Mavericks) terminal?

I want to set the color's palette of my terminal in order to use properly the Solarized colorscheme for Vim (http://ethanschoonover.com/solarized). I understand that i've to modify my .bash_profile ...
0
votes
1answer
25 views

Vim delete motions include under the cursor

If you delete backwards in vim, it doesn't delete the character under the cursor. What do you need to do to have it delete, say, back to the last space?
0
votes
1answer
35 views

Line length highlighting works correctly in console Vim, not GUI

This question is related to this one. Damian Conway provided a nice snippet for marking excessive line length in his recent OSCON 2013 talk about Vim. highlight ColorColumn ctermbg=magenta call ...
1
vote
1answer
29 views

Make (g)vim buffer a remote file

I regularly work remotely on a linux machine using vim. Sadly the connection to the remote host is not very good, giving me a very tough time. Is there a way to make my locally running vim or gvim ...
2
votes
1answer
28 views

vim: insert enough spaces to align text to column number

COMP_ID=` echo $SRC | sed -e 's/.*COMP_ID=//' -e 's/:.*$//'` SRC_TYP=` echo $SRC | sed -e 's/.*SRC_TYP=//' -e 's/:.*$//'` DOC_TYP=` echo $SRC | sed -e 's/.*DOC_TYP=//' -e ...
-1
votes
1answer
36 views

Vim output of external command [closed]

Can anyone explain the various ways of doing external command like :! :%! and how to put them at the end of a file? I understand that :X puts them after line X, but :G does not appear to put them at ...
3
votes
2answers
32 views

In vim, how can I remap <tab> without also remapping <Ctrl+i>?

I like to use tab to jump between split windows, so I have map <tab> <C-W><C-W> in my .vimrc. Yet I noticed that this makes it so that Ctrl+I doesn't behave as Ctrl+I anymore, but as ...
0
votes
1answer
28 views

Do sed-like delete commands in vim

I'm comfortable doing search/replace in vim, but how do I delete all lines in a file (or between certain lines) if they match a condition? Currently I shell out and run a sed command, for example: ...
5
votes
2answers
287 views

How to a open a file in vim using pipe

I get to use the locate command extremely often. So if I run the following command. locate updatedb | head -1 Then it gives me the O/p /usr/updatedb.conf I wonder if there is any such command ...
3
votes
1answer
45 views

Mapping s-tab in vim

I'm trying to set up some basic configuration for vim to make it more useful for myself. One of the things I'm trying to do is map shift+tab to a literal tab character, since my vim configuration sets ...
-1
votes
2answers
45 views

add line number after matched pattern in vim

I have raw sequences and I have to convert it to fasta format. so reads are like this: CTACGGTGTGCTCTTCCGATCTGACTATG AGTTGGTGTGCTCTCCCGATCTCGCTCCCTC GTGAGGTGTGCTCTTCCGATCTCCGGCAGTGTGCT and i want ...
0
votes
0answers
23 views

Seamless vim and tmux panes between ssh client and host

This article describes assigning the same key binding to transitions between and within vim and tmux panes, allowing "seamless" transitions. ...
3
votes
2answers
70 views

How to go to the n'th character, not byte, of a file?

In vim one can get to the 5th byte of the file with the following command: :goto 5 However, in a UTF-8 text this could be the 5th, 4th, or even 2nd character in the file. How to go to the 5th ...
2
votes
2answers
38 views

How do I create CTRL key bindings in vim when using tmux?

I use Vim inside tmux, and have recently added the following to my .vimrc file: " easy navigation nnoremap <C-Left> :tabprevious nnoremap <C-Right> :tabnext But this seems to have no ...
0
votes
1answer
21 views

Mapping key to make new vertical window in Vim

This is really odd. Here's the key mapping from my .vimrc: noremap <C-n> :vert new<CR> The expected behaviour when I press CTRL-n is that it opens a vertical window but it somehow opens ...
0
votes
4answers
79 views

Can I rename files in a directory with Vim?

If I open a directory in vim using vim . I will get a file-browser-type interface of the current directory. From there I am expected to browse to a file, and then start editing it. I want to use ...
0
votes
1answer
39 views

Hide non printable characters in vim

Vim shows non-printable characters prefixed with a ^ (for instance ^@ for a NUL byte). I have a column based file containing both printable and non-printable characters which is difficult to read, ...
-1
votes
1answer
21 views

VIM: scroll on mouse move

I have a trackball, which I don't use much when in vim. I would really like to be able to use it to scroll up and down. Is there a way to set mouse move up/down to scroll up/down?
1
vote
2answers
22 views

Why are my Erlang indent settings different on MacVim vs. gVim?

I'm using the same .vimrc and .vim folder on my Mac (MacVim) and on my Linux box (gVim). As far as I can tell, this means that my vim configuration should be more-or-less identical on both. However, ...
0
votes
3answers
38 views

Vim Colorscheme

What do I change in vimrc to make the while and if/else/elseif in this screenshot a different color? EDIT----------------------- This is a custom colorscheme and I am wondering what I change in ...
1
vote
1answer
37 views

Vim command mode percent expansion

My typical day-to-day workflow in Vim involves having two vertical panes; production code on the left, and the tests on the right. I frequently switch languages (and test frameworks), so I like to ...
0
votes
3answers
37 views

set chars to uppercase between parenthesis

let's assume in vim I have following lines: all what (strong) people have to do is pushing (heavy) weights over (and over) again in order to gain muscles and I need to convert words inside ...
0
votes
2answers
43 views

Document map in vim

Before I used Vim I used Notepad++. What I miss in Vim is the Notepad++ document map. (https://www.youtube.com/watch?v=5Y6hE0SdgsQ) Sublime text editor has similar document map. Yes I know you can ...
-1
votes
1answer
41 views

How to automatically determine filetype by first line in file using vim? [closed]

My vim can determine filetype by first line of file (e.g. #!/bin/bash). But check of first line occurs only at the start of vim. How to do runtime checking of this?