Hot answers tagged

13

You can see that here: :h viminfo If you exit Vim and later start it again, you would normally lose a lot of information. The viminfo file can be used to remember that information, which enables you to continue where you left off. :h .netrwhist The file ".netrwhist" holds history when netrw (and vim) is not active.


4

Fix entries in ShaDa File (neovim-specific) Neovim does not use anymore the plaintext file viminfo (used by vim) to store this but uses a msgpack formatted file called ShaDa (short for shared data, :h shada). If you do not know where this file is, see :h shada-file-name and this tells you The default name of the ShaDa file is "$XDG_DATA_HOME/nvim/shada/...


4

viminfo is an option, @Tommy A forgot the keyword set in his command: set viminfo+=n~/.vim/viminfo should work properly. If you read :h 'viminfo' you can see an example: :set viminfo='50,<1000,s100,:0,n~/vim/viminfo Edit As @Carpetsmoker mentioned it in the comments, neovim has a different format for these options so one should use the following: if ...


4

See the viminfofile option (:help viminfofile), which is set when using the -i command line flag.


4

I guess I found a good solution for my use case. -i option allows to specify alternative locoation of viminfo file. So I can specifey vim -i /tmp/blackhole for cases where I do not care of file history. In my case that is specifying set editor = "vim -i /tmp/idontcare" in my .muttrc


3

There's nothing built-in; I guess the reasoning is that spelling (at least for a certain language) is inherently global. Any differences should be reflected in the language / dialect chosen. You can implement such buffer-local spelling exception yourself: Get a temp file via tempname(), prepend it to 'spellfile', and then zg / 1zg will place the exception ...


3

TL;DR This seems to be a bug in vim where set nocompatible is not idempotent and doesn't follow the principle of least astonishment. As a workaround, either: Ensure that you set nocompatible (or the equivalent set nocp) only once, and at the top of your vimrc. Don't set it if it's already set: if &compatible | set nocompatible | endif " Avoid side ...


3

:help viminfo contains general information on the feature but not settings. :help 'viminfo' (note the apostrophes) is the documentation on the actual option settings. The key bit is < which sets the max lines saved per register. You are also forced to set a value for ' (max files marks are saved for). While I was at it I increased s (max Kbytes saved per ...


2

it can be configured with the " character of the viminfo option From :help 'viminfo: " Maximum number of lines saved for each register. Old name of the '<' item, with the disadvantage that you need to put a backslash before the ", otherwise it will be recognized as the start of a comment!


2

Do you mean swap files? .viminfo is stored in your home directory, even when you're editing files on external disks. Swap files default to being stored in the same directory as the file you're editing though. You can use settings viminfofile and directory to set where the .viminfo and swap files (respectively) are stored, so that they are stored within an ...


2

Marks are stored in viminfo not in a session and the viminfo file is only written when exiting vim. So if you are closing vim to switch projects then vim will only have marks for the previous project that you were working on. One would potentially have to come up with a plugin that separately reads and stores marks from viminfo when calling :mksession and ...


2

Is there an easy setting to make this switch? Nope I know I could write some vimscript to save my session marks somewhere and reload them to overwrite whatever viminfo is doing, but I don't want to spend the time if I don't have to. That is exactly how you would do this. Example code: command! -bang -complete=file -nargs=? Mksession mksession<bang&...


2

In Vim, if you look at the source code for buflist_new() which adds a filename to the buffer list you'll find the part where the b: dictionary is initialized // init b: variables buf->b_vars = dict_alloc(); if (buf->b_vars == NULL) { vim_free(ffname); vim_free(buf); return NULL; } init_var_dict(buf->b_vars, &buf->b_bufvar, ...


1

:help viminfo-% gives you some hints on how to achieve this: Quickfix ('buftype'), unlisted ('buflisted'), unnamed and buffers on removable media (|viminfo-r|) are not saved. I would simply make those files unlisted; as Vim is invoked from the version control system for the commit message, and usually no other files are edited within that session, the ...


1

You can also use the r option. See :h viminfo-r: r Removable media. The argument is a string (up to the next ','). This parameter can be given several times. Each specifies the start of a path for which no marks will be stored. This is to avoid removable media. For MS-DOS you could use "ra:,rb:", for Amiga "rdf0:,rdf1:,...


1

As Herb Wolfe wrote in his comment this is a problem with the viminfo file. On Windows this is $HOME\_viminfo (~/.viminfo on Unix). The viminfo files is written when Vim exits and stores information to be available when Vim starts again. This contains command line history, search history, register and a lot more. See :help viminfo for the details. For some ...


1

Logging in and out of the shell solved it for me after all else failed. Defining let $HOME="/root" in .vimrc does not help as it can not find $HOME directory to read the .vimrc if :!echo $HOME shows nothing, i.e. is empty. ;-)


1

You have a couple of options here. I thing Vim inside Git Bash can access the windows clipboard, so you can try the following: q: to enter to history 'edit' mode, then k many times as needed or search for your pattern with ?, and then 0v$ "+y Here + is the register for the clipboard. After the previos commands you can paste on the bash prompt without ...


1

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 should try to avoid doing so unless necessary. In this case, Administrator is really not necessary. From :help viminfo-file-name: The default name of the ...


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