Hot answers tagged

20 votes

Most annoying slow-down of a plain-text editor!

Can somebody tell me how to avoid the very annoying vim's slowdown? Hopefully in a user friendly non-geeky way? I run Vim on a company-provided 2013 15" Retina MacBook with a 2.3 GHz i7 processor, 16 ...
romainl's user avatar
  • 40.1k
15 votes

How can I get Vim to ignore all user configuration, as if it were freshly installed?

One way to eliminate user-specific files would be to use a different value of $HOME. To allow nothing to be read, or written to (such as viminfo), you could use /dev/null: HOME=/dev/null vim -u NONE ...
muru's user avatar
  • 24.8k
12 votes

How to execute a command on vim startup

In my opinion, the cleanest method of doing this is simply to add the command to a file in your .vim/vimfiles directory: ~/.vim/after/ftplugin/python.vim or for Windows: $HOME\vimfiles\after\...
Rich's user avatar
  • 31.7k
12 votes
Accepted

How to load files as a quickfix window at start-up

Vim has a startup option -q to read a quickfix file. So we have options (depending on your shell): cmd > results vim -q results Or my favorite vim -q <(cmd)
D. Ben Knoble's user avatar
  • 25.8k
11 votes

The simplest way to start Vim in private mode

Well, a bit belated but to respond to: Some magic (from a comment by Carpetsmoker in this thread) My general idea was that you always want to start "private mode" if you're using an ...
Martin Tournoij's user avatar
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
  • 14k
9 votes
Accepted

Why does gvim read /usr/share/vim/vimrc instead of ~/.vim/vimrc

Reading system-level configuration before user-level configuration is totally normal and expected in UNIX land. Anyway, this sentence: The files are searched in the order specified above and only ...
romainl's user avatar
  • 40.1k
9 votes
Accepted

How to execute a command on vim startup

Add in your .vimrc: au BufEnter *.py :TagbarToggle<CR> where au is autocmd, execute the command automatically. BufEnter is when you enter the file for first time. *.py is for filetype python. ...
kapil's user avatar
  • 428
6 votes

start vi automatically in hex mode

To start vim automatically in hex mode when editing a.out, put an autocommand like this one in your ~/.vimrc: au BufReadPost a.out silent %!xxd A more complete explanation with examples can be found ...
garyjohn's user avatar
  • 6,299
6 votes

E576: Failed to parse ShaDa file: extra bytes in msgpack string at position 3

TL;DR: skip to the Resolution section. Background The issue is that neovim can't read/write vim's viminfo file format. Instead of using vim'sviminfo format for storing editing session information, ...
Tom Hale's user avatar
  • 2,641
5 votes

Is there some way to echo from terminal into new vim buffer

You can do this from directly inside of vim with the :read command, which is abbreviated to :r The 'read' command is intended to allow you to read a file, e.g. :r foo.txt Will insert the contents ...
DJMcMayhem's user avatar
  • 17.5k
5 votes
Accepted

How to detect whether Vim has been invoked by another shell command?

Since vipe, git commit (and many other programs which invoke an editor) use the VISUAL and EDITOR variables (unless you specify an editor for git with git config core.editor), you can use that ...
muru's user avatar
  • 24.8k
5 votes

How to detect whether Vim has been invoked by another shell command?

I don't know how reliable it is but I found how to get the PID of the parent of a process here: ps -o ppid= -p <pid of the process> And how to get the name of a process from its PID here: ps -...
user9433424's user avatar
  • 6,118
5 votes
Accepted

Strange vim/xterm interaction: auto-insertion of `"` register when opening file

When vim starts up, it interrogates your terminal emulator, which responds with terminal codes. vim usually captures this in v:termresponse. Sometimes, however, the codes get through and they ...
Mass's user avatar
  • 14k
5 votes
Accepted

Run `vim -c <command>` before loading vimrc?

