FAQ Database Discussion Community

## Custom mappings in help text buffers

vim
I tend not to use windows much in Vim (I prefer tabs), but there are certain things that use them, such as help text buffers. I'm fine with that, but with how seldom I use windows, it usually takes me a second to remember how to close the window (<C-w>c)...

## How to delete a WORD in vim in insert mode

vim
Is there a way how to delete a whole WORD (e.g. from vim path/to/some/file.txt to vim) in insert mode? To delete a word in insert mode the C-W shortcut works well. I got used to use C-W in bash too but bash actually deletes whole WORDs. Now I'd love to...

## Vim search using regular expression

regex,vim
I want to search a string which starts with "abc" and ends with "xyz" in vim. Below are the commands I've tried: :1,$g/abc[\w\W]*xyz/ :1,$g/abc$\\w\\W$\*xyz/ :1,$g/abc*xyz/ "[\w\W]*" means the texts between "abc" and "xyz" can be any characters "1,$" means the search range is from the 1st line to the last...

## Automatically switch back to NerdTree after pressing “o” on file

vim,nerdtree
When I press "o" on any file in NerdTree list, it opens this file in one of currently opened tabs. Sometimes, when I'm not 100% sure what file to open, I have to do this: 1) o (open file) 2) ctrl-ww (switch back to nerdtree) 3) j or k (go...

## bash script “ignores” .vimrc

bash,vim,autocmd
I have a problem as follows: I have a script which copies a log file from remote machine, does some modification on it and then opens it in vim, problem is vim doesn't auto recognize the file type (which outside of the script id does) – I need this for...

## Vim Statusline: Word search

search,vim,statusline
I've searched hard for this and haven't been able to find what I'm after. On my statusline I want a count of the number of matches that occur in the current file. The vim command below returns what I want. I need the returned number to be displayed in my...

## unique search and replace

excel,csv,vim
I have a csv with two columns. If I import this csv into excel I end up with column A and column B. Column A contains a string of text eg: 1234 (each row has a unique value) column B contains a string of text eg: abcd1234 I need to...

## 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...

## Can I define command-line commands for VsVim?

visual-studio,vim,vsvim
Is it possible to define my own custom command-line commands in VsVim like it can be done in Vim and described here? I tried adding different variations of the following lines to my .vsvimrc file, without success. command clean :vsc CodeMaid.CleanupCode<cr> :command clean :vsc CodeMaid.CleanupCode<cr> command clean execute ":vsc CodeMaid.CleanupCode<cr>"...

## Pylint Error when using metaclass

python,python-3.x,vim,pylint,syntastic
i try to fix all pylint errors and pylint warnings in a project. but i keep getting an error when i set a metaclass (https://www.python.org/dev/peps/pep-3115/). here is my example code: #!/usr/bin/env python3 class MyMeta(type): pass class MyObject(object, metaclass=MyMeta): # pylint error here pass the error just says "invalid syntax". i...

## OSX tmux configuration session open file in vim automatically

osx,session,vim,configuration-files,tmux
So I have tmux and vim running in iterm2 on OSX. I have a tmux.conf file that sources a session in ~/.tmux/ called 'left'. I have successfully loaded this session with three panes. Two panes in a left column and a single pane on the right. I have also managed...

## Unknown function: pathogen#infect

vim,nerdtree,pathogen
I just installed MacVim (and did an override of Vim). And I am trying to get Pathogen to work. When I start Vim, I get the following error: Error detected while processing /Users/nir/.vim/autoload/pathogen.vim: line 1: E477: No ! allowed: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> line 2: E488: Trailing characters:...

## Vim - how to run current python3 file in the python shell?

python,python-3.x,vim
I have a file called myFile.py on my desktop. This is the file: class Node: def __init__(self, data, next): self.data = data self.next = next def __str__(self): self = node while node.next: print(node.data) node = node.next return node.data I normally edit the file in IDLE. In IDLE I can click...

## augment the number of lines on indent

vim
in my .vimrc file, I have set ts=2 and that works - that is, it pushes the text two spaces to the right - when i'm using tab to indent in insert mode. Indenting with >>, however, pushes the text 7 spaces to the right. How can I control how...

## Indentation changes in new tab-page of vim

python,vim
I'm using vim 7.4. My python indent settings are the default: setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8 This line was taken from /usr/share/vim/vim74/ftplugin/python.vim which I didn't edit. When I open vim with the command "vim file1.py" then the tab key produces 4 spaces as expected. But when I open a second...

## What is difference between Vim's clipboard “unnamed” and “unnamedplus” settings?

vim,clipboard
What is the difference between these 2 settings? set clipboard=unnamed set clipboard=unnamedplus Which one should I use in order to have multi-platform .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...

## Measuring time spent in certain types of files in vim

vim,macvim
Is there a way to measure how much time I spend in certain types of files while working in vim? I would like to measure how much time I spend writing application code as opposed to tests (they all have a predefined file name *_spec.rb)

## Sending signal to bash shell launched in GVim

bash,vim,signals
How do I send a signal (say, SIGINT), to a shell launched inside GVim, using a keyboard shortcut? Neither Ctrl+C nor Ctrl+D seem to work....

## Vim: Is it possible to have a filtered view of a file?

vim
In a given text file, I would like to work on a "filtered view" (hiding lines with a pattern), but still to be able to edit visible lines : the filtering would only affect the visibility of some lines, and as soon as I would reset the filter, the hidden...