vim

Is it possible to format C++ code with VIM?

Hi, I am rather new to VIM. I got some source code and this is a mess. At a first sight I would like at least to get a clear and organised view of the code, so I like to get it rightly formatted, I mean indented depending on the depth of the functions and so. I wonder if it can be done with VIM, and otherwise which other commandline t...

Invert regexp in vim

There's a few "how do I invert a regexp" questions here on stackoverflow, but I can't find one for vim (if it does exist, by goggle-fu is lacking today). In essence I want to match all non-printable characters and delete them. I could write a short script, or drop to a shell and use tr or something similar to delete, but a vim solution...

VIM Search/Replace spaces between 2 brackets or columns

Given the following line: [aaaa bbbb cccc dddd] [decimal](18, 0) NULL, How would you replace the spaces only between the first set of brackets in Vim? What would the /s command look like? Update: This is the intend outcome [aaaa_bbbb_cccc_dddd] [decimal](18, 0) NULL, ...

get bash history to vi

When I try to read bash history into vim, I get nothing. :r !history If I just execute the command, i.e. :!history instead of history I get a snapshot of my terminal as it looked before I started vim. How can I read the output of "history" into vim? Reading the contents of .bash_history won't do as I save history with timestamps: ...

Turning off auto indent when pasting text into vim

Unfortunately, I am not an experienced vim user. But, I am making the effort to learn it. When I paste code into my document from the clipboard, I get extra spaces at the start of each new line: line line line I know you can turn off auto indent but mine doesn't seem to work because I have some other settings conflicting or so...

VIM Quick Reference

I'm just re-learning VIM after a many year hiatus. Can anyone recommend a good one page, printable quick-reference? ...

Pass Vim buffer variable as an argument for external command

The problem is that I need to pass include paths to the C++ compiler. I can define them for each buffer, like: :let b:COMPILER_OPTIONS='-ggdb -I"E:\boost_1_42_0\boost\"' But how do I expand b:COMPILER_OPTIONS on the command line ? :!g++ program.cpp eval('b:COMPILER_OPTIONS') doesn't work. Or, if this isn't possible, what other way...

How to make FuzzyFinder pluggin open files in a new graphical tab in MacVim?

When I use FuzzyFinder plugin to open a new file in MacVim, it opens the new file at the same tab in a new buffer. How to tell FuzzyFinder to open thoses files in a new MacVim tab? ...

Indentation annoyance with CSS in Vim

I've moved from TextMate to Vim lately, and am really liking the switch. However, I have an itch regarding the way Vim handles indentation within curly braces using the CSS syntax. I use simple_pairs.vim, which may or may not have something to do with my problem, but I don't think so, as things work fine in PHP, JavaScript, etc. Let me e...

Append one range of lines to the end of another range of lines

Here is an example buffer in vim: fooooo bar pippy one two three And here is what I would like to produce: foooooone bartwo pippythree Ideally by specifying the two ranges of line numbers, but a sequence of commands would also be great. ...

Very unusual and weird problem with gVim 7.2

After installing gVim and running gvim from the run window, if I were to type :cd followed by a tab, I will get \AppData, \Application Data, etc. Which basically means I'm at my $HOME directory (C:\Users\Fabian). The weird thing is I do not have a \Application Data folder there. But if I were to run gvim.exe from its installation folder...

Removing a line from the buffer in a vim script

According to http://vimdoc.sourceforge.net/htmldoc/usr_41.html#function-list vim script has functions setline() and append() to modify the current buffer but how do i delete a line from within a script? With setline(1, "") the line is only emptied but I want to get rid of it. ...

How do I increase the spacing of the line number margin in vim?

I have a problem with my colorscheme in vim: The line numbers are too close to the code. How I can increase the width of the line numbers' right margin? ...

Vim - ab for each language

I try to write :ab in Vim for faster coding but the question is can I write ab for each language . Like in HTML : I write begincode : I'll be HTML DOC TYPE in C++ : It'll be int main () { return 1; }; I'm a new beginner in Vim and I miss intellisense in visual studio, can I have it in Vim . I mean not only for C++, but another langua...

Is vim able to detect the natural language of a file, then load the correct dictionary ?

I am using several languages, and currently I am obliged to indicate to vim with which of these the spell check must be done. Is there a way to set up vim so that it automatically detects the correct one? I vaguely remember that in a previous version of vim, when the spell check was not integrated, the vimspell script made this possible....

Working with two editor paradigms

I currently work with both Visual Studio, Eclipse/Rad, and Vim heavily. Visual Studio and Eclipse don't present any problems because they're the same paradigm. However vim (which I use for my *nix work) muddles the issue because it's modal. I actually like the modal nature of vim and find myself trying to type esc k k in Visual Studio...

How do I bind 'jk' to Esc key in Vi-Mode in tcsh shell

I love and use vim daily on tcsh. I love everything about vim. And one of the reasons why I love it so much is I dont have to lift my hands to do stuff. I have jk mapped to Esc key in vim. But unfortunately, I cant get the same thing on tcsh shell. Can someone help me bindkey jk to Esc on tcsh ? Also please guide me to tcsh and vi-mode...

Vim: Call an ex command (set) from function?

Drawing a blank on this, and google was not helpful. Want to make a function like this: function JakPaste() let tmp = :set paste? if tmp == "paste" set nopaste else set paste endif endfunction map <F2> :call JakPaste()<CR> However this does not work. I have isolated t...

How to restrict operations to certain lines?

I have to work on some relatively huge code files in vim. How do I restrict some operations like find-next normal-n and others to a certain function / block? How would I visually know if I'm within that block or outside it? Looking and line numbers seems awkward, specially that the line numbers I need to work with are generally 5 digi...

Turn off the highlight feature in the Limp

Hi all I am using the Limp in my VIM. But there is a problem, when the cursor move to a "(" or ")", it would highlight a block of code in this pair.I can not see the code clearly. Is there any way to turn off or delete this feature? Best Regards, ...