24 votes
Accepted

Why does typing 'q' exit vim? (.man file)

The Vim editor will load the man filetype plugin (ft-man-plugin) whenever it opens a file which has a .man filename suffix. A more usable way of using this plugin is by loading it with :runtime ...
Kusalananda's user avatar
  • 334k
10 votes
Accepted

Can a file be closed in vim without exiting?

That would be :bd. :help :bd in vim 8.2 gives: :[N]bd[elete][!] *:bd* *:bdel* *:bdelete* *E516* :bd[elete][!] [N] Unload buffer [N] (default: current buffer) and ...
Stéphane Chazelas's user avatar
7 votes

How to make bash keyboard editing default to vi from emacs?

You can set it in /etc/profile which should be read by all login shells including (depending on your setup, this varies) when logging in graphically. So add set -o vi to /etc/profile, and then add ...
terdon's user avatar
  • 242k
4 votes
Accepted

Vim does not display other files in the same folder when opening a file

What you are referring to is called the "wildcard menu". This shows the filnames that match the pattern under the cursor when you press Tab after :e. Since there is no pattern, all ...
Kusalananda's user avatar
  • 334k
3 votes
Accepted

How to force write (`:w!`) and quit (`:q`) vim in the same command?

As mentioned in other answer you can use command like: :wq! But you can simplify the command by enter: :x! (x=wq in this case) Maybe you can consider reading this answer in StackOverflow.
Romeo Ninov's user avatar
  • 17.5k
2 votes

Open multiple files in Vim with a filelist

If you are already inside vim, you can set :args from inside vim: :args file-1 file-2 ... file-n Bonus, on Unix you can also do: :args `find . -name Makefile` (assuming file paths don't contain ...
CervEd's user avatar
  • 174
2 votes
Accepted

Using vim, how do I fix word wrapping with leading comment markers like #

As muru points out in comments, the command gq} would do this, if the cursor is initially located on the first line of the text that you want to reformat and you want to reformat the rest of the ...
Kusalananda's user avatar
  • 334k
2 votes

What's overriding my .vimrc tabstop size setting for CMake files?

To see in which startup files an option was set, use :verbose set <option>?. From :help :verbose-cmd: When 'verbose' is non-zero, listing the value of a Vim option or a key map or an ...
muru's user avatar
  • 72.9k
2 votes
Accepted

Vim intercepts ssh escape

From comments: How does it work if you press the Return/Enter key before you press the tilde and Control+Z keys? - Sotto Voce if I do this, it does put ssh in the background. Why does Return/Enter ...
Sotto Voce's user avatar
  • 4,131
1 vote

Fontawesome icons are not pasted correctly

Font Awesome fonts have their icons assigned to code points in the Unicode Private Use Areas. These are sets of code points which can be used when an application needs "characters" that are ...
Jean Abou Samra's user avatar
1 vote
Accepted

Vim enable Ctrl+Shift+C

From How to copy text from vim to an external program? Hold down the Shift key and select text with the mouse cursor. Text will be copied to the clipboard. This also works for pasting from the ...
user2624583's user avatar
1 vote
Accepted

.vimrc file not working

Line 3 of your .vimrc file should probably be: highlight GoComment ctermfg=blue You can only choose between term (normal terminal), cterm (color terminal, including xterm) and gui. As for your last ...
xhienne's user avatar
  • 17.8k
1 vote
Accepted

Vim keeps resetting textwidth to 0, why?

Vim doesn't keep your settings between sections like that. You have to build a .vimrc config file (in your home directory) and add the settings you want, this way each time Vim loads it includes the ...
TechLoom's user avatar
1 vote
Accepted

Mouse events not working in Vim on Debian?

The TERM environment variable controls what character sequences are sent and received by programs and the proper value depends on the terminal emulator. Inside tmux, you generally want one of the ...
bk2204's user avatar
  • 4,109
1 vote

Highlight for two strings simultaneously in vi or less editor?

To search for either foo or bar, it's /foo|bar in less where less regexps extend POSIX extended (egrep-like) regexps where | is an alternation operator. And: /foo\|bar Or /vfoo|bar in vim where vim ...
Stéphane Chazelas's user avatar
1 vote

How can I automatically wrap every command in Zsh/Bash with a custom command before execution?

I will assume you will want to enter and exit out of this arrangement so I made the following. For zsh, the DEBUG trap handler can skip the execution of a submitted command by setting the ERR_EXIT ...
Joakim Hagen's user avatar
1 vote

How can I automatically wrap every command in Zsh/Bash with a custom command before execution?

Considering the Goal, The easiest solution would be to pipe the result of your command to vim like below. $ yourcommand | vim - For example, $ grep -rn hello | vim -
Manmohan Krishna's user avatar
1 vote
Accepted

tying together the 'xxd' command with output

The hex dump displays characters from 0x00 (0) to 0xEA (234). This makes 235 characters in total. Your command xxd -ps extras.md | sed 's/\(..\)/\1\n/g' also outputs 8 additional empty lines (the end ...
xhienne's user avatar
  • 17.8k
1 vote

open man (or info) pages from the same position where you left off last time

Here is an solution in TXR Lisp, using Vim as the viewer. Works with Vim 8.0 on Ubuntu 18. (Please translate to your favorite language; this is mine, I made it myself.) This file is called mnpgr.tl ...
Kaz's user avatar
  • 8,476
1 vote

"E492: Not an editor command: PlugInstall" only when I "sudo vim"

Rather than sudo vim, put these two lines in your ~/.bashrc (or your shell's startup file): export EDITOR=$(type -p vim) export VISUAL=$(type -p vim) Then you can sudoedit filename, which will: ...
waltinator's user avatar
  • 4,875
1 vote

Map <C-S-A-hjkl> to Arrow Keys with XKB Map

using a similar setup with caps+hjkl via xkb. i'm sure you can adapt it easily. caps is set as level5 modifier. 1. put xkb_symbols "vim" in ~/.config/xkb/symbols/vim-keys default partial ...
konni's user avatar
  • 11
1 vote

Vim to print file on terminal and exit

If you are constrained by your system and cannot install additional programs, then this will work. Thanks to bogec for starting a good path, now I've finished it by adding the following "alias&...
Kel_Sceptic's user avatar
1 vote

vim: create file with +x bit

I wrote myself a version of this that is a bit more selective. It only makes the file executable when writing a new file, and only if it starts with #!. This version also avoids executing an external ...
ryanc's user avatar
  • 115
1 vote

Do I need to recompile Vim if Python changes a minor version?

As others have mentioned, the bump from Python 3.10 to 3.11 isn’t a minor version change. See the 3.11 release announcement for details (Python 3.10 was released a year earlier). The 3.11 library isn’...
Stephen Kitt's user avatar
1 vote

Issue with weird visible right and bottom Borders inside Terminal programs

Terminal emulators work with a grid of rectangular character cells, each having the same size. You have probably noticed with "regular" window managers that most terminal emulators resize in ...
egmont's user avatar
  • 5,886
1 vote
Accepted

How to make vim cursor to be in central line always?

The scrolloff (so) option is documented like this in Vim (:help 'scrolloff', with my emphasis below): Minimal number of screen lines to keep above and below the cursor. This will make some context ...
Kusalananda's user avatar
  • 334k
1 vote

How to move Vim's -- INSERT -- to another place of monitor

The element where you see -- INSERT -- is the statusline (:help statusline explains more). vim can't move that around, so the only way forward is to ask your window manager to not extend windows to ...
Marcus Müller's user avatar
1 vote

Why is vim frozen?

If you're running vim in gnome-terminal, right clicking on the terminal and making sure the "Read-Only" option isn't checked in the resulting context menu might help. When I run vim in gnome-...
Dave's user avatar
  • 111
1 vote

refresh changed content of file opened in vi(m)

Here's a lua version for neovim: -- Triger `autoread` when files changes on disk -- https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044 -- https:...
Christopher Poile's user avatar
1 vote

Copy-paste for vim is not working when mouse (:set mouse=a) is on?

(Updated as per discussion in comments) Ok so just follow these frustrating steps to make vim behave sanely (allow mouse copy and keep syntax highlighting): Option 1: 'system-wide' in /etc/vimrc, ...
AmanicA's user avatar
  • 205

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