Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
vim-bracketed-paste/plugin/bracketed-paste.vim
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
32 lines (28 sloc)
972 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Code from: | |
" http://stackoverflow.com/questions/5585129/pasting-code-into-terminal-window-into-vim-on-mac-os-x | |
" then https://coderwall.com/p/if9mda | |
" and then https://github.com/aaronjensen/vimfiles/blob/59a7019b1f2d08c70c28a41ef4e2612470ea0549/plugin/terminaltweaks.vim | |
" to fix the escape time problem with insert mode. | |
" | |
" Docs on bracketed paste mode: | |
" http://www.xfree86.org/current/ctlseqs.html | |
" Docs on mapping fast escape codes in vim | |
" http://vim.wikia.com/wiki/Mapping_fast_keycodes_in_terminal_Vim | |
if exists("g:loaded_bracketed_paste") | |
finish | |
endif | |
let g:loaded_bracketed_paste = 1 | |
let &t_ti .= "\<Esc>[?2004h" | |
let &t_te = "\e[?2004l" . &t_te | |
function! XTermPasteBegin(ret) | |
set pastetoggle=<f29> | |
set paste | |
return a:ret | |
endfunction | |
execute "set <f28>=\<Esc>[200~" | |
execute "set <f29>=\<Esc>[201~" | |
map <expr> <f28> XTermPasteBegin("i") | |
imap <expr> <f28> XTermPasteBegin("") | |
vmap <expr> <f28> XTermPasteBegin("c") | |
cmap <f28> <nop> | |
cmap <f29> <nop> |