Skip to main content
Module

x/denops_std/option/mod.ts>pastetoggle

📚 Standard module for denops.vim
Go to Latest
variable pastetoggle
import { pastetoggle } from "https://deno.land/x/denops_std@v5.1.0/option/mod.ts";

When non-empty, specifies the key sequence that toggles the 'paste' option. This is like specifying a mapping:

:map {keys} :set invpaste<CR>

Where {keys} is the value of 'pastetoggle'. The difference is that it will work even when 'paste' is set. 'pastetoggle' works in Insert mode and Normal mode, but not in Command-line mode. Mappings are checked first, thus overrule 'pastetoggle'. However, when 'paste' is on mappings are ignored in Insert mode, thus you can do this:

:map <F10> :set paste<CR>
:map <F11> :set nopaste<CR>
:imap <F10> <C-O>:set paste<CR>
:imap <F11> <nop>
:set pastetoggle=<F11>

This will make <F10> start paste mode and <F11> stop paste mode. Note that typing <F10> in paste mode inserts "<F10>", since in paste mode everything is inserted literally, except the 'pastetoggle' key sequence. When the value has several bytes 'ttimeoutlen' applies.

(default "")