vim

In vim, how to write a partial line to a file?

I want to use vim to write a part of my file to another file. For example, I have the following file: This is line 1 and this is the next line I want my output file to read: line 1 and this is I know how to use vi to write a range of lines to a file: :20,22 w partial.txt An alternative is to visually select th...

Vim Script to hightlight end of a tag like braces

I need a Vim script to highlight end of a tag when cursor is at the beginning of the tag. For example in html tags, when cursor is in start of tag, it should highlight the end of the tag. The interface should be generic, so that more tags can be added ...

How to configure Vim for C++ development?

I'm learning C++ using Vim as editor on Windows XP, however I found issue that I have list below. I have downloaded and installed c.vim and it essential file, however when I start vim it show message C/C++ template file 'C:\Program Files\Vim\vimfiles\c-support/templates/Templates' does not exist or is not readable, I want to know how t...

How do I redirect output into Gvim as a list of files to be opened?

I would like findstr /m background *.vim | gvim to open all *.vim files containing background in a single instance of gvim - but I can't get the piping to work. This is very similar to this question but instead of capturing the stdin output I would like GViM to treat the output as a list of files to be opened - and on a dos system so x...

VIM Marks and Project Management

So I've been using NERDTree in vim as it adds great functionality being able to browse around the file system. And with the Bookmarks capabilities it works great for switching between projects. However, I've started using Marks more and more in vim and wanted to know if anyone knew of a plugin that allowed you to have sets of marks. L...

vimdiff as a merge tool

vimdiff helps in showing the diff of two files graphically and allows us to pick the changes from left to right/right to left. The files I am dealing with are huge files and most of the differences vimdiff reports can be auto-merged except a few.As it takes lot of time to go diff by diff in vimdiff and take the action. I would like to k...

Reading the result of an exe file in :vs in vim

Many of my programs are console like applications, which take a data file, and print out the results, either on screen (more often) or in another file. Since these days I'm doing some analysis which requires a lot of little tempting with one input data file, just to get a few numbers, I usually go: edit data file, start program, get res...

vim settings in erb file

how can i apply vim settings to erb file?? like /* tabstop=4 shiftwidth=4 foldmethod=indent */ seems like <% # xxx %> # xxxx <!-- xxx --> didn't work ...

How to compile a single file with maven?

I set up a working maven project with mvn archetype:create ... I can compile all the sources with mvn compile but I want to be able to compile also a single file at time. There is a way to ask maven to compile an arbitrary single .java file? Thanks Updates 1: I would specify the single file on the command line. I would choose the fil...

Vim: How to manually load an ftplugin after startup?

Say I load a .txt file into Vim. Then I want to change the filetype=html but I also want an associated ftplugin loaded. How can I do this? I've tried stuff like: :set filetype plugin on and :set filtype plugin_name on and also :filetype plugin_name on etc etc., but I can't seem to manually load the ftplugin. Any suggestions? I've tried...

Keep :highlight when using :tabedit in vim

I use vim. I have a requirement to use 80 or fewer columns. This fix from http://stackoverflow.com/questions/235439/vim-80-column-layout-concerns works great: highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.*/ The first file I open looks fine. But when I :tabedit some/other/file some/other/file ...

vim - indentation of C++ constructor initialization list problem

I'm using vim 7.0. I want the following code be indented in the following way (initialization list in the same indentation as constructor): A::A() : a1(10), a2(10), a3(10) { } According to vim help this can be done by setting: set cino+=i0 But this setting yields (only a1 is indented correctly): A::A() : a1(10), a...

Auto-open NERDTree in "EVERY" tab

Is it possible to open NERDTree in every tab with pressing 't' or 'T' in NERDTree, if yes How? Thnks in Advance :-) ...

Edit file name with vim

Is there a way to edit file names with vim using Explorer or NERDtree? ...

What should go in my ~/.vimrc file? (tab-related question)

I would like tabs in my source code to remain tabs (8 spaces wide), NOT to be converted to spaces, but displayed as 2 spaces. I recall vim being able to accomplish this. Could anyone help me a little? ...

When to use :abbr vs. :map in vi/vim.

The abbreviation and map commands both appear to give the user redundant functionality. :imap teh the seems to get the same job done as :iabbr teh the. I tend to make all my settings in :map commands of various types- everything from typo fixes to script-like one-liners. Is there a real difference between maps and abbreviations? Which ...

How to add find-previous in xdvi or findPrevious in xpdf for vi keybindings?

Is there a way to add a find-previous function in xdvi or a findPrevious function in xpdf? Those would be equivalent to a function that brings up the search dialog with the "Search backwards" option already checked. I need such functions in order to define keybindings bind ? any findPrevious in my .xpdfrc and xdvi.mainTranslations: ...

Recompile Vim for pythoncomplete#Complete on modules *other* than standard library?

I like using pythoncomplete#Complete for Vim omnicompletion, but it doesn't work for Python modules other than the standard library. Is there a way to re-compile Vim so that this will work on non-standard library modules? I have tried pysmell, et. al., but they just don't work as well as pythoncomplete#Complete. This is for a Windows...

if match(g:possibilities, "using backreferences after the regex in vim\(script\)?")

I'd like to be able to, say, check the value of $1 inside the if block, to get the first backreference. However vimscript is not perl. Is there some way to do this? I'm aware of the possibility of using \1, \2, etc., inside the regex, but I'd like to match and then use the values in subsequent statements, as is possible in perl, php, ...

vi command line equivalent to CTRL-] ?

Hi all ! I'm trying to map my own shortcuts in vi. I want to be able to open a splitted window containing the declaration of the function I'm calling the shortcut on. something like this in my vimrc: nmap <unique> <silent> <Leader>tg :exe 'vsplit'\| equivalent of <C-]> but what's the equivalent of C-] in command mode ? ...