97 votes

Vim search replace all files in current (project) folder

Let's say we have a simple project structure like this: greeting.txt looks like and info/age.txt looks like Let's say we want to replace all occurrences of Sam with Bob. Here's what we would do: 1. ...
Niko Bellic's user avatar
  • 1,804
21 votes
Accepted

Mapping Ctrl with equal sign

Unfortunately, there's no reliable way of mapping Ctrl-=. Because of the way that ctrl+key chords interact with the terminal and are represented internally, the only Ctrl-mappings that Vim is ...
DJMcMayhem's user avatar
  • 17.6k
11 votes
Accepted

Delay before running vim command?

In recent vim versions, you can use timer_start to delay an operation. For example, to execute winpos 200 milliseconds after vim starts, autocmd VimEnter * call timer_start(200, { tid -> execute('...
Mass's user avatar
  • 14.1k
10 votes
Accepted

How to preview the result of markdown file edited in vim?

While I mostly agree with @romainl comment (markdown was made to be explicit enough not to need a preview) you can do this in different ways: [OSX / Unix] The instant-markdown plugin is a solution. ...
statox's user avatar
  • 49.9k
8 votes

How to change Vim's :hardcopy printfont?

Instead of printing from Vim, you could instead generate an HTML file using :TOhtml. Then you can use CSS to set the font used for the HTML and print that.
jamessan's user avatar
  • 11.1k
8 votes

Scrolling down multiple lines with Ctrl+e

You can use a count before Ctrl-E − 15<C-e> moves down 15 lines. Ctrl-D moves down half a screen by default, although the amount it moves can be configured via the "scroll" option. :help motion....
Dan Jones's user avatar
8 votes

how to make vim properly render RTL (Right to Left) languages

Vim only supports displaying files containing mixed RTL and LTF text in a terminal which also supports this (such as mlterm). (You're not using GUI Vim, but I'll note for future readers that it is ...
Rich's user avatar
  • 32k
7 votes

Scrolling down multiple lines with Ctrl+e

Ctrl+e takes count, so the quick and simple way is to create a normal mode mapping like the following: nnoremap <C-e> 10<C-e> This will simply do Ctrl+e 10 times. You can change the ...
tokoyami's user avatar
  • 935
7 votes
Accepted

Visually selecting a line and then deleting does not copy to black hole register

nnoremap only affects [n]ormal mode and will not affect [v]isual mode. You need vnoremap for that: vnoremap d "_d
Tumbler41's user avatar
  • 7,746
7 votes

How do I enable Bash keyboard shortcuts while in Insert mode?

Type <c-o> to temporarily leave insert mode and use normal mode keys instead. To create insert mode maps, read :h normal-index and :h insert-index. Then create insert maps that does about the ...
Tommy A's user avatar
  • 6,770
7 votes
Accepted

Are CTRL+C and <esc> the same?

<esc> and <C-c> are mostly similar. They will differ in some cases such as the following: Doing a vertical insert (<C-v>, then going down, then i to insert the same character, or ...
padawin's user avatar
  • 1,333
7 votes
Accepted

Can you use neovim in a gui like mvim or gvim? (Mac OS X)

There are several GUIs for Neovim because it externalises the user interface elements, so any GUI can draw these in different ways. There's a list that tracks the status of these projects. My ...
Tae's user avatar
  • 2,125
6 votes
Accepted

Assign shortcut to a Split window resize Ctrl+w+|

| is the command separator, so it terminates the map. You need to escape it: nnoremap <c-m> <c-w>\| Or use <bar>: nnoremap <c-m> <c-w><bar> See :help :bar and :...
Antony's user avatar
  • 2,570
6 votes
Accepted

ctrl+o and ctrl+i don't work with line skip motion 10j

You don't need a plugin, all you need is two lines of vimscript! If you would like every time you press 'j' or 'k' to be added to the jumplist, this is pretty easy. You could do it with this: ...
DJMcMayhem's user avatar
  • 17.6k
6 votes
Accepted

How can I force a page break in MacVim's printed output?

From :help popt-option: formfeed:y When a form feed character is encountered, continue printing of the current line at the beginning of the first line on a new page. So… ...
romainl's user avatar
  • 40.7k
6 votes
Accepted

Repeating the last move using . (w followed by .)

As stated in :h . the dot command only repeat changes, but commands like w are motions not changes. You can repeat motions like f, F, t and T with the commands ; and g; (see :h ;). And for more ...
statox's user avatar
  • 49.9k
5 votes
Accepted

E334: Menu not found: Window.Minimize

Important note As I mentioned it in the comments when you begin to use Vim the best you can do is to start with an emtpy .vimrc. From this you'll be able to build your own configuration which really ...
statox's user avatar
  • 49.9k
5 votes
Accepted

How can I drag a file onto MacVim and make it open in a split, not a new tab?

The "Open files from applications" preference in the General preference pane gives more options on how dropped files should open, in case tabs are not desired. See :h macvim-drag-n-drop. After ...
djjcast's user avatar
  • 921
5 votes

How to change Vim's :hardcopy printfont?

I don't know when it changed, but now it's possible. For example: :set printfont=Fira_Code:h12 :hardcopy do the job. I'm using Vim 9 on Windows. (P.S. I will try with MacVim in a few days and I'll ...
Antonio's user avatar
  • 287
5 votes
Accepted

Going back to the [n] last edited position

What you want is the "changelist": :help changelist. Use 3g; to jump to the third previous change in the "changelist" and 2g, to jump back 2 steps in the list.
romainl's user avatar
  • 40.7k
5 votes

Scrolling down multiple lines with Ctrl+e

As others have noted, you can prefix both <C-e> and <C-y> with counts, to "expose" that many more lines up or down. Another handy quick scrolling option lets you scroll so that the ...
Wildcard's user avatar
  • 4,409
5 votes

How do I approach understanding the EasyGrep documentation?

Documentation of Vim plugins (rightfully) assumes that you know your way around Vim itself. I would therefore recommend that you start by finding your way around the Vim documentation and Vim itself. ...
Octaviour's user avatar
  • 962
5 votes
Accepted

How to remove these characters when tabbing on VIM

This is because of the listchars option. The idea is that you can display certain whitespace characters (tab, space, newline, etc.) as a different character so you can see them better. I'm guessing if ...
DJMcMayhem's user avatar
  • 17.6k
5 votes
Accepted

How to not close MacVim after the last tab is closed?

You seem to be looking for MacVim Preferences, and they are under the MenuBar entitled "MacVim". MacVim -> Preferences -> General There you'll find settings for what to do on startup, and after the ...
jubilatious1's user avatar
5 votes
Accepted

Can I retain and restore all the GUI windows and its files on launch on Vim?

As I mentioned in my comments a session is associated with a single invocation of Vim so you can't do exactly what you're hoping to do. But I also mentioned something might be possible using shell ...
B Layer's user avatar
  • 19.8k
4 votes
Accepted

Syntax highlighting not working vim-polyglot

To be able to use the syntax highlighting in vim you must put the following line on your vimrc: syntax on Depending on your preferences/plugin manager (if any), it may want to put it at the start of ...
nobe4's user avatar
  • 16k
4 votes

Integrate MacVim and RStudio

I don't know if you have Rscript installed, but you should have. If you don't install R using this tutorial. Just run Terminal.app and run Rscript and if says "command not found", you need to install ...
hgiesel's user avatar
  • 1,944
4 votes

Can't get color output in MacVim's command line

I was facing same problem with gvim on Linux. Put following in your ~/.gvimrc set guioptions+=! Explanation from :help guioptions: '!' External commands are executed in a terminal window. ...
Nilesh Kevlani's user avatar
4 votes
Accepted

Cut and copy : Blackhole and default register assignment

First off, I think your first mapping is unnecessary. Since the second d is in operator mode, it does not get remapped to "_d, so it maps out to "_dd. Secondly, you could do this: nnoremap d "_d ...
DJMcMayhem's user avatar
  • 17.6k
4 votes

Where does MacVim send its printed files?

From :help pexpr-option: Expression that is evaluated to print the PostScript produced with :hardcopy. The file name to be printed is in v:fname_in. It's a bit of a hack, but you can simply ...
Martin Tournoij's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible