vim

How can I set my VIM color scheme to the same default color scheme in Visual Studio?

Very new to VIM so any explanation on how to configure would be very appreciated. ...

Is it possible to set the cursor at the end of the string found ?

I'm using VIM 7.1 When I search a string in file, the cursor is moved to the beginning of the string found in the text. Can the cursor be moved at the end instead of the start of the string ? String where I'm looking for the search I want cursor at the g of king when I look for king I tried to go to previous result :N I tried to...

Vimdiff multiple windows different read/write permission

I am opening 3 windows using vimdiff with file1, file2 and file3.. I would like to have file3 be in edit mode, and file1 and file2 to be in read only mode. Is this possible? This is my command... vimdiff -R file1 file2 -c :topleft sp file3 Thanks, Tom ...

NERDTree and buffer handling

Hi, I've setup an "IDE" based on VIM and NERDTree for programming using FreePascal. Overall, it's working great, but I can't find how to tell NERDTree to change it's default behavior regarding VIM buffers. Currently, every time I open a file in NERDTree, it creates a new buffer. If the file is already open in another buffer, it could be...

Replacing quote marks around strings in Vim?

I have something akin to <Foobar Name='Hello There'/> and need to change the single quotation marks to double quotation marks. I tried :s/\'.*\'/\"\0\" but it ended up producing <Foobar Name="'Hello There'"/>. Replacing the \0 with \1 only produced a blank string inside the double quotes - is there some special syntax I'm missing that I ...

How can I get the file I have open in vim to display in my iTerm tab

I can get the vim title to display on my window by doing this: let &titlestring = expand("%:t") . " @ " . hostname() if &term == "screen" set t_ts=^[k set t_fs=^[\ endif if &term == "screen" || &term == "xterm" set title endif But the tabs will say "Default". From the commandline I can do this: echo -ne "\e]1;hello world\a" A...

Rearrange tabs with the mouse in gvim

Is there any way in gvim to rearrange tabs by dragging and dropping them with the mouse? This is behavior I love in Firefox and Chrome. I know you can do :tabm n but that requires figuring out exactly how many tabs in you'd like to move to. Using the mouse would be more useful for this spatial task. Any methods to move tabs left/right ...

Is there a way to get basic PHP error underlining in VIM?

I really like VIM but one thing I cannot do without is simple error underlying like in netbeans and Visual Studio. I often make silly mistakes like if checkit($url) { } instead of if (checkit($url)) { } The little squiggly red underline is a lifesaver when it comes to stuff like that. Is there a plugin for VIM that wi...

vim:confirm before closing multiple tabs

I often unintentionaly quit vim using :qa while open many files in different tabs. I wonder if there is any way to have something like a confirmation line showing before closing multiple tabs and quit. Thanks! ...

Vim updating currently viewed file

Im just curious if im viewing a file e.g. x.log which is currently being updated ie a log file. Is there a way to effectively refresh it rather than :q and vim x.log it again ? ...

unix shell script to remove blank lines following opening brackets

Hi all, I need a (sed, awk) shell script or, even better, a vim command to remove any blank lines following a line with a single opening curly bracket: void func() { foo(); } void bar() { helloWorld(); } should become: void func() { foo(); } void bar() { helloWorld(); } Any thoughts? ...

how to jump to the beginning of a function body in vim

As title, if I'm in the middle of function body and the function body is very long, how can I jump back to the beginning of the function body . ...

How to make Vim return from insert mode to normal mode after a command is finished?

When Vim is in Insert mode and you press Ctrl-O it switches to normal mode for one command, then switches back to insert mode when the command is finished. Is there the opposite command? To switch to insert mode for typing a word (or a number of letters or a line), then switch it back to normal mode when the typing is finished? ...

vim command after cd

I want to execute a command automatically after cd'ing to a new directory from within vim. For example, I open gvim and run: :cd ~/src/player I would like vim at this point to automatically source a file that is in that directory. Is this possible? ...

How can I search and replace throughout a dir recursively in Vim?

I found out about Vim's substitute command... :%s/replaceme/replacement/gi And vimgrep... :vimgrep /findme/gj project/**/*.rb Is there a way to combine them in order to do a replacement across all the files under a dir? ...

Switch to last-active tab in VIM

In Vim, is there a way to quickly toggle between the current tab and the last active tab? Sort of the way '' toggles between the current line and the last active line. Plugins / keyboard mappings / voodoo all acceptable. ...

How to survive the transition from tabbed-based to buffer-based coding (Vim).

I recently changed from notepad++ to Vim. In notepad++ I used to be aware of my open files by seeing them as tabs, so when I wanted to close or change them I just pressed Shit-Tab or Ctrl-W. In Vim there are also tabs, but when I use them I feel like I'm just going back to my notepad++ way of managing my files. Is there a good way of lis...

How to have multiples matches for a snippet in Vim's snipMate plugin (with a dropdown menu).

snipmates expands div as <div id = " "> . I want snipmate to show a dropdown menu where I can choose between div id ="" and div class="" (after creating the second one). The documentation says: snippet trigger A description of snippet #1 expand this text snippet trigger A description of snippet #2 expand THIS text! but this e...

Besides F1, F2, F3, (Ctrl + Fs and so on), which are good (available) keys to create custom commands on Vim?

Besides F1, F2, F3, (Ctrl + Fs and so on), which are good (available) keys to create custom commands on Vim? Some plugins use , and \. For instance, \be and ,cc. Which are other good available keys to create custom commands on Vim? ...

Vim: moving the cursor to a string in a source file without error messages if it doesn't exist

When I use vi to open a file *.c, I would like the cursor to move to the string "main" automatically. If there is no "main", I want the cursor to go to "void" without an error prompt. In my .vimrc I have set :autocmd BufRead *.c 1;/main but this cannot implement all my requirements. Specifically, if there exists no "main" in some ...