Vim Tips

Link to section 0bc66624-783b-4972-9867-25e5c2ea2657

Rotate Vim windows to cycle through splits

vimwindow-layoutsplit-windows

Loading...

Link to section c291f6e1-9c42-4d2f-bc3b-5bb701f177d8

Maximize and equalize Vim window sizes

vimwindow-resizewindow-splitsvim-mappings

Loading...

Link to section 23f98f6f-0600-4366-b0af-87ab69ae97f1

Toggle between two buffers in Vim with Ctrl-^

vimalternate-bufferbuffer-managementsplit-windowskeyboard-shortcuts

Loading...

Link to section 936fd319-9659-4aec-b352-bb56f66948e8

Batch substitutions with vimgrep and cdo in Vim

vimquickfixsearch-replacebatch-editing

Loading...

Link to section 1a993096-471e-4d64-9a27-6b9a23cab653

Toggle vim search highlighting to reduce visual noise

vimhlsearchnohlsearchsearch-highlightingreadability

Loading...

Link to section 1eb16162-844f-4c9b-be63-cb2f183b0c98

Vim marks for cross-file navigation

vimmarksglobal-marksbuffer-navigationcross-file-navigation

Loading...

Link to section ffd7e74b-a5a2-40fa-80e9-898c84504d36

Execute a command in all Vim tabs with :tabdo

vimtabdotabswindowsbuffers

Loading...

Link to section 2f092388-75cb-4f18-9718-989c49faa73d

Sort lines in Vim with external sort

vimsortexternal-filterdeduplicationvisual-selection

Loading...

Link to section bad0cf1b-f455-4328-9e75-cacf7c7ba390

Run Ex commands across all Vim windows

vimwindosplit-windowsex-commands

Loading...

Link to section 7c4d1218-71bd-42d5-8eda-7aa2df195066

Enable absolute line numbers in Vim

vimabsolute-line-numbersgo-to-line

Loading...

Link to section c1c9fabc-9ecc-41bc-b4db-01150dcc0730

Ctrl+O in insert mode runs a single normal mode command

vimctrl-oinsert-modenormal-modeone-shot-command

Loading...

Link to section 260e5c95-abe8-4220-8c4a-428da2cfd4f9

Indent and unindent lines in Vim using >> and <<

vimindentationnormal-modevisual-modeshiftwidth

Loading...

Link to section 9808efca-ba7a-4529-9833-016801f6570a

Using vertical splits in Vim with :vsplit

vimvertical-splitsplit-resizediff

Loading...

Link to section 28001d21-3de3-46d8-816c-74750234d6bd

Open file under cursor with gf in Vim

vimgfopen-fileinclude-pathrelative-path

Loading...

Link to section 646c0e31-7d2e-4329-9c52-7b5cc5e95516

Record and replay a Vim macro in register a

vimmacro-recordingmacro-replaytext-editing

Loading...

Link to section 9858dfb7-3c5c-4b92-9fc6-2bd84980d0d2

Vim substitution with confirmation

vimsubstituteconfirmationdelimitersregex

Loading...

Link to section 86a7861a-6687-4991-a51f-e49ada906bb6

Insert evaluated Vimscript expressions in insert mode

viminsert-modeexpression-registervimscript

Loading...

Link to section 7171c114-b9e3-4b45-b0b6-d4b4f5c2e1db

Delete lines matching a pattern in Vim

vimex-commanddelete-linesinverse-globalregex

Loading...

Link to section dc6a176c-a486-4e5f-857c-56f7aae6a7dc

Format text with gw to keep cursor position in Vim

vimgwgqreflowtextwidth

Loading...

Link to section 65a61fc7-e60a-4aee-94c0-5608f38253c7

Reselect the last visual selection with gv

gvvimvisual-selectionrepeat-action

Loading...

Link to section a42afe0a-5558-471a-96f7-ec39db936db4

Repeat the last Ex command in Vim

vimrepeat-last-commandex-commandssubstitutiondeletion

Loading...

Link to section 0adc99bf-ea06-427b-a8ab-89f06c87bbc4

Vim word matching with * and # commands

vimwhole-word-searchsearch-forwardsearch-backwardnext-match

Loading...

Link to section fce34c40-0792-4c46-a282-02db699d80be

Save a file with sudo in Vim using tee

vimsave-with-sudosudoteesave-file

Loading...

Link to section 545acf86-3e69-4f3c-9f40-cde542993449

Encrypt a file by starting Vim with -x

vimencryptionpasswordencrypted-file

Loading...

Link to section f0fbe933-11af-4157-8ea6-96fe787bac2e

Load all text files into Vim using argument list

vimargument-listfind-commandnavigation

Loading...

Link to section 50f42af9-ee50-4cf3-a65c-bb649c80f740

Using Vim visual mode to select and edit text

vimvisual-modeyankdeletechange

Loading...

Link to section 0e58c0e5-0871-4b62-b197-7d4eee902775

Change the inner word with ciw in Vim

vimciwchange-inner-word

Loading...

Link to section b5e50fc8-f662-49f7-b422-2973aa660347

Sort and deduplicate lines in Vim with %!sort -u

vimsortdeduplication

Loading...

Link to section b8234cd8-f7b9-4c6d-81eb-8538ff61fad6

Using macros in Vim for repetitive editing

vimmacrosmacro-recordingreplaybatch-editing

Loading...

Link to section 7a1e219e-177c-4aaa-ae70-7257ef43ae3d

Open a terminal inside Vim with :terminal

vimterminalsplit-windowsgit

Loading...

Link to section 20c1dab4-6b69-41b9-b579-2246ba889ea8

Save and restore Vim sessions with mksession

vimmksessionsession-filewindow-layoutssession-restore

Loading...

Link to section dd3568d3-d7dd-402a-8b4c-ae69849a04b1

Comment lines with Vim visual mode and :norm

vimvisual-line-modevim-normcommentinguncommenting

Loading...

Link to section 25adc421-f8be-46ce-ab88-0ffe7c4a64ee

Open files in splits and tabs in Vim

vimsplit-windowshorizontal-splitsvertical-splitstabs

Loading...

Link to section 6a5957d5-14cc-4c76-8159-2f8147485864

Open files under cursor with gf in Vim

gfvimopen-filevisual-modepath-option

Loading...

Link to section 26129a17-ec2c-48dc-8d3c-3d5538df4e50

Increment numbers under the cursor in Vim with Ctrl-a

vimincrementdecrementdot-commandcount-prefix

Loading...

Link to section 69bc8b2b-6264-44ad-8ffa-864d67a75950

Enable persistent undo in Vim with undofile

vimundofileundodirvimrc

Loading...

Link to section 751ba193-a186-4b4f-a1dd-6c033d31c1a2

Edit multiple lines with Vim visual block mode

vimvisual-block-modecolumn-editingprepend-textmulti-line-edit

Loading...

Link to section fb3a0a2a-4d6f-4e80-b380-a380bdec0b7d

Recall and reuse last searches in Vim with q/

vimsearch-historyrepeat-searchq-slashjump-between-results

Loading...

Link to section 56150e3c-5859-41f6-9402-429d69f14fb0

Expand shortcuts with Vim insert mode abbreviations

vimabbreviationsinsert-modetext-expansion

Loading...

Link to section 54448683-8f2b-4dfb-b0eb-51419580e9d2

Delete word and clear to line start in Vim insert mode

viminsert-modedelete-wordctrl-wctrl-u

Loading...

Link to section 928f1138-b1d4-4911-9f4d-618176296436

Repeat last insert in Vim insert mode with Ctrl-A

viminsert-moderepeat-insertduplicate-textctrl-a

Loading...

Link to section f0ddbb92-3ea8-4759-855d-2519df17e206

Vim insert mode autocompletion shortcuts

viminsert-modeword-completionline-completionfile-path-completion

Loading...

Link to section 835c5f15-936d-4e52-b9e9-00f111814f78

Paste register contents in insert mode with Ctrl-r

vimregistersinsert-modepaste-from-registersystem-clipboard

Loading...

Link to section 79cbfe30-e623-4382-ba9a-b3975072341e

Insert evaluated expressions in Vim insert mode

viminsert-modeexpression-registermath-calculation

Loading...