Hot answers tagged

5

The difference is that :find will actually search for a file by that name in the list of directories specified in 'path'. The default 'path' contains . (which is the path of the current file), then /usr/include (on Unix platforms, like Linux and Mac OS) and then an "empty" entry, corresponding to the current directory. Which means if you're editing src/...


4

I've had these mappings in my dotfiles for years and they are so useful that I forgot that it's not a built-in feature: " Quickly insert an empty new line without entering insert mode {{{ nnoremap <Leader>o o<Esc>0"_D nnoremap <Leader>O O<Esc>0"_D They are the equivalent of o and O but without entering insert mode. The ...


4

If installing a plugin is an option, Tpope's vim-unimpaired is a great pick which provides a mapping to insert empty lines: ]<space> to insert a line under the current line [<space> to insert a line above the current line Both accept a count, so 42]<space> will put 42 new lines under the current position.


3

You are looking for :set nomodifiable which disables any changes which you will try to do in some buffer. Look here, :h modifiable.


2

Looks like a vim bug: https://github.com/vim/vim/issues/7348 Which Christian Brabandt has opened a PR to fix: https://github.com/vim/vim/pull/7350 It was merged and released in Vim version 8.2.2039.


2

Create a new window, read file from disk into it and show the differences. Kind of this vnew +read\ # | windo diffthis More complete version is discussed at :h diff-original-file. Also, a ton of variations in personal configs/gists/similar SO topics etc.


2

Most “core” filetype features are covered by autocommands, so disabling them will have the effect that you want. But we only want to disable them when opening a particular file, so :noautocmd edit {file} I’ll update with more information on the autocommands and features when I get to my laptop.


1

Here's two vim versions of the "recursive, lazy, sed substitute" that the function is performing. Both involve the same technique: filling one of vim's special lists and then calling the corresponding do command. Using the arglist The arglist can be filled with files and traversed with :next, :prev, and a few other commands. Conveniently, we can ...


1

If you read the specified help section (:h W11) you'll get some details on what's going on. In short, the file from which you loaded the current buffer has changed. Specifically, its timestamp and content are different Without some extra steps (below), you can only keep one version. To keep what you're currently looking at press Enter. L will load whatever ...


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