vim

Adding background image in vim

Is their any way to add background image in VIM. like, :set background=dark I don't know is is possible or not. If you know any way to do this tell me. Thanks..... ...

How to recall search pattern when writing replace regex pattern in Vim?

Here's the scenario: I've got a big file filled with all sorts of eclectic rubbish that I want to regex. I fiddle around and come up with a perfect search pattern by using the / command and seeing what it highlights. Now I want to use that pattern to replace with. So, I start typing :%s/ and I cannot recall what the pattern was. Is ther...

how to detect lines of code with regex in VIM

Hi, I have so many println("") in my codes .. I know it is messy ... I want to put comment for each of the println(""); how to do that in VIM ? I mean I want to do that on multiple files. Also if possible, can it detect whether the lines has // already or not ... if the lines has been commented .. I don't want to add new // ...

How to save a Vim macro that contains "Escape" key presses?

I use the following Vim macro a lot (it puts the current line inside tags): I<e>^[A</e> So I saved it into my .vimrc let @e='I<e>^[A</e>' But it does not work. The ^[ part means Escape but it is not understood as such when using .vimrc How can I save this macro, or any macro that contains "Escape" ? ...

Changing Case in Vim

Is there a command in Vim that changes the case of the selected text? ...

vim - save file with new filename: append to existing filename

Is there a simple way to (in VIM) do save the currently open file with it's current name plus an appended phrase? IE, from /home/affert/ type vim /data/folder/file1.txt then save the file as /data/folder/file1.txt_BACKUP without needing to copy and paste the filename? Context: I have a file that has full paths in it to other files i...

How to make Vim's global command :g/ work on per occurrence basis.

Typically Vim's global command :g// works on per line basis. Is it possible to make it work on per occurrence basis as there could be more than one occurrence on a line. ...

How to auto-create a makefile in the same directory as i create a Latex file?

When I create a .tex file using vim I get a nice template from having autocmd BufNewFile *.tex 0r $HOME/.vim/templates/skeleton.tex in my .vimrc. I also have a makefile-template in my home directory, but this one I have to manually copy to where the .tex file is. In a Linux environment, how can I auto-copy or auto-generate the makefil...

Vimscript: how to get the current list of user-defined functions and determine the files they are sourced from.

Hello everyone. Is there a way I can query from within Vim information about user-defined vimscript functions and script files that Vim knows about? The things I'd like to know are: Is a particular function defined? Which source file is a given function defined in? What are the vimscript files that have been sourced? Etc. ...

Best of both worlds: arrow keys for cursor movement or flipping through buffers.

I really like this vim trick to use the left and right arrows to flip between buffers: "left/right arrows to switch buffers in normal mode map <right> :bn<cr> map <left> :bp<cr> (Put that in ~/.vimrc) But sometimes I'm munching on a sandwich or something when scrolling around a file and I really want the arrow keys to work normally. ...

Vim question : swap 2 distant lines in one move

Hello, (NB : my first post) In a Vim file, how may I swap - in one move - line 15 and line 33 (e.g.) ? Thanks in advance ThG ...

Alternatives to Ctags/Cscope with Objective-c?

Are there any alternatives to ctags and cscope with Objective-c support. This does pertain to cocoa development, so inevitably it seems I will be using Xcode (and probably should). I was just wondering what are my Vim options. Maybe there is some type of plugin system like eclim, but for xcode? EDIT So it seems that other than upda...

Vim: return to command mode when focus is lost

I like my vim to get itself into command mode as often as possible. I think losing focus would be a good event to make that happen. Everything I found is for saving on lost focus. I'd like it to auto-return to cmd mode when switching tabs in macvim or when cmd+tabbing to another app. ...

Vim: restricting methods shown by omnicomplete to those present in ctags

I'm editing a simple PHP file with a class which has a few methods, if $bar is an instance of this class and I type $bar->ctrlxctrlo I get a popup with a lot of methods (builtin ones) in addition to those of my class and present in the ctags list. How can avoid showing all those external methods and just keep the ones defined in my cla...

foldmethod=indent gets confused

Normally a great boon to humanity, on occasion vim's indent-based folding will get confused and need a reset via :set foldmethod=indent. Symptoms include the appearance of consecutive folded lines in the window. Is there a way to avoid having this happen? Is it just me? update Although I'm pretty sure at this point that I've ID'd a ...

How can I pare down Vim's buffer list to only include active buffers

How can I pare down my buffer list to only include buffers that are currently open in a window/tab? When I've been running Vim for a long time, the list of buffers revealed by the :ls command is too large to work with. Ideally, I would like to delete all of the buffers which are not currently visible in a tab or window by running a cust...

vim regex for replacing spaces within quotes

I have text in the follwing format: ERR_OUT_OF_MEM, "ERR OUT OF MEM" ERR_SOMETHING_BAD, "ERR SOMETHING BAD" I want to replace all spaces in the text which are within quotes with underscores: ERR_OUT_OF_MEM, "ERR_OUT_OF_MEM" ERR_SOMETHING_BAD, "ERR_SOMETHING_BAD" The best regex I could come up with is: \("\w\+\)\@<= (there's a...

How to set default vim colorscheme

Okay, bit of a noobish one here. The latest upgrade of Ubuntu made my vim colorscheme unusable. I know how to set it manually (:colo evening, for example), but I want to set the default for all vim sessions. I see reference in other places to .vimrc, but the right location and syntax have eluded me thus far. Thanks! ...

Is there a C++0x syntax file for vim?

In particular, the display of initialization lists is really bad: vector<int> v({1,2,3}); will highlight the curly braces in red (denoting an error.) ...

vim cant map <C-Tab> to :tabnext

I have the following mappings in my .vimrc: map <C-S-Tab> :tabprevious<CR> nmap <C-S-Tab> :tabprevious<CR> imap <C-S-Tab> <Esc>:tabprevious<CR>i map <C-Tab> :tabnext<CR> nmap <C-Tab> :tabnext<CR> imap <C-Tab> <Esc>:tabnext<CR>i I want to switch the tabs with Strg+Tab forward and with Strg+Shift+Tab backward. Why does this mapping not...