Menu
  • HOME
  • TAGS

how to change the regex responsible for vim's “current word” search

vim

Yes. It's the iskeyword option. It has all characters to take into account for searches and patterns, and by default the dash character is not included, but you can fix it adding it, like: :setlocal iskeyword+=- UPDATE with the comment of Ingo Karkat: To use it only for css files,...

Find entries with zero distance variance and recorded watts

regex,xml,vim,garmin

Given enough determination, it can be done: :%s/\m<DistanceMeters>\([0-9.]\+\)<\/DistanceMeters>\n\(.*\n\)\{1,15}\s\+<DistanceMeters>\1<\/DistanceMeters>\n\(.*\n\)\{3}\s\+<Watts>\zs[1-9]\d*\ze<\/Watts>/0/gc However, why on Earth would you want to do that in Vim?...

Using vim-quickrun for “PHP REPL style”

php,vim

You need to put the php flags around your php code, like any php script (it always starts in plain text mode): ... <?php echo 'hellow quickrun php'; ?> .... Then you can select only one part with QuickRun, but don't forget to select the flags as well....

Substitute both the beginning and end of every occurrence of a string with vim

vim

This can be done with a simple capture group: match both the part that gets removed (?dep=) and the part that will be kept (\d\d), but enclose the latter in \(...\) to capture it. Then, in the replacement, refer to the first capture via \1: :%s/?dep=\(\d\d\)/{{ path('annonce-index', {departement: \1}) }}/g...

How to exit insert mode using autocommand upon losing focus?

vim

Try using stopinsert: autocmd FocusLost * stopinsert | wall! ...

Moved .vimrc in a new dir, trying to get it to work

vim,macvim,vim-plugin

I was told to use version control on my dotfiles. Maybe you should turn to the people who told you to do that for support, don't you think? Putting all your dotfiles in a single repo is not a requisite or even an objectively good idea. It could work...

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

vim,vi

You could use nmap, e.g., :nmap ; : to map semicolon to colon. The 'n' in nmap indicates normal mode. If you wanted to use, say, the <F2> function key to enter command-line mode from insert mode, you can do: :imap <F2> <Esc>: There's an exhaustive 3-part tutorial about key...

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

vim,macvim

Did you check your profile settings of your terminal app? Looks like you are running the standard mac terminal. Adding color to the terminal

Install Vim via Homebrew with Python AND Python3 Support

python,python-3.x,vim,homebrew

Vim compiled with both, or with 'dynamic' is only available on Windows versions. Mac/*nix/etc can only use one version of Python. My way around this was to compile two different vims, one with each Python version, and then create a version check in my .vimrc to be co-compatible with the...

Temporarily declare a word as wrong in vim spellchecker

vim,spell-checking

Vim spell cheat sheet: ]s / [s - next / previous misspelled word ]S / [S - next / previous bad word (i.e. as above, but ignore rare words and the like) zg - add good word to the first dictionary in spellfile; remove it with zug zG - add...

How does this series of keystrokes in vim delete everything but the numbered lines?

vim

) is a motion which jumps forward one sentence. A sentence is: *sentence* A sentence is defined as ending at a '.', '!' or '?' followed by either the end of a line, or by a space or tab. In this file: Leave only the numbered lines. LINE1 The first...

"+y operator for yanking to clip-board, not working

vim,vi

if you ssh into a server, you run commands on that server. "+y (yank text and save in clipboard) works only if there is a running X environment. That's why you cannot "copy & paste" with your sshed remote server.

Vim Statusline: Word search

search,vim,statusline

The first thing to mention here is that for large files this feature would be completely impractical. The reason is that the status line is redrawn after every cursor movement, after the completion of every command, and probably following other events that I am not even aware of. Performing a...

Right way to set up Rust using Vim

vim,rust,rust-cargo

The plugin needs setting up the src location for rust which is in fact not that big of a deal, if I would know where said directory was I couldn't find the sources either. If you just want the sources without all the history: For 1.0.0, git clone --depth=1...

How can I “register” a new help.txt document via .vimrc?

bash,vim

Since you're using pathogen: just run :Helptags (please note the upper case H) once, when you're done installing all plugins. After that you need to re-run it, again only once, whenever you update a plugin. It's a command provided by pathogen, not the built-in :helptags. You can run it from...

how to replace NumberInt(1) to 1 with vim?

regex,vim,replace

You can try: :%s/\vNumberInt\((\d+)\)/\1/ Using very magic mode (\v), do grouping in the number between parentheses and use it in the replacement part as backreference (\1): It yields: "bz":1, "something": "something else NumberInt(1)" "bz":1, "something": "something else NumberInt(2)" "bz":1, "something": "something else NumberInt(3)" "bz":1, "something": "something else NumberInt(4)" "bz":1, "something":...

In Vim, how can I compile a .java file in /src/ and run its class file from /bin/?

java,vim

For permanency, I am converting my comment into an answer. In order run the Java command from vim, one must first cd to the directory bin and run the Java command from there. map <F12> :!start cmd /k "cd %:~:h:s?src?bin? & java %:r" ...

Enforcing coding styles in Visual Studio and VIM

c++,visual-studio-2010,visual-studio,vim,coding-style

EditorConfig seems to do exactly what you want in Vim, Visual Studio, and a lot of other editors and IDEs.

unique search and replace

excel,csv,vim

In Vim, you can do this via :substitute, capturing the first column, and those parts of the second column that don't match the first value (referenced via \1). I'll let the match start on the second column (with \zs); this avoids re-referencing the first column in the replacement part, which...

How to use Ctags to list all the references of a symbol(tag) in vim?

vim,ctags

The ctags tool only collects and stores the definitions of symbols. To find all references, you can use the cscope integration into Vim (:help cscope), but note that cscope supports far fewer programming languages than ctags. Alternatively, a poor man's substitute would be the built-in :grep / :vimgrep commands (with...

element.queryselector not showing in Vim

javascript,vim

None of the four listed plugins includes any omni-completion script; therefore they are not responsible for the lack of queryselector and queryselectorAll in omni-completion suggestions. Your problem is that the default omni-completion script is pretty old and doesn't have those two methods so you'll need a more up-to-date third party...

How can I 'change in number' or 'change in digits' in Vim

vim,numbers,editor

Here is in, a custom text-object that lets you act on numerical values (including floats): " custom text-object for numerical values function! Numbers() call search('\d\([^0-9\.]\|$\)', 'cW') normal v call search('\(^\|[^0-9\.]\d\)', 'becW') endfunction xnoremap in :<C-u>call Numbers()<CR> onoremap in :normal vin<CR> The actual search is performed in a function to avoid...

Shortcut to finding first match in file

regex,vim

To avoid adding to the jump list, the :keepjumps command can be used, but you'll get a long command, because this now goes through an Ex command, and you need :execute for the concluding <Enter>: :execute "keepjumps normal! gg/<pattern>/\<CR>" An alternative is using a :range; the combination of 0 (goes...

Sending signal to bash shell launched in GVim

bash,vim,signals

Ctrl+D seems to work for me, at least for closing a terminal session. Crl+C however does not. If you only want to kill a running process, you can do this workaround (provided Ctrl+Z) works for you. Press Ctrl+Z to pause the process, then kill %1 to kill the process in...

OSX tmux configuration session open file in vim automatically

osx,session,vim,configuration-files,tmux

Explicitly inserting a space should do it: send -t 1 vim space ~/Path/to/my/file enter or you can quote command arguments (I prefer this one): send -t 1 'vim ~/Path/to/my/file' 'enter' ...

vim comment/uncomment with one mapping [duplicate]

function,vim,mapping,comments

You shouldn't attempt to implement this (poorly) yourself; this is a solved problem, and you can choose from several good plugins. See Comment Lines according to a given filetype for a list of plugins. As a learning experience, attempting a mapping is fine, though. Here's one approach that uses :help...

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

vim,nerdtree

you can set the size of windows like let g:NERDTreeWinSize=20

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

vim,nerdtree

This is built into the plugin; the go command does this: go Open selected file, but leave cursor in the NERDTree ...

Vim: How to search for more than one word in the same search?

search,vim

Yes, you can have several branches in a search pattern: /foo\|bar See :help \|....

Different color schemes on vim

vim,fortran

On my workstation, Vim and the Vim syntax file are versions 7.3 and 0.93 respectively, while on my server 7.2 and 0.88. That explains it. The 'colorcolumn' was introduced in Vim 7.3. Your ~/.vimrc has a fallback using matchadd() for older versions, but that one only highlights actual occurrences...

How to skip a command in redo

vim

I think there is no easy way to do that. I assume the changes were quite complex and that you may have spent some time reviewing them, otherwise you could just type them again. You could try the following options: start recording a macro (:help q), type the changes, stop...

Replacing a string with empty line

vim,sed,vi

With vim you can do it like this: :g/PMC:/normal S ...

Make map faster in vim

vim

Those mappings probably come from the unimpaired plugin, which defines a lot of them. You can check with :verbose map [. You either have to reconfigure the plugin to use a different prefix, or get rid of the plugin. You can also :unmap [o, :unmap [e, etc. the mappings individually;...

Disable Wrapping Cursor in Eclipse

eclipse,vim,vi

In Vim, the behavior of the arrows when the cursor is at the BOL/EOL is governed by the 'whichwrap' option which — judging by the manual — is not supported by viPlugin. What you want would be achievable with custom mappings and a bit of vimscript logic in Vim itself...

Bash: How to generate lines with sequential numbers?

vim,sed

Inside vim you could do the following: :put =map(range(1,30), 'printf(''scraper%02d.nj.company.com'', v:val)') In a bash, just use printf with a ranged brace expansion: printf "%s\n" "scraper"{01..30}".nj.company.com" Prints: scraper01.nj.company.com scraper02.nj.company.com [...] scraper30.nj.company.com Or another solution, with a for loop: for (( i=0; i<=30; i++ )) ; do printf "scraper%02d.nj.company.com\n" $i; done ...

issues with installing newer cabal version for haskell vim now

ubuntu,haskell,vim,ubuntu-14.04,cabal

Your $PATH variable seems to be broken. In a comment you said it was /home/me/google-cloud-sdk/bin:/.cabal/bin:/usr/local/sbin:/usr/local/bin:/usr/sb‌​in:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games This means that your shell (assumed to be bash) will look in the following directories /home/me/google-cloud-sdk/bin /.cabal/bin /usr/local/sbin /usr/local/bin /usr/sb‌​in /usr/bin /sbin /bin /usr/games /usr/local/games when looking for executable. If you look at the second...

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

vim,clipboard

On Mac OS X and Windows, the * and + registers both point to the system clipboard so unnamed and unnamedplus have the same effect: the unnamed register is synchronized with the system clipboard. On Linux, you have essentially two clipboards: one is pretty much the same as in the...

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

python,python-3.x,vim

When you do :!python3 & you are actually running a shell that executes the command python3 myFile.py. That will run your program non-interactively and, as is, your program does nothing, it just defines a class and ends. You can force the interactive mode with :!python3 -i %. Alternatively you can...

Vim search using regular expression

regex,vim

The command below should work unless "any character" means something different for you than for Vim: :g/abc.*xyz . means "any character except an EOL". * means "any number (including 0) of the previous atom". 1,$ could be shortened to %. :global works on the whole buffer by default so you...

Using vim to develop instead of Emacs on Windows

vim,emacs

For those Emacs users wishing to have a Vim experience in terms of keyboard shortcuts and certain functions specifically designed to duplicate Vim behavior, the original poster may wish to consider using evil-mode: http://www.emacswiki.org/emacs/Evil In addition, the user may wish to configure his/her own keyboard shortcuts that make more sense...

VIM + netrw: open multiple files/buffers in the same window

python,vim,nerdtree,python-mode,netrw

But having a file opened, if I open netrw by typing :E and open another file by hitting <enter> VIM closes the old one and opens the new one in the same window. [...] How can I open multiple files/buffers in the same window using netrw? Buffers are added...

vimscript syntax not pattern

vim,vim-syntax-highlighting

To start a region only with @commands that are not @tangle, you need negative lookahead via \@!: ^@\%(tangle\)\@!. To ensure that it's really only tangle, not something starting with tangle, you need an additional $ assertion; and to not match felix, too, another branch: ^@\%(\%(tangle\|felix\)$\)\@! So, this should do: syn...

How to highlight rulerformat

vim,highlight,rc

-- edit -- I think I completely missed the point of your question. What you seem to want is not a way to highlight the value of 'rulerformat' in your vimrc (as your repeated emphasis on rulerformat, your title and your introductory sentence imply) but your actual ruler, at the...

Highlight bash internal varibles using VIM

bash,vim,vim-syntax-highlighting

You can define additional syntax keywords for those built-in variables. Put the following into ~/.vim/after/syntax/sh.vim: syntax keyword shBuiltInVariable BASH BASH_ENV BASH_VERSION containedin=shDerefSimple highlight def link shBuiltInVariable Special The containedin= is necessary because shell variables are already parsed by existing syntax groups, and these additional overrides need to go in there...

Show tex section list in vim

vim,tex

You only need the built-in :global command: :g/\\.*section{/# and, possibly, a simple custom mapping: nnoremap <key> :g/\\.*section{/#<CR>: type a line number followed by <CR> to jump to the desired line....

augment the number of lines on indent

vim

That's controlled by the 'shiftwidth' option; it should be aligned with 'tabstop' to give consistent results: :set ts=2 sw=2 ...

Vim not showing messages for less than 3 occurrences substitutions

vim,macvim

This is controlled by the 'report' option. Set it to zero, if you always want a message.

Unknown function: pathogen#infect

vim,nerdtree,pathogen

Looks like you copied the pathogen.vim directly from the browser, which has all the HTML tags in it. Try running following command and try again - curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim More on pathogen installation....

Delete backwards from cursor to the end of the previous line in Vim?

vim,vi

What you want is the line join command, J. In normal mode, put your cursor anywhere on the var myVar = line and type J (capital j). Direction-wise motions work with J - 5J indents 5 lines below the cursor, etc. You can also select a range of lines using...

Replace all newlines between “two lines with certain patterns” with a comma in vim

regex,vim,newline

How about :%s/Pattern 1\_.\{-}Pattern 2/\=join(split(submatch(0), "\n"), ", ")/g Search Pattern 1 # obvious \_. # any character including newline \{-} # repeat non-greedily (vim's way of writing *?) Pattern 2 # obvious The replace part should be clear without an explanation....

VIM Convert Text to URL with Search/Replace

vim

Try this: :%s!\v^\S+\.pdf!<a href="&">&</a>! Please note that the above doesn't try to do anything with HTML entities though. See the Vim Tips wiki for a possible solution if that's a concern. Edit: The way this works: :% - filter the entire file s!...!...! - substitute \v - set "very magic"...

How do I insert the same line into multiple files using VIM

vim

Insert a line by doing a replace like so: :115/$/\rfoo/ However lets kick this up a notch with :windo: :windo 115s/$/\rfoo/ :windo {cmd} will execute {cmd} on each window. Substitutions not your thing or have your text in a register? Then use :put. Example of putting a line after line...

Highlighting Vim text with black background when ANSI colors are off

osx,vim,ansi-colors

Without ANSI colors support there is no real point defining foreground and background colors. What you are looking for is: hi Visual cterm=reverse hi VisualNOS cterm=underline See :help highlight-cterm....

keypress into buffer from function

vim,snipmate

Everything after :normal is treated literally; to insert special characters, you need to use double quotes and :execute to evaluate them: execute "norm i test\<Tab>" For the tab key, you could have alternatively written "\t"; the :help key-notation is the more common and general one, though....

How to search and replace from the last match of a until b?

regex,vim,latex

I think you're trying to match from the last occurrence of \\}% prior to end{quoting}, up to the end{quoting}, in which case you don't really want any character (\_.), you want "any character that isn't \\}%" (yes I know that's not a single character, but that's basically it). So, simply...

open a completion popup from normal mode

vim,omnicomplete

:startinsert usually is the right approach, but it indeed gives control back to the user, so you cannot automatically trigger the completion. Through the feedkeys() function, you can send arbitrary keys "as if typed". This allows you to start insert mode and trigger the completion: function! InsertImport() call feedkeys("iimport \<C-R>=CompleteImport()\<CR>",...

Indentation changes in new tab-page of vim

python,vim

:setlocal only effects in the current buffer or window. Each vim tab has its own windows so they have their own local settings. You can make the tab settings global (by using set instead of setlocal in your vimrc), or pester the writers of the python lib to fix the...

Setting tab width based on file type

vim

autocmd BufNewFile,BufRead *.nim setlocal tabstop=2 shiftwidth=2 softtabstop=2 This should work (after restarting Vim / re-editing an existing file via :e!) fine, but it mixes filetype detection with filetype settings. Vim has an intermediate abstraction called filetype, which you should use. With it, you map file globs like *.nim to a...

VIM - Reformatting indentation and braces

vim,coding-style,vim-plugin

The indentation scripts in vim are not constructed for so complex tasks. I would advise you to use the indent command, in particular the following arguments: -prs, --space-after-parentheses Put a space after every '(' and before every ')'. See STATEMENTS. -sai, --space-after-if Put a space after each if. See STATEMENTS....

match wordchar and/or dot string of anylength

regex,vim

See "PREDEFINED RANGES" in Vim documentation: usr_27: Note: Using these predefined ranges works a lot faster than the character range it stands for. These items can not be used inside []. Thus [\d\l] does NOT work to match a digit or lowercase alpha. Use \(\d\|\l\) instead. So, your work-around would...

Why does Vim make certain object keys yellow by default?

javascript,node.js,vim,sails.js

vim will highlight keywords it recognizes as different colors. While it is possible to use them in some contexts you won't be able to use them in other contexts. Therefore, it is generally recommended that you do not use these reserved words for variables and identifiers in your programs. To...

Dynamic pattern for vim highlight

vim

One way to do it: call matchadd('rightMargin', '\%'. &tw .'v') You should probably put this in a ftplugin (see :help ftplugin) rather than an autocmd....

VIM: Use python3 interpreter in python-mode

python,vim,ubuntu-14.04,python-3.4,python-mode

Try adding this to your .vimrc file let g:pymode_python = 'python3' I found this in the help docs. In vim type: :help python-mode By default, vim is not compiled with python3 support, so when I tried this, I got all kinds of errors... Which tells me it's trying to use...

error when vim macro recording play

vim,macros

You should include the movement command (probably j in your case) in the macro. So record your macro as qaI#Escjq And then play it with [email protected]

Prevent single letter deletes to spam clipboard manager

vim,clipboard

You can redefine the x command, either to delete to the default register: :nnoremap x ""x or to the black-hole: :nnoremap x "_x With :help map-expr, you could extend this to redirect the register only if no [count] is given (by evaluating v:count), or if no custom register is specified...

bash script “ignores” .vimrc

bash,vim,autocmd

Your problem is that the autocommand option is only availaible in vim and not vi. So if this is available on your system, you should replace the last command line by : vim /export/home/fpd/tmp/tmp_local_log/LocalLog_IPNode$node.log Vim stands for "Vi Improved" and many options are only available in the latter. To be...

The “-” key goes up a line in vim

vim

from :help - (it isn't mapped, it is a motion command) - <minus> [count] lines upward, on the first non-blank character |linewise|. and + does the same Downward....

Vim highlighting sometimes requires a kickstart?

vim

The PHP syntax plugin allows to configure this; cp. :help ft-php-syntax: Selecting syncing method: let php_sync_method = x x = -1 to sync by search (default), x > 0 to sync at least x lines backwards, x = 0 to sync from start. The different sync options are documented under...

Measuring time spent in certain types of files in vim

vim,macvim

Try the BufTimer plugin. It times the duration in each file, so it does not exactly group by some filter, but it should be good enough.

How do you know what VIM help keyword to search?

vim

You did the right thing. Google is probably going to be your best bet. You can also use the vim help site, it has a search function built in: http://vimdoc.sourceforge.net/htmldoc/

Vim keeps unindenting

vim,indentation

As others have pointed out, Vim intentionally removes indent of empty lines if the indent was added automatically. But, this does not happen if you have inserted any text on the line, even if you delete it. So on a case-by-case basis, just insert some text and delete it with...

Strange vim registers behavior when used with execute "normal

vim

The string concatenation is done in fact before execution, which seems logical. The following code has the behaviour I expected. normal! cc execute "normal! ".(@"+1)."\<esc>" ...

vim: E14 Invalid Address, reassign variable inside if statement

vim

You must always use :let to assign a value to a variable: let t = 2 Note: although it is not strictly required, it is somewhat customary to put spaces around the operator for :let: let &foo = 1 And it is mandatory to avoid spaces for :set: set foo=1...

expand delimited text over multiplie lines

string,vim

Here's a quick hack: function! Fmt(str) let parts = split(a:str, '\v\s*\|\s*', 1) if len(parts) == 6 let parts[4] = parts[4] ==? 'right' ? 'true' : 'false' let parts[5] = substitute(parts[5], '\v.*Pay\s+(.+)', '\1 (we Rec \1)', '') let hdr = ['Name', 'Age', 'Gender', 'Eyes', 'Right Handed', 'Pay'] call map(parts, 'hdr[v:key] ....

Custom mappings in help text buffers

vim

I use something like this (borrowed from Junegunn's vimrc, I think): augroup vimrc autocmd! autocmd BufEnter *.txt call s:at_help() ... augroup END " special actions for help files function! s:at_help() if &buftype == 'help' " enable 'q' = quit nnoremap <buffer> q :q<cr> endif endfunction ...

open VIM with default code [duplicate]

vim

You can create a macro/abbr to do this for you, but you can also make this an autocmd to write to a file of a particular type. There may be a better way to do this, but this is something you would only have to include in your .vimrc autocmd...

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

vim

This usually is done with folding; you can easily define a 'foldexpr' that filters lines based on a regular expression match; see Folding with Regular Expression for implementations. However, a single fold line will remain for each condensed block. To do away with those, I can only think of the...

Can I define command-line commands for VsVim?

visual-studio,vim,vsvim

Looking at the source, from what I can tell it does not have support for user-defined commands via the :command command. https://github.com/jaredpar/VsVim/blob/master/Src/VimCore/Interpreter_Parser.fs#L121 You can ask the author if he plans to add support for it, the best place for that is probably the Q&A section of the plugin's page: https://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329/view/Discussions...

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

vim

Try viB to select the "inner block", and vaB to select the block together with the enclosing braces. See :help text-objects for more (highly useful) information.

neovim colors not “just working”

vim,vim-syntax-highlighting,neovim

Check your TERM variable. It needs to be set to something like xterm-256color which says that the terminal supports 256 colors.

Why does Vim sometimes create .swp files?

vim

Vim creates .swp files for recovery. In case you fail to save, vim will be able to recover (at least some of) the file. The merits of disabling them depends on what you do. If you use vim for anything that has a build, you probably save your sources all...

Selecting text and saving it with keymap

vim

With all those repeated a( text objects, you presumably intend to capture the text in the outermost parentheses. Unfortunately, if there are less parens than text objects, Vim will beep and abort the mapping, so the remainder won't be executed. A possible solution is to split this into two parts,...

In Vim, how can I undo opening?

vim,undo,nerdtree

You can go back to the previous file in a buffer using Ctrl6.

Pylint Error when using metaclass

python,python-3.x,vim,pylint,syntastic

In the docs under 4.2. Q. The python checker complains about syntactically valid Python 3 constructs...: A. Configure the python checker to call a Python 3 interpreter rather than Python 2, e.g: let g:syntastic_python_python_exec = '/path/to/python3' ...

How can I save in vim a file with the actual fold text? (“+— 43 lines […]”)?

vim

Here is a custom :RenderClosedFolds command, which will modify the current buffer / range. It also attempts to maintain the Folded highlighting of the original folds. ":[range]RenderClosedFolds " Replace all lines currently hidden inside closed folds " with a single line representing 'foldtext'. function! s:RenderClosedFolds() if line('.') == foldclosed('.') let...

Change vim-airline colorscheme via vim-sunset plugin

vim,autocmd

Ok, so I found a solution myself: the key is to check whether or not the airline-plugin is already loaded when trying to set the airline colorscheme. Now it looks something like this: function! Sunset_daytime_callback() " This Works :) colorscheme vim_colorscheme_light if exists(':AirlineTheme') " check if the plugin is loaded...

Return to shell output from last run shell command

shell,vim

The output from the :! command is printed directly to the terminal (or GVIM's built-in emulator); it is not saved. To do that, you could redirect into an external file with tee: :!bundle exec rspec my_file_spec.rb | tee a.out :split a.out Or, you directly open a scratch buffer and :read...

Assigning save (:w) to w in vim

vim

Though one could discuss the suitability of your insert-mode mapping, the root cause of your problem is a trailing space in the mapping definition; i.e. Vim reads this as follows: inoremap <leader>w <Esc>:w<cr><Space> You'll even see this in the :imap <Leader>w output! <Space> in normal mode advances the cursor one...

Compiling C++ code from vim

c++,linux,vim,terminal

The :compiler command selects a compiler plugin; there's one named gcc, but none named g++. That's the E666 you get. You can obtain a list of all installed compiler plugins by typing :compiler followed by <C-D> (lists all) or <Tab> (completion). Note that compilation of C/C++ source code is usually...

how to apply macro on list of lines with vim

linux,vim,macros

If those lines have something in common, you can use the :global and :normal commands: :g/foo/norm! @1 which is slightly "smarter" but probably a bit less intuitive than: [email protected] [email protected] [email protected] See :help :global and :help :normal....

Any way to ignore ^M carriage returns in VIM?

git,vim,github

You can: :hi! link SpecialKey Ignore which will hide them. They'll still be in your text and can be deleted accordingly, but at least they're not visually intrusive. On the other hand, since everybody else's editors are so rude as to mess up line endings (or at least fail to...

Make vim follow symlinks when opening files from command line

linux,osx,vim,zsh

So it doesn't look like there's anything built into vim to allow this. I had a play with the wrapper function and it turned out to be a little easier than I thought. Here's the final result: function vim() { args=() for i in [email protected]; do if [[ -h $i...

How to delete a WORD in vim in insert mode

vim

There's only :help i_CTRL-W for words, and :help i_CTRL-U for the entire line, but nothing for WORDs. You can easily define a custom mapping, though: :inoremap <C-B> <Esc>"_dB"_s Here's a more elaborate version, with better handling of corner cases: inoremap <silent> <expr> <C-B> \ col('.') == 1 ? \ '<C-w>'...

How to jump/display the column of an error

python,vim,syntax,pylint,syntastic

Syntastic stores the errors in the location list window. You can use :lopen to show it, and then use commands like :ll (or <Enter>) to jump to the error under the cursor. Alternatively, you can also navigate through errors via :lnext and related commands. If the corresponding error message did...

How can I map keys in Insert mode that contains Carriage Return in it?

vim,text,insert,editor,vi

For an insert mode mapping, you need :imap; :set is for setting Vim options. Ctrl + Enter is written as <C-CR>; cp. :help key-notation. Ergo: :inoremap <C-CR> <Esc>o Note that this key combination mostly only works in GVIM, as most terminals do not send different keycodes for Enter in combination...

Gtk vim remove mapping of

vim,settings

It looks like you've :set paste, which disables insert mode mappings and abbreviations. This option is meant for pasting text from the terminal (e.g. via middle mouse button); it should only be set during the paste itself, not permanently (and you can easily toggle this via the 'pastetoggle' option). So,...