vim

Vim scrolling without changing cursors on-screen position

When cursor is at middle of screen and i scroll down, the cursor moves upwards on the screen. I don't want it to do that. How can i scroll without changing cursors on-screen position? Solution, added after answer: noremap <C-k> 14j14<C-e> noremap <C-l> 14k14<C-y> ...

vim: is there a plugin to show all of your TODO tags in source?

Like most of you, I work in several source files of code every day. A lot of the time, my insane work flow has me doing stuff like: # TODO # clean up this code # do something else with this code Is there currently a vim plugin available that will search for TODO or a similar mnemonic and print a list of my current tasks that are on-go...

how to get :bwipe *.ext to wipe everyone matching the wildcard in vim

I often want to wipe all buffers loaded with a given extension (usually .rej files produced by patch). Just doing :bw[!] *.rej will complain if there is more than one match. Does anyone have any good tips? Currently I either repeatedly use :bw *.rej + tab-complete or, if there are a lot of buffers, use :ls and :bw a set of buffers by ...

vim: visual block select mode does not select the entire line

I have lines as below. I am not able to select the all the lines in full. How do i do it? I don't want to use visual line selection mode, because if i copy and paste in line selection maode, they won't start from the the same column ...

Prevent opening files inside NERDTree or MiniBuffExplorer

I find myself opening files inside the wrong window in Vim -- sometimes the NERDTree or MiniBuffExplorer -- and it's really throwing me off. I'm sure it's happening because my cursor is mistakenly focused inside one of these windows, but is there anything I can add to my vimrc to prevent this from happening? ...

Why does Y do the same thing as yy?

I've been using vim for several months now and I've gotten used to using C and D to change and delete everything from the cursor to the end of the line. Consider the line below where the cursor is on the 'b' in 'bar': foo.bar("hello world") Hitting D at this point will yield: foo. While hitting C will do the same plus start insert...

changing tabstop from 4 to 2 after using expandtab (with minimum manual effort)

For some time I have used tabstop=4 in my source files. Now that I write lot of javascript that has deep indentations, a tabstop of 4 seems wasteful, so I want to convert it to 2. The problem is I use "set expandtab" too. So merely setting tabstop=2, won't help. Any suggestions on how I can convert all my files quickly to tabstop 2? My...

How can I get vim to syntax fold "CHARACTER(len=*) FUNCTION" subprograms in Fortran source?

I have vim (version 7.2) performing nice syntax folding with :set foldmethod=syntax :let fortran_fold=1 However, I find that the default vim syntax file for Fortran isn't recognizing character functions that include a length attribute. For example. CHARACTER FUNCTION function_name folds just fine, but CHARACTER(len=*) FUNCTION fu...

mapping function keys in vim

I want to map my f2 for nerdtree with the following entry. map :NERDTreeToggle But even before that , and after saving the vimrc , whenever i press f2 , it jus switches the case of the letters on which the cursor is present. Later found out that any function key does it.f5 switches case of 5 characters and so on.Is this because of some ...

How not to give up on VIM?

Hi, I have started to do some programming using VIM. I have very mixed feelings so far. On one side I do love the idea, on the other - it is just hard to remember everything. So I took the approach of learning while actually doing some stuff (for Ruby on rails development). Unfortunately there is no chance in hell for me to be more pro...

Escape a double-quote in .vimrc

I'd want to add this mapping: map <C-K> "_dd How do I escape that double quote so it won't be interpreted as a comment? ...

Vim script: how to retrieve the timezone offset?

I would like to get the timezone offset of the user environment in a Vim script and that must be portable (Unix/linux/MacOSX, Windows). For example, if the user is in Paris, its timezone offset is currently +2 (UTC+2). Portability concerns exclude using external programs or non native scripting engines (Perl, Python, Ruby...). ...

vim indentation correction not working correctly

I'm using vim to edit files that use a programming language where the end of line is not marked with ;. This causes problems when I try to fix indentation in vim. If I put a ; at the end then vim is able to correctly fix the indentation, but since this programming language doesn't have a ; at the end of a statement the indentation isn't ...

how to make vim format source code correctly

I'm trying to use vim to edit source code for AutoHotkey. This is how the source code looks when correctly formatted: if foo { if bar = 1 callFunc1() if bar = 2 callFunc2() if bar = 3 callFunc3() } If I do =G, then this is what vim changes it to: if foo { if bar = 1 callFunc1() ...

Write Git commit message in new Vim window, then commit all within Vim

I have these Vim mappings for Git. Most of the commands below work, but the last one, gm, doesn't work at all. I want to open a new Vim (preferrably with my git commit message template already loaded, as per the default terminal behavior), edit and save my message, then commit. Any ideas for another way to approach this? " git shortc...

How can I use an Eclipse formatter profile in VIm?

My team has a standard Eclipse code formatter profile. I prefer to work with VIm. Is there any way I can convert this file and use it with VIm? ...

VIM better way to replace line from the first symbol

Hi, Having the code: [Test] public void ShouldDoSomethingMeaningFull() { Assert.Fail(); } I often need to overwrite the line (3) Assert.Fail();. What I currently do is this: Go to that line 3G. Select everything starting from first non-whitespace ^v$. Change it - c. The whole sequence is: 3G^v$c. While this works for me but ...

how do I make vim highlight any { not followed by either a C++ style comment, or two newlines?

I would like to create a match pattern for any opening brace that does not follow one of these patterns: A: {\n\n B: {\s*\/\/.*\n\(\s*\/\/.*\)\?\n The more general problem is highlighting violations of a coding spec at work, which enforces a blank line following { Clarification: I'm looking for this to catch code like the followin...

Mac terminal Vim will only use backspace when at the end of a line

I seem to have something odd with either my Mac 10.6 terminal or my .vimrc. When I type backspace on my laptop's keyboard, it only works when the cursor is at the end of the line. Trying to delete from within a line does nothing. MacVim operates normally. Google hasn't helped because I can't even figure out what to call this behavior. ...

Reuse last externally executed command in VIM

In VIM, I want to execute a command (like :!mkdir src/main/scala/xxx) Then, I want to also make a subdirectory of the just created directory. Can I have VIM retype the last used command and then I append the sub directory name to it (So I can have :!mkdir scr/main/scala/xxx/yyy without retyping the whole stuff). ...