21
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 ...
14
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)
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\...
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('...
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.
...
7
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, ...
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 ...
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 ...
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 -...
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 ...
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 ...
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 .....
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 ...
4
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" ...
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 ...
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 ...
3
votes
Accepted
When are the files in ~.vim/after/ loaded?
Add them into ~/.vim/after/ftplugin/tex/.
:h 'rtp' IIRC and :h ftplugin
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
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 ...
3
votes
How can I change Vim's start or intro screen?
Perhaps it's a bit of a hack, but the following one-liner anywhere in the .vimrc file will effectively truncate the Vim splash screen to a length of zero:
set shortmess+=I
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.
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('...
2
votes
Why does this <Esc> normal mode mapping affect startup?
I have found that mapping ESC in /home/.vimrc will open vim with replace command. Instead, I did the exact mapping but in /etc/vim/vimrc file and the mapping is executed successfully without the ...
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 ...
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 ...
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!
...
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
2
votes
Is there a way to edit secure data in vim without accessing the filesystem?
There are some things hidden in the vim docs that can help you.
read ! your shell command: read the output of "your shell command" into the current buffer (a tempfile is used to read the data!)
let ...
2
votes
Hide bottom message when open new file
as suggested by Carpetsmoker in comments, here is how I solved this:
set shortmess+=F
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
startup × 79vimrc × 19
neovim × 12
key-bindings × 5
microsoft-windows × 5
command-line × 4
normal-mode × 4
netrw × 4
invocation × 4
vimscript × 3
autocmd × 3
insert-mode × 3
macvim × 3
options × 3
performance × 3
debugging × 3
gvim × 2
terminal × 2
colorscheme × 2
plugin-system × 2
filetype × 2
linux × 2
error × 2
multiple-files × 2
security × 2