Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
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.0.1/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 "")