If you run vim --help you'll find the answer... $ vim --help | grep vimrc --cmd <command> Execute <command> before loading any vimrc file Some additional details under :help --cmd .....
B Layer's user avatar
  • 19.7k
4 votes
Accepted

Is it possible to open multiple files at the end or at the first occurrence of a string?

One workaround would be to use :argdo (which runs an ex command in each file in the argument list): vim +"argdo norm G" file1 file2 vim +"argdo /searchPattern" file1 file2 You will be left in the ...
Rich's user avatar
  • 31.7k
4 votes

Global plugins source only once?

It's described in :h startup/§:h load-plugins. You'll see that indeed plugin files are loaded only once. Yet, most plugin files have guards. They mainly serve to permit end-user to not load an ...
Luc Hermitte's user avatar
  • 17.3k
4 votes
Accepted

How to make Vim start at the end of a template?

If you associate a template to a file extension using the following autocmd: autocmd! BufNewFile *.foo 0r ~/vimfiles/template/template.foo The autocmd import the ~/vimfiles/template/template.foo when ...
Vivian De Smedt's user avatar
3 votes
Accepted

When are the files in ~.vim/after/ loaded?

Add them into ~/.vim/after/ftplugin/tex/. :h 'rtp' IIRC and :h ftplugin
Luc Hermitte's user avatar
  • 17.3k
3 votes

`E575: viminfo: Illegal starting char in line: ...` on startup

To solve this: rm ~/.viminfo vim ~/.viminfo # new file, leave it blank, then just wq. source terminal et voila
Eric Y's user avatar
  • 31
3 votes

`E575: viminfo: Illegal starting char in line: ...` on startup

For me, this problem keeps showing up even if I delete the ~/.viminfo file - not right away, but a couple of days later. I just noticed there's a way to skip using the viminfo file entirely, as ...
Brad Parks's user avatar
3 votes

How can I start vim and then execute a particular command that includes a \, from the command line?

If your goal is to use mapleader and you have it redefined in your .vimrc let mapleader = ',' that wouldn't work. You can use $ vim -c 'execute "normal ".get(g:,"mapleader","\\")."t"' instead. ...
albfan's user avatar
  • 178
3 votes

Specify GDB version for Termdebug

As pointed out by Christian (all credits to him) in this comment, setting g:termdebugger does the trick. Put this into your .vimrc: let g:termdebugger='/path/to/your/gdb' Single quotes are needed.
Paulo's user avatar
  • 31
3 votes

How to load files as a quickfix window at start-up

If you'd like to invoke the command from inside Vim and populate the quickfix window with its output, you can use :cexpr together with system() or systemlist(). :cexpr system('...
filbranden's user avatar
  • 28.7k
3 votes
Accepted

Interpreting the output when using --startuptime

How can I interpret the output? I can't find documentation to verify my assumptions (I checked :help startuptime). See just below :h :profd: You must always start with a ":profile start fname" ...
user938271's user avatar
  • 5,907
2 votes

Is there some way to echo from terminal into new vim buffer

If you want to just get the input from a terminal command, then just do the following ls | vim - Same for any other command output you want to pipe to Vim. If you want to read the output you can use ...
Durga Swaroop's user avatar
2 votes

The simplest way to start Vim in private mode

According to Vim documentation (:help -c) there can only be a maximum of 10 +{command}, -c {command} and -S {file} option arguments combined when starting Vim, and they execute _after_ the first file ...
mvanle's user avatar
  • 121
2 votes
Accepted

How to pause (with message) during .vimrc startup?

Problem description You're trying something that Vim was not really meant to do. Although your VimScript does work, I've modified it to: redraw! echo "xa" redraw! let i1 = input("y123456") redraw! ...
grochmal's user avatar
  • 1,656
2 votes

Vim immediately sent to background

I shouldn't have set the shell as interactive. Somehow it pauses the main Vim process. So: set shell=bash\ -i Should be: set shell=bash
ayyylter's user avatar

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