💾 Archived View for sdf.org › blippy › vim.gmi captured on 2024-06-16 at 12:34:57. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-03-21)

-=-=-=-=-=-=-

vim

Created 2022-07-23 Updated 2023-09-02

Turn off highlighting

Until next search:

:noh

Turn it off completely:

set hlsearch!

Tips

no splits - current window as [o]nly window

ctrl w o

swap windos

ctrl w x

split opened buffers (horz)

ctrl w s

split opened buffers (vert)

ctrl w v

go to split

ctrl w h/j/k/l

open new file as split

:sp <file>

:vsp <file>

Bits and pieces

cc change line

=i{ Format code block

gg=G Format file

date insertion:

:r !date

movement:

H top of screen

M middle

L bottom

Start editor at end of file:

vim -c ' filename

Modeline

These are commands that you can embed in the files themselves. Force ino files to have C++ syntax:

// vim: ft=cpp

or possibly:

// vim: syntax=cpp

Actually, neither of the above seem to work properly. ... that's becuae /usr/share/vim/vim82/debian.vim has the line

set nomodeline

(Modeline not working)

To fix this, in ~/.vimrc:

set modeline

To convert tabs into spaces, e.g. for use in Zig, add the modeline:

// vim: set tabstop=4 sts=4 sw=4 sta et :

Substitution

Entire file, c to confirm:

:%s/x/y/gc

& - repeat last substitution

:s will repeat :s/x/y/

:sg - repeat :s/x/y/g

xlink

See also

unicode/digraphs

zettel 6

EXITS

Leader mechanism