There are several Vim settings I love, but are too annoying to always enable. For example:
set relativenumber
- annoying when scrolling set list
- distracting when you don't need it What is a concise leader mapping to toggle a generic Vim setting?
You have two ways, as described in the help:
:set-! :set-inv
:se[t] {option}! or
:se[t] inv{option} Toggle option: Invert value. {not in Vi}
Either
:set list!
Or
:set invlist
Will do the same.
Toggle options by appending !
to :set <option>
For example, to toggle relativenumber
:
nnoremap <leader>r :set relativenumber!<cr>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.