8bittree
  • Member for 6 years, 6 months
  • Last seen more than a week ago
Copying multiple words (from different lines) and paste them at once
Accepted answer
16 votes

Use an uppercase register when yanking (copying): "Ay "A says to append to the a register, as opposed to "a which would replace the contents of the a register. Once you've copied everything into ...

View answer
automatically rewrap lines when writing markdown in VIM
Accepted answer
10 votes

Even simpler: the a flag for 'formatoptions' enables automatic formatting of paragraphs whenever text is inserted or deleted. See :help fo-table for details on 'formatoptions' flags and :help ...

View answer
How to enter tilde (~), back tick (`) and special chars with a non-US keyboard?
8 votes

From :he digraph: Digraphs are used to enter characters that normally cannot be entered by an ordinary keyboard. Running :digraphs will show you the currently defined digraphs. ` is defined as '!...

View answer
What is the purpose of user `command` in Vi/Vim?
Accepted answer
7 votes

Let's get this confusion out of the way first: Are these ex commands or Vimscript? Vim scripts are made of ex commands. From :help script: Your first experience with Vim scripts is the vimrc file....

View answer
Is there a way to "take both" when using Vim as merge tool?
6 votes

yank and put can work without any plugins or extra functions, though it is, perhaps, a bit less convenient than do or dp Just copy the needed bits from the parent buffers and paste them into the ...

View answer
Insert code snippets?
6 votes

StandardEyre's answer is the most direct answer for the body of your question, but you may also be interested in checking out one (or several) of the many snippet plugins for Vim, such as Ultisnips, ...

View answer
Is there any vim plugin that implement hot exit feature from sublime text
Accepted answer
6 votes

Vim can do this, though it may be a bit clunky and take some setup. romainl gets you partway with session. The missing bits are swap files, :preserve, and the & flag for cpoptions. Swap files ...

View answer
How to change the behavior of cursor motions? (ex: go from one line to the end of the previous one)
5 votes

All of these are normal mode commands and leave you in normal mode: $ will move the cursor to the end of the line. 0 will move the cursor to the beginning of the line. ^ will move the cursor to the ...

View answer
How to get w word and b back to treat hyphens and underscores like spaces?
4 votes

It looks like your understanding is inverted. By adding - to iskeyword, you're telling Vim that it's just a regular word character that should be skipped over by things like w or b. Instead, you want ...

View answer
Down and . X times?
Accepted answer
4 votes

You can use a macro, though it does require a (small) bit of planning ahead: qqdt}jq4@q will work, assuming your cursor is starting on the first line on the space after value:. Here's an explanation:...

View answer
How does Ultisnips select snippet files for the file I'm currently editing?
4 votes

From :help UltiSnips-adding-snippets (section 4.1): UltiSnips iterates over the snippet definition directories looking for files with names of the following patterns: ft.snippets, ft_*.snippets,...

View answer
How to let Gvim and Mvim source the same file, shared through Dropbox?
4 votes

^M is a carriage return character. It's plain old ASCII (0x0D) and thus perfectly valid UTF-8 encoded Unicode. Vim on windows defaults to using Windows-style line endings: CRLF (Carriage Return, Line ...

View answer
What's the deal with the Vi/Vim in Ubuntu 18.04/19.04?
3 votes

TL;DR The vi on your computer is almost certainly a symlink to vim, renamed executable, or something similar rather than an actual vi executable. The Vim package(s) in the repositories are built with ...

View answer
Unusual Vim Auto-completion Feature
Accepted answer
3 votes

It's the wildmenu setting that lists all the options. The wildmode setting can also affect the specific behavior of completion in command-line mode, including when the wildmenu will appear. wildmenu ...

View answer
How to [[ to top of function and see function name on first line of screen
3 votes

zz will center the view on the current line (with some exceptions, it won't do much if you're on the top line), without affecting ''. You could remap [[: :nnoremap [[ [[zz Or simply type zz ...

View answer
Fixing a "not an editor command" error
2 votes

Based on :help startup, vimrc files (section 3) are loaded before plugins (section 4), so it makes sense that you wouldn't be able to use plugin-defined functions in your ~/.vimrc. Section 4 does ...

View answer
How do I evenly distribute GVim windows started from a key-binding?
Accepted answer
2 votes

It appears as though your needs may be met by using tabs. See :help tabpage in Vim for general help, but here are a few relevant commands: Start Vim with vim -p filename ... to open each file in a ...

View answer
Selecting code chunk in Rmarkdown
Accepted answer
1 votes

This seems like a prime case for a text object, but unfortunately, Vim doesn't recognize ```{R} or ``` as text object delimiters. There's at least three options that do work: 1. Click and drag with ...

View answer
How to handle multiple directories in vim?
1 votes

One handy keymapping I found years ago and have had in my vimrc ever since is: cnoremap %% <C-R>=fnameescape(expand("%:p:h")."/")<CR> It's a command-line mode mapping that expands %% to ...

View answer
How to toggle between split window layouts?
Accepted answer
1 votes

Use tabs. Tabs in Vim function more like OS-level virtual desktops than tabs in most other text editors. Combined with the Vim's ability to display the same buffer in multiple splits, and you've got a ...

View answer
Vim does not save any usage history (E886: Can't rename viminfo file)
Accepted answer
1 votes

Writing to C:\Program Files (x86) usually requires admin privileges, so Vim won't be able to write there, unless it's run as Administrator. But running Vim as Administrator is a security risk, so you ...

View answer
How to use Lua in Vim?
Accepted answer
1 votes

Christian Brabandt is correct, Vim requires the exact same version it was compiled for. In my case, however, Vim still failed to load liblua.5.2.dylib even after installing Lua 5.2. I fixed that by ...

View answer
How to batch replace a list of words in file?
1 votes

Assuming your list of words is in a buffer looking like this (one word per line. "Words" with spaces in them are fine.): Apple Cabbage Turtle Append \| to each line: g/./normal A\| That should ...

View answer