vim

Interactive search/replace regex in vim?

I know regex for doing a global replace, %s/old/new/g how do you go about doing an interactive search replace in vim ...

How do I fix the indentation of an entire file in Vi?

In Vim, what is the command to correct the indentation of all the lines? Often times I'll copy and paste code into a remote terminal and have the whole thing messed up. I want to fix this in one fell swoop. ...

How can you list the matches of Vim's search?

I would like to list the matches, when I hit: /example so that I see where all matches are at once. ...

How do I close all open tabs in VIM at once?

If I have 10 tabs opened, I have to close each one using ":q" separately. How can I close them all at once? ...

Ctrl+Space for omni and keyword completion in vim

I Want to use Ctrl+Space for omni-completion (and keyword completion if there is no omni-completion) in vim. I've tried this which I found somewhere on the web: inoremap <expr> <c-space> pumvisible() ? "\<C-n>" : "\<C-x>\<C-o>\<C-n>\<C-p>\<C-r>=pumvisible() ? \"\\<Down>\" : \"\\<CR>\"" however it's not working. Anyone who is using Ctr...

How to write Vim foldexpr for xdebug trace files with memdeltas

I know nothing about Vim expressions. I have a vim foldexpr that comes with a syntax file for xdebug trace files. The existing expression looks like this: foldexpr=strlen(substitute(substitute(substitute(substitute(getline(v:lnum),'^TR.*$','',''),'\\s>=>','->',\"g\"),'^\\s.\\{20\\}\\(\\s\\+\\)\\?->.*$','\\1',''),'\\s\\s','\',\"g\"))-2 ...

Make Vim completion work more like in Visual Studio

I want Vim's completion menu to work more like the one in Visual Studio. I want to be able to write the start of a variable (or something which completion is available), hit the omni-completion keys and get the completion menu. Now I want the completion menu to highlight the best match but not add it to the buffer. Now I want to be able ...

Is there a Vim equivalent to the Linux/Unix "fold" command?

I realize there's a way in Vim to hide/fold lines, but what I'm looking for is a way to select a block of text and have Vim wrap lines at or near column 80. Mostly I want to use this on comments in situations where I'm adding some text to an existing comment that pushes it over 80 characters. It would also be nice if it could insert ...

Vim:embedded syntax highligting

I have a custom xml file format which can contain blocks of code within certain tags. For example: <Root> <Sql> select * from foo </Sql> <MoreJunk> ... </MoreJunk> <Python><![CDATA[ def Bar(*args): return False ]]></Python> </Root> How can I get vim to use sql syntax highlighting for the text inside <Sql> ...

What is your favorite colorscheme FOR PROGRAMMING in Vim?

I think this is a relevant question for programmers and I'd like to hear other people's answers because some syntax highlighting color schemes are better on the eyes than others. This can affect productivity as much as ergonomic keyboards or anything else on here. It's about comfort and productivity. So, I'm curious. Do you find some ...

How can I share my folds in VIM?

I am in a project with 3 people. We need to have the same folds in Vim for each member. How can I share my folds? [Feedback] I understood one important thing: Google ignores signs, such as {{{, so please google "VIM three braces" to find help about the marker-method. It becomes much easier to practise, as you can quickly find relevant...

How do I make vim do normal (bash like) tab completion for file names?

When I'm opening a new file in vim and I use tab completion, it completes the whole file name instead of doing the partial match like bash does. Is there an option to make this file name tab completion work more like bash? ...

Is there a way to paste something at the end of a line?

Is there a way to paste something at the end of a line? ...

VIM changed behaviour on me - jump to line : is broken

Smething just happened in the last 20 minutes or so to my vim. I must have hit something, but I can't figure it out, and nothing will get it back to the 'real' behaviour. I've always used : to jump to a line number. Now, when I hit : then a number - (1-9), vim instead goes in to "insert" mode and inserts a letter. (1=q, 2=r, 3=s, 4=t...

Editor core buffer type and syntax highlighting

I've been thinking a lot about making an editor core functionality wise compatible to vim, similar to yzis. The biggest questions are what buffer type to use. Requirement are: possibility to implement fast syntax highlighting, regex on top of it. possibility to implement multiple syntax highlightings in a single file. similar to text...

How do you enable word wrap in vim when printing

I wanted to print a simple text document and make sure words wrap on word boundaries. I tried both set linebreak and set wrap but when printing, it just breaks on the right column in the middle of words. Is this possible for printing? ...

Bytecode Vs. Interpreted

I remember a professor once saying that interpreted code was about 10 times slower than compiled. What's the speed difference between interpreted and bytecode? (assuming that the bytecode isn't JIT compiled) I ask because some folks have been kicking around the idea of compiling vim script into bytecode and I just wonder what kind of pe...

What's your favorite Vim customization?

What's your favorite thing about vim? I personally enjoy omnicompletion, cscope integration, and ctags all working together. ...

How to prevent Vim indenting wrapped text in parentheses

This has bugged me for a long time, and try as I might I can't find a way round it. When I'm editing text (specifically latex, but that doesn't matter) files, I want it to auto-wrap at 80 columns. It does this, except if I happen to be in the middle of a parenthetical clause, it indents the text which is very annoying. For example, this...

redirection to a file of a search in Vim

Hello, My problem is simple. I search a specific pattern in a file (let's say label in a Tex file) :g/label/# but there are lots of ocurrences. So I'd like to redirect this output to another file to be able to work easily with it. Do you have a trick or a command that I don't know? Thanks ...