36 votes

Why is VIM starting in replace mode?

Seems to be an issue with utf-8 ambiguous characters and Windows cmd console. Flag t_u7 is set by default and so vim will request cursor position and get a bad reply from the ssh client. Workaround: ...
Zoran Bikicki's user avatar
35 votes

How to use vimium to select text from a page

If you specifically want to search for mailto but then select verycomplicatedandlong... i.e. search one string in order to find the second (unknown) string, which you then want to select. / mailto ...
Filip Nikolov's user avatar
18 votes

Why is VIM starting in replace mode?

I have just identified that the issue only occurs when connecting to the remote system using the native OpenSSH client released with Windows 10 1709 using the ConEmu terminal emulator. If I use the ...
Michael's user avatar
  • 641
14 votes

How do I select all text in Vi/Vim?

I am using Vim 7.4 in CentOS-7 environment. Which worked me for selecting all the text is :%y Then just p in the next file where I want a full copy. Or You can use cat command. cat copyfile >...
Sachith Muhandiram's user avatar
9 votes
Accepted

Hiding vim command-line when it's not being used?

set cmdheight=0 achieves this functionality in Neovim from now on, thanks to the efforts of developer Shougo Matsu and the Neovim maintainers!
iono's user avatar
  • 380
8 votes

Is there a command to split lines in Vim?

The easiest way I've found to split lines in Vim is the normal mode command gq (type both letters in quick succession in normal or visual mode): In visual mode, it will split whatever is selected. ...
vdicarlo's user avatar
6 votes

How to use the mouse to scroll up/down in MacOS Yosemite Terminal when vi is open

In Terminal select Terminal -> Preferences -> Profiles -> Keyboard -> Scroll Alternate screen (unchecked) to reset the behavior
Bmayer0122's user avatar
6 votes

How to show the current Vi mode when using Vi keybindings in the shell?

To anyone having this exact problem (like myself): I found a solution at stackoverflow. Apparently there is native support for this in readline, so you can just add the following to your ~/.inputrc: ...
ber532k's user avatar
  • 61
4 votes

Why does VIM say there are trailing characters on this command?

You might have used # for comments inside .vimrc whereas you should use " instead. Example In this ~/.vimrc file, the first line is the right way: " Correct comment # Incorrect comment The ...
stevec's user avatar
  • 767
4 votes

vi: How do I save without exiting the editor?

These commands operate only on the current buffer: :write, or :w to save :update, or :up to save only if changes were made (vim only) :wq to save (current buffer only) and quit :exit, or :x to ...
bewilderex63's user avatar
4 votes

How to use vimium to select text from a page

You might find the directions for Vimium Visual Mode helpful: https://github.com/philc/vimium/wiki/Visual-Mode They also include Caret Mode. They are the same as vim in general, though perhaps not as ...
jasonleonhard's user avatar
4 votes
Accepted

Use sed to replace part of a string leaving other part represented by regex unchanged

Use a capture group that retains the first uppercase letter: sed "s/\([A-Z]\) Egg/\1 Chick/" file.txt A Chick b Egg C Chick D Chick E Pig Where: \([A-Z]\) is the capture group 1 that contains the ...
Toto's user avatar
  • 17.9k
4 votes
Accepted

Fish shell: Map jk to enter normal mode (in vi mode)

Yes, try this: bind --mode insert --sets-mode default jk repaint This adds a key binding when in insert mode, which switches the mode to default. The key sequence of the binding is jk, and its ...
ridiculous_fish's user avatar
3 votes

Notepad++ visibility for BOM

Following up from Abdull's comment above was able to view ff fe or ÿþ as the Unicode big endian (BE) byte order mark in the N++ hex plugin for N++ (v6.88). Once the plugin is installed click Plugins >...
Laurie Stearn's user avatar
3 votes

How to insert enough spaces to align text to column number using Vim?

You can do it with no plug-in, like this: :%s#\(.*\)\zs\ze-e#\=repeat(' ',58-len(submatch(1))) Note: This assumes that -e is the last of line. But you can capture it otherwise if it is not suitable ...
bzbzh's user avatar
  • 31
3 votes

Vi on Linux: show ^M line endings for DOS-format files

To show dos line endings for the current file: :e +ff=unix This forces the fileformat to unix, which will render CR as ^M To make this setting permanent, add to ~/.vimrc: set ffs=unix Note that ...
wisbucky's user avatar
  • 3,086
3 votes

How to get rid of the warnings when opening a file that has a .swp file?

This happened to me when my terminal unexpectedly closed my connection with vi open. Thankfully I had no changes lost. To remove that warning and discard the swap: Find the process id looking at ...
kintsukuroi's user avatar
3 votes
Accepted

Copy and paste using vi duplicates comment lines

:set paste before paste. It disables auto indent and auto completion temporarily. And you can revert settings with :set nopaste
jinhwanlazy's user avatar
3 votes
Accepted

vim shortcut for moving to beginning of previous line not working

To get to the first non whitespace character in the previous line you send the minus sign to VIM, you do that just by pressing the button next to the equal sign and plus, you don't press shift to send ...
ojs's user avatar
  • 955
3 votes
Accepted

How to enter Vi / Vim command mode with `;` instead of `:`?

nnoremap ; : See also :help map.
u1686_grawity's user avatar
3 votes

How to use vimium to select text from a page

As a slight improvement on Filip's answer, I would suggest searching for mailto like he suggested, but then going into visual mode right away, then using w or e to select text to the end of the ...
potatop's user avatar
  • 31
3 votes

How to make Vim "repeat search" direction absolute instead of relative?

Here is the solution to add into your .vimrc Based on this solution https://vi.stackexchange.com/a/2366 nnoremap <expr> n (v:searchforward ? 'n' : 'N') nnoremap <expr> N (v:searchforward ?...
Nicolas LIENART's user avatar
3 votes
Accepted

Ctrl+c/Ctrl+v/Ctrl+p not working on vim

The solution to this is simply use a vim version with access to clipboard. To see if your vim version has access to clipboard, run: vim --version | grep clipboard If you see +clipboard or +...
victor locateli's user avatar
2 votes

How to get rid of the warnings when opening a file that has a .swp file?

How can I get rid of the annoying warnings when I open a file that has a .swp file? Use the short message option in your ~/.vimrc: set shortmess=A Which is also the default when running POSIX mode. ...
bishop's user avatar
  • 200
2 votes

Repeating through lines in vim

For interactively doing this without much thought and preparation (in case you have already entered the text on the first line but you later notice that you need it on several lines): Insert the text ...
offchan's user avatar
  • 131
2 votes
Accepted

Why provide vi and vim?

Old question but it's still true Redhat provides vi removing dependence on /usr (except for ftdetect - probably harmless) and a whole lot of modules that at one time had security issues. Vim is part ...
chipfall's user avatar
  • 176
2 votes

I'm using Bash in "vi mode". What's the hotkey sequence to edit the current command line using an external editor?

How to disable edit-and-execute-command for the v key in vi\vi-command\vi-movement mode: You cannot rebind it to nop, since it will automatically be rebound (see post by unforgettableid). Instead, ...
tsorn's user avatar
  • 121
2 votes

Is there a command to split lines in Vim?

You can use the s substitute request with the \r carriage return. Consider a file with this sentence at line one: This is sentence one. This is sentence two. Then this will split the sentences into ...
Sean Burns's user avatar
2 votes

How to get vim color mode to work in vim under cygwin

For Cygwin by default, if you haven't installed vim you actually have vi. So just go onto Cygwin setup and search for vim and its under the Editors. Then colored syntax should all be enabled no ...
Mark's user avatar
  • 500

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