vim

In Vim: How do I delete a word and go into insert mode?

In normal mode, I can hit "ce", which deletes the rest of the current word and goes to insert mode. I want to delete the entire word, regardless of the cursor position (within the word of course) Follow up question: How can I replace the current word with whatever's in the default register? ...

How do you replace a word occurring on consecutive lines?

I usually either end up using [range]%s/word/another_word/gc or do it manually. I wonder if you guys use a different, perhaps a faster, way. Assume that I have vim 7.2. ...

Perfoming Vim substitue on a partial line

Hi, we can perform vim substitute on a set of lines by selecting them in visual mode and entering command mode. it auto populates the selected range :'<,'> and we can perform substitute like :'<,'>s/TestSubstitute//gc I would like to know is it possible in vim to perform substitute command on a partial line selected in visual mode, so...

vim edit multiple locations simultaneously

In certain text editors like e, you can select multiple locations and as you type, all the selected locations get replaced with the characters you are typing. For example let's say you have <tag1 class=""></tag1> <tag2><tag3 class=""></tag3></tag2> In e, you could just select two locations (inside sets of quotations marks), then st...

VIM: Linux/Ubuntu directory location ~/.vim/syntax/

Where is the default location for the folder ~/.vim/syntax/ on a linux system? I am trying to add a python addon. Thanks. ...

VIM Restore last search pattern

I remapped [[ and ]] to find the previous and next pattern in the file. The mappings are as follows: nmap [[ ?^.section <CR> nmap ]] /?section /<CR> The issue is that when I use any of them, I "loose" the current search pattern, so when doing n for the next match, I search for the next "section". Is there a way to restore the search...

Vim LocateFile Plugin with fastfind

I built a fastfind database as mentioned in the following link as mentioned in the Unix Power Tools book. FastFind db is nothing but a file which contains a list of files in my project and I wrote a script to search the list for faster lookup. Now, I would like to integrate this script with lookupfile plugin. From the lookupfile plugin...

Specifying width for :vsplit in vim

Is there any way to specify a width when doing :vsplit? Also, is there a way to increase or decrease the width on a vertically splitted window? Ctrl-w + and Ctrl-w - seems to be working on only horizontally split windows. ...

Vim using last searched for regex in :s command

I am using slash for searching for stuff within vim. I'd like to use the regex that I used for search in a command (a substitute command to be exact). Is there a simple way to do it? ...

Search in :normal vim command misbehaves

This popped-up while writing a script for vim. Using the well-documented ':normal' command: :normal /abc does not search for the string abc. Instead, the previous search string is still active (i.e highlighted, jumped to with n, etc.). Even stranger: the abc appears as the newest pattern in the / history (i.e. hitting / and then ...

vim copy command to clipboard / buffer

How to copy the ex command to the clipboard or paste it to the buffer? Using gvim on Windows. ...

Configuring variable-width tab spacing in Vim

I sometimes want Vim to read tab-formatted files where the most reasonable formatting implies a non-uniform tab width. In other words, I want a tab stop at positions: 5, 30, 50, 60, 70, 80 How can I do this in Vim? ...

Vim errorformat / efm for PL/SQL

Im trying to get the standard vim :clist, :cope functionality working with vim. Specifically, I'm trying (and failing) to capture the filename from the compiler output. I have the PL/SQL code compiling okay (well, when there is no errors =), and I've got errorformat picking up the error messages, line numbers and column numbers, but I...

vim syntax highlighting else: for python

I'm getting annoyed with the default python syntax highlighting in vim. it does not highlight the else: statement correctly. vim only highlights the else statement if i have some white space between the "else" and the colon ":" so this works: "else :" but "else:" does not. It must be easy to fix.. I'm using vim 7.2 ...

scope vs ctags in terms of features

I am a big fan of ctags Hence I am wondering if I have cscope, will I benefit more there two programs. Seems like the latter has the same features as ctags, namely, facilitating the finding of symbols. What are the features scope offers that can further increase my productivity with VIM? Thanks ...

Change Vim command to work in MS-Windows? Use make to check python syntax

:make provides a list of errors which can be navigated through in order to fix. The problem is that this script only works in Unix based OSes. autocmd BufRead *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\" autocmd BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%....

vim - don't save backups if in svn working copy?

I like that vim automatically saves backup files, but it is annoying when I use vim to edit a file that is in a svn working copy, since the files are already "backed up", and it creates clutter. How do I configure vim to only save backups when I am editing a file that is NOT in a svn working copy? ...

Can I rectrict vim/gvim to use only tabs as line start character?

I want to use only tabs without space \t\t...\tdef not \t \tdef or \t\t def ...

VIM: how to compute the number of times word appeared in a file or in some range

Sometimes, I want to see how many times a certain function is called in a file or a code block. How do you do that? I am using vi 7.2. I presume you have to use !wc or some such. Thanks ...

GVIM and multiple programming languages

My day job involves coding with Perl. At home I play around with Python and Erlang. For Perl I want to indent my code with two spaces. Where as for Python the standard is 4. Also I have some key bindings to open function declarations which I would like to use with all programming languages. How can this be achieved in GVIM? As in, is the...