vim

vim word completion navigating with 'j' and 'k'.

In vim, I use Ctrl-n to word complete while in insert mode. If there is more than one possible match, I get a dropdown from which I can select one of the possible matches using the arrow keys. However, I don't want to use the arrow keys; I want to use the 'j' and 'k' keys. But when I type 'j' or 'k', it inserts the letters instead of go...

how to set syntax=cpp for *.h files in vim

How do I make vim use syntax=cpp for *.h *.H *.C files? What line(s) should I add to vimrc? ...

Vim: Use shorter textwidth in comments and docstrings

From the mighty PEP 8: [P]lease limit all lines to a maximum of 79 characters. For flowing long blocks of text (docstrings or comments), limiting the length to 72 characters is recommended. When editing Python code in Vim, I set my textwidth to 79, and Vim automatically wraps long lines of Python code for me when I hit the charact...

Describe your customized Vim editor for Python/Django development?

I've recently switched entirely to Vim for all my Python/Django development. It took me a lot of time to customize it to the point it is today, and God knows how hard it was for me to find help regarding the best vim plugins out there suited for Python/Django development. I decided to ask this question so people like me could benefit di...

Vim's advance word broken in python, how do I fix this?

Vim works fine for all other languages, but word detection seems wonky in python. For example, in the following snippet, with the cursor on the 'h' in shutil, I would expect prssing the w key to advance me to the period, instead I get moved to the "'" in front of export. shutil.copytree(os.path.join('export', 'app'), os.path.join('expor...

project.vim and commands using the shift key

I'm trying to get up and running using project.vim but for some reason, none of the keybinding requiring a capital letter seem to be working. For example \C, which should create new project fold recursively, just acts like normal C, but \c operates as expected. Same thing with \R and \r. I'm using MacVim with Vim 7.3 (on a Mac, obvious...

Vim colorscheme change

I'm having difficulty getting my colorscheme to change. I've opened both ~/.vimrc and /usr/share/vim/vimrc and added: colorscheme desert ...and nothing. I noticed the color schemes are here: /usr/share/vim/vim72/colors/desert.vim (...along with a bunch or others) which seems like the wrong place so I: cp /usr/share/vim/vim72/color...

Is it possible to "extend" IntelliJ such that I can open the current file in VIM

Hi, I use IntelliJ for most of my Java programming, but every once in a while I need to make certain changes which are much easier done in VIM. Thus, the question: While I'm editing a file in IntelliJ, it is somehow possible to tell IntelliJ to start VIM with the same file that is currently under cursor. Thanks !! ...

Can't use macro more than once in gVIM

in gVim, I am trying to do q 2 dd j q Then @2 at several points later. It works the first time (meaning vim deletes three lines and moves down when I type @2), but anytime after that, my screen blinks and the cursor moves down once. Is there a setting I need in vimrc or something to allow this macro? ...

How to write a group of substitude (la->lb), (lb->lc), (lc->la) as a regular expression

I need to do it in vim (MacVim) and use it in one line. z.a2=cross(z.b, z.c)(z.b1, z.c1); became z.b2=cross(z.c, z.a)(z.c1, z.a1); Thank yo ...

Cscope unable to create inverted index. Why?

The following command works fine: $>cscope -b -R However, the option for inverted index does not work: $>cscope -b -q -k -R Input file specified two times. cscope: cannot create inverted index; ignoring -q option cscope: removed files ncscope.in.out and ncscope.po.out I googled this one and found some hits. But could not fin...

Ruby.vim indent fails with each..do leading with regex containing a hash ('#')

I'm editing Ruby code in Vim. There is a failure in the Ruby.vim indentation which is bugging me. Here is a block of code with correct indentation: text.scan(/#/).each do |match| line1 line2 end Here is how Ruby.vim indents the code: text.scan(/#/).each do |match| line1 line2 end All lines subsequent to line2 are inden...

Open a file in a tab in vim in readonly mode

I'm aware of opening files in readonly mode from shell using vim -R, but how to open a file from inside vim in a separate tab (:tabe <filename>) in readonly mode? Thanks for your time. ...

vim - Some folds are not being saved.

Why do some folds in vim are saved some not while some are being saved? I have the following in my .vimrc: autocmd BufWinLeave *.* mkview autocmd BufWinEnter *.* silent loadview Example: I make these 2 folds in a file: +-- 2 lines: if(!bRet)---------------------------... return bRet; } +----------- 5 lines: else---------...

Named searches in Vim?

Is there a way to save a search pattern to a register and then conjure it up with some quick command? I'm thinking of the way vim uses named registers with q and @, and named marks with m and '. ...

columnar cursor motions in vim?

I'm wondering if there's a command in Vim I'm missing that does columnar motion. What I'm thinking of is common in some spreadsheets, where there's a key combination that will take you downward in the column to either the next blank cell, or if you're in a blank cell then it will take you to the next non-blank cell. Some text may illus...

How can I get context dependent syntax coloring for the same keyword in Vim?

I am creating a vim syntax file for a niche language that has no syntax file yet. The language has the following syntax when setting up a simple function. foo(parameter) if parameter then print("yes") else print("no") end end I want the end that is paired with the if to have the syntax coloring for condition...

xml.vim does not close tag for html automatically

When editing xml, xml.vim works great for tag close. But when editing html, it does not work. Vim version is 7.3 ...

How can I see the file or directory named passed to Vim from the command line?

I'd like to set up my .vimrc so that NERDTree is open whenever vim (or MacVim) is called from the command line with a directory argument, but closed when vim is called with a file argument. I looked through the list of vim's built-in variables but couldn't find anything that looked promising. ...

What is the best way to do smooth scrolling in vim?

The main scrolling commands in VIM are: 1. Ctrl-B and Ctrl-F, as well as PageUp and PageDown scroll by full page 2. Ctrl-U and Ctrl-D scroll half a page by default 3. Ctrl-Y and Ctrl-E scroll one line I lose visual context every time for the former two, so I have developed the bad habit of hitting the latter (Ctrl-Y and Ctrl-E) repetiti...