Is there any way in my .vimrc file to use the command set list!
with a keybind like F3 so it functions like this paste toggle set pastetoggle=<F2>
.
Settings file used by Vim, a text editing program often used by source code developers and system administrators; saves the default settings for the editor when it is opened; allows users to customize options for the editor. VIMRC files are saved in a plain text format.
<silent> tells vim to show no message when this key sequence is used. <leader> means the key sequence starts with the character assigned to variable mapleader -- a backslash, if no let mapleader = statement has executed yet at the point nmap executes.
Try it out by pressing <leader>N in normal mode. Vim will toggle the line numbers for the current window off and on. Creating a "toggle" mapping like this is really handy, because we don't need to have two separate keys to turn something off and on. Unfortunately this only works for boolean options.
You can put this in your .vimrc
file:
" F3: Toggle list (display unprintable characters).
nnoremap <F3> :set list!<CR>
I found an answer about how to toggle set number
in vim, https://stackoverflow.com/a/762633/1086911
So can try the same way by putting following line into your vimrc
file
map <F3> :set list! list? <CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With