jamessan
  • Member for 6 years, 11 months
  • Last seen more than a month ago
Strange key combination: <CTRL-\><e> (in Cmdline mode)
Accepted answer
5 votes

:help CTRL-\Ctrl+D will show you all the help topics that contain CTRL-\. As you can see, there are a number of default keybindings that use CTRL-\. As to whether that will cause problems, well that ...

View answer
Re-activation of vim-youcompleteme
Accepted answer
3 votes

The addon packages in Debian/Ubuntu are typically managed using the vim-addon-manager package. Once an addon package is installed, you run vam install <addon> to enable it in your user's config....

View answer
How can I suppress feedback when calling vim with certain commands?
Accepted answer
4 votes

Use :silent to suppress the output of the command. vim +'silent 0,/^$/g/^\(Cc\|Bcc\|Reply-To\): $/d' /tmp/test

View answer
How to replace two-line match with its first backreference pattern?
Accepted answer
4 votes

I can't use first backreference (\1) instead of hardcoded string Well, you haven't captured anything in the search so \1 has no value in the replacement. You can use a matched text later in the ...

View answer
How to detect whether swp files contain unsaved changes?
8 votes

Is it possible to only have .*.swp-files, when file on disk and file in vim are different? Yes. The snippet below (adapted from tpope's vimrc) will disable the swap file for a buffer when it isn'...

View answer
What is an exhaustive list of "all the things" in vim?
Accepted answer
9 votes

Vim has a user manual (:help usr_toc) that covers all of these topics. It's good to browse through in general and can be a good starting point when you're thinking How do I do X in Vim?. Opening up ...

View answer
Indentation of preprocessor directives
Accepted answer
6 votes

This specific behavior is handled by the 'cinkeys' option. 'cinkeys' is similar to 'indentkeys' but is only used when 'cindent' is enabled. By default, it contains the 0# setting which causes the ...

View answer
searching duplicate words
Accepted answer
6 votes

:help /\w shows that \w is a regex metacharacter matching a word character -- any character that is either an underscore (_) or in the ranges 0-9, a-z, or A-Z. The example regex is parsed as \( ...

View answer
Filetype that LaTeX should be
Accepted answer
11 votes

When there's not enough information to decide otherwise, 'filetype' is set to the most basic -- plaintex. Your existing file must have had enough content for the detection to determine that it was ...

View answer
Do VimScript functions have to start with a capital letter and if so, why?
Accepted answer
12 votes

To quote :help user-functions The function name must start with an uppercase letter, to avoid confusion with builtin functions. The same restriction is placed on user-defined commands, although ...

View answer
Don't show tab characters as ^I or <09> in the output of :registers
4 votes

You chose to have them displayed that way by adding the uhex setting to the 'display' option. You can :set display-=uhex to restore the default behavior of displaying them as ^I. Getting :reg to ...

View answer
remap not working; <NL> in appears in other binding
Accepted answer
4 votes

This is due to a bug in Neovim. A suggested workaround in that bug is to run the following commands to adjust your terminal's terminfo entry to match what Neovim expects: infocmp $TERM | sed 's/kbs=^...

View answer
Prevent 'Press ENTER' when pathogen loads but keep for other scripts
Accepted answer
9 votes

Change the call pathogen#runtime_append_all_bundles() line in your vimrc to call pathogen#infect(), as the message suggests.

View answer
Ternjs plugin is not working as expected
1 votes

The documentation states (emphasis added): In JavaScript files, the package will hook into omni completion to handle autocompletion Omni completion doesn't automatically get triggered. It has to ...

View answer
Absolute script-file line-numbers in Vim-function errors
Accepted answer
5 votes

There was an RFC suggesting this, but there was no response from Bram at the time.

View answer
Did Vim ever use a different versioning scheme?
Accepted answer
6 votes

Yes, they were both caused by changes to the packaging and unrelated to Vim itself. The first epoch bump (since all packages without an explicit epoch have an implicit 0 epoch) was introduced when ...

View answer
c:\Program is not recognized error while running vimdiff
Accepted answer
4 votes

Getting a fixed Vim This specific bug was fixed in 7.4.103 back in 2013. Bram typically only publishes Windows installers on vim.org for major releases, so the installer there doesn't have this fix. ...

View answer
How to tell vim not to try to unzip a file
Accepted answer
17 votes

Functionality like this is handled by autocmds. In order to disable autocmds for a specific command, you can use :noautocmd (abbreviated :noau). In this case :noau e foo.xlsx will simply open the ...

View answer
How do I make vim look in a set of directories for a file, if it doesn't exist in the current directory?
Accepted answer
6 votes

Vim's 'path' option allows you to specify directories which commands like gf and :find will search for a file. If you only want this functionality to trigger for a specific set of files, then you ...

View answer
What is the easiest way to insert en dash in Vim?
10 votes

If there isn't a predefined digraph or you want a more memorable key sequence, then you can define digraphs in your vimrc. For example, the below will define two digraphs for en dash (8211) and em ...

View answer
Does Ex mode have any practical use?
Accepted answer
126 votes

Q is, as you found, ex mode. It's not entirely useful to use interactively, but it exists because Vim can be used to emulate the old ex binary. In fact, many systems provide the ex command by simply ...

View answer
Multiple buffers, same file, different settings
3 votes

Using multiple windows to view the same buffer allows you to view, edit, select, ... on different parts of a buffer. Syntax highlighting is a more complicated matter, depending on what exactly you ...

View answer
Define custom commands for the * and + registers
6 votes

A few <expr> mapping should be able to do the job here. The basic structure would be function! ClipboardOrXclip(command, register) if a:register !~ '[+*]' || has('xterm_clipboard') || has('...

View answer
Set the paste option, but for one insertion only
4 votes

except that I want to end up with the 'paste' still active if it was active beforehand. 'paste' should be active for as short a time as possible. It disables a lot of functionality (including maps), ...

View answer
Tab behaviour between :o and :cd
1 votes

Vim only includes the :o[pen] command for legacy reasons. The command you're looking for is :e[dit], which has all the completion behavior you would expect.

View answer
What types of buffers are there?
6 votes

Those posts are incorrectly using the term buffer when they mean register. As aharris88's answer shows, a buffer typically represents a file that is currently being edited. There are buffers that ...

View answer
Re-indenting badly indented code
19 votes

The = command can be used to reindent. Like most normal mode commands it can be applied to a motion, so you can reindent the just pasted code with =']. This reindents from the current cursor ...

View answer
How can I prevent Vim from leaving too many files (like swap, backup, undo)?
Accepted answer
16 votes

Backup files By default, Vim doesn't leave backup files behind. They are merely transient files that exist while Vim is saving the buffer to disk. As described in :help backup-table this behavior ...

View answer
ex mode choice of shell for external commands
Accepted answer
4 votes

TL;DR Vim runs the shell you would expect but in non-interactive mode. See your shell's documentation for non-interactive mode affects initialization, i.e. which init files are read. Vim uses ...

View answer
Cut vim load time
Accepted answer
18 votes

If you just want to see what's consuming start up time, then you can use the --startuptime option. vim --startuptime timing.out The file will look like this: times in msec clock self+sourced ...

View answer