FAQ Database Discussion Community

## Different color schemes on vim

vim,fortran
In my lab, I can either work directly on my work station or on some server that is made available to us. On both my accounts, I have the same .bashrc and .vimrc files. Now looking at the picture below, you can see that there is some minor difference about...

## neovim colors not “just working”

vim,vim-syntax-highlighting,neovim
I have some simple (default) syntax highlighting, and other colors, in my regular vim. I'd like to try out neovim, so I did the cd && ln -s .vimrc .nvimrc && ln -s .vim .nvim I'm currently on ubuntu, and installed neovim from the ppa at: https://launchpad.net/~neovim-ppa (I can paste...

## Assigning save (:w) to w in vim

vim
I want to be able to save a file in vim while in the insert mode. I thought of using the following shortcut: inoremap <leader>w <Esc>:w<cr> While the shortcut saves the file in the insert mode, it leaves the cursor one spot ahead of where the cursor would be if...

## Replacing a string with empty line

vim,sed,vi
I have a file which has 2000 lines of data (file name is data.tsv). I want to replace the string with empty line where there is a matching pattern, in my case is PMC: How can I do with Vim or other sed command? Thanks, Rio ...

## How to set a portion of the status line a certain color only if an element is evaluated- Vim

vim
In Vim I'm trying to make my status-line to work how I want it to. Here's what I'm going for: When the file I'm editing has been saved, I want it to look like this when saved: And this when unsaved: The former I see, but I get this when...

## VIM - Reformatting indentation and braces

vim,coding-style,vim-plugin
When working with blocks of code in VIM, I'm able to easily re-indent blocks of code via selecting a region in visual mode (SHIFT+v), then just hit =. This re-tabs lines of code, uses the correct indentation depths, hard-tabs vs spaces, etc. I have a large set of functions I...

## How to map a key in command-line mode but not in search mode

vim
I want to map a key in VIM in command-line mode but not in search mode(with a leading /), like below: Map Q to q Map W to w Sometimes I typed the wrong command in VIM, like :Q and :W, and I want to make these wrong commands to...

## Open file under cursor declared as #include in the C/C++ code in Vim?

file,vim
I now how I can open a file under cursor in Vim. Is there any way to also open files declared like below? #include <iostream> #include "limits.h" ...

## Using vim-quickrun for “PHP REPL style”

php,vim
I'm trying to get some "repl-like" feature for PHP, inside vim. Basically, what I want is to be able to visually select a part of my script, execute it, and see the result in a separate buffer. But I don't want to execute the whole current file (so :!php %...

## How do you know what VIM help keyword to search?

vim
I was trying to google how to search within a scope in VIM and found this link. Limiting search scope for code in Vim I wouldn't imagine to come up with the keyword "/\%V" to search help in VIM help. So, I'm wondering how most people get help from VIM...

## Vim background color “dark” = “black”? or I didn't install correctly?

vim,macvim
I added a color theme expected to be, in which the background color is lighter than black.: But my my color theme looks complete dark. Whats wrong with it? ...

## Highlight bash internal varibles using VIM

bash,vim,vim-syntax-highlighting
Is it possible to Highlight bash internal varibles using VIM? For example the variables described on this page would appear a different colour than the user defined variables. http://tldp.org/LDP/abs/html/internalvariables.html ...

## vim: E14 Invalid Address, reassign variable inside if statement

vim
I'm trying to make my tab spacing dependent on file type. But I get the error E14 Invalid Address on line 3. function! Tabs() let t = 4 if (&filetype ==? 'yaml') || (&filetype ==? 'yml') t = 2 endif " size of a hard tabstop let &tabstop=t " size...

## Select a different keystroke than colon ':' to enter command-line mode in vi

vim,vi
Is there any way to achieve that remapping? I looked a bit into map and inoremap but they appear to affect within a given mode, not how to enter a given mode....

## Show tex section list in vim

vim,tex
I like to use vim for tex file editing. My document is lengthy, so I hope to show a list of section or subsection and navigate by just typing enter on the section name. Please let me know some good plug-in or setting. I know taglist plug-in shows a method...

## is there any vim plugin to select block of code in any language?

vim
I mean, if my cursor is pointing somewhere inside of javascript else block, is there a plugin for one shortcut to be able to select all lines inside this else block, regardless to on which line exactly I'm currently in this else block pointing my cursor, so that, if I...

## Shortcut to finding first match in file

regex,vim
When searching with "/" in vim I find myself often wanting to go the first match of a file. I know that I can simply do: gg/<pattern> but the "gg" adds an entry into my jump list which I may not want. I feel there should be a way within...

## How to highlight rulerformat

vim,highlight,rc
I want highlight the rulerformat in my .vimrc. I have set ruler set rulerformat=%55(%{strftime('%a\ %b\ %e\ %I:%M\ %p')}\ %5l,%-6(%c%V%)\ %P%) I have subsequently tried all of the following: hi rulerformat ctermbg=1 hi rulerformat ctermbg=red hi Group1 ctermbg=red "if you modify the rulerformat slightly you can try to access group 1...

## NerdTree window size is too large when current directory “.”

vim,nerdtree
Every time I type vim . and select some file, nerdtree is too large. there's a way to fix it? ...

## vim comment/uncomment with one mapping [duplicate]

This question already has an answer here: What's a quick way to comment/uncomment lines in Vim? 32 answers I'm new(bie) in vim. I've got the following mapping to comment my python code : nmap cc 0i#<ESC> I would like to have the same mapping to uncomment a line. I...

## Why does Vim sometimes create .swp files?

vim
Sometimes Vim creates a .swp file when I edit something, but not always. Why is that, and what causes Vim to create .swp files? Is it bad to disable them in .vimrc?

## VIM Convert Text to URL with Search/Replace

vim
I have a document that contains long filenames, followed by a hyphen, followed by a description of the contents of the file. The files are all PDFs. I am converting this document into a page on our website, so that it has the filename, which should be a link to...

## Disable Wrapping Cursor in Eclipse

eclipse,vim,vi
I'm mostly using Vi (edit: Vim) for text editing and the viPlugin for Eclipse Juno. Eclipse seems to have a very annoying behaviour of "wrapping" the cursor to the next/previous line, if yout reach the end/start of a line through cursor keys. (Reproduce by placing the cursor on the first...

## Prevent single letter deletes to spam clipboard manager

vim,clipboard
With unnamed clipboard option included, single letter deletes spam my clipboard manager Is it possible to fix this so that single letter deletes (with x) are not yanked to clipboard.

## match wordchar and/or dot string of anylength

regex,vim
This matches a word /\w\+ This matches a any number of dots /\.\+ Why doesn't this match any number of words combined by dots? /[\w\.]\+ ? The w seems to be matching actual 'w's instead of a word character, whether I escape it or not....