# Make tabs visible
:set list listchars+=tab:\|\-\>
# Show trailing spaces
:set list listchars+=trail:%
# Do not show the end-of-line with a $ character
:set listchars-=eol:\$
# See current settings
:set listchars?
# Edit current settings
:set listchars=<Tab>
# Disable all
:set nolist
To indent with two spaces
:set ts=2 sw=2 expandtab
To indent with tabs, but make them appear with width 4:
:set ts=4 sw=4 noexpandtab
You can use >[motion]
and <[motion]
to indent or de-indent a chunk of code, or >>
and <<
for a single line.
For example: {>}
will move to the start of a paragraph (block), and then indent all lines from there to the end of the paragraph (block).
You can use =[motion]
to automatically indent some lines. For example vip=
to select a paragraph and then reindent it.
For automatic indentation, you will need the correct filetype, and there are some options you can tweak. Try experimenting with these:
:setfiletype bash autoindent smartindent nocindent
:setfiletype javascript autoindent cindent
CTRL-R CTRL-O {register}
Registers +
and *
are used for the system clipboard.
Look at the registers, then choose which number register you want to paste.
:reg
"4P
:cd %:p:h
See: vim_use_netrw_as_a_file_tree_sidebar.md
Hit ZZ
to save your changes, and quit Vim.
Hit ZQ
to discard your changes, and quit Vim.