Project [ Project [ Unit [ FunctionDeclaration { functionBang = True , functionName = "s:escape" , functionArguments = ArgumentList [ Argument "string" ] , functionAttributes = [ "abort" ] , functionBody = [ GenericStatement "return substitute(a:string, \"\\\", \"\\\\\", 'g')" ] } , FunctionDeclaration { functionBang = True , functionName = "terminus#private#wrap" , functionArguments = ArgumentList [ Argument "string" ] , functionAttributes = [ "abort" ] , functionBody = [ GenericStatement "if strlen(a:string) == 0" , GenericStatement "return ''" , GenericStatement "end" , LetStatement { letLexpr = "l:tmux_begin" , letValue = "\"\\Ptmux;\"" } , LetStatement { letLexpr = "l:tmux_end" , letValue = "\"\\\\\\\"" } , GenericStatement "return l:tmux_begin . s:escape(a:string) . l:tmux_end" ] } , FunctionDeclaration { functionBang = True , functionName = "terminus#private#focus_lost" , functionArguments = ArgumentList [] , functionAttributes = [ "abort" ] , functionBody = [ LetStatement { letLexpr = "l:cmdline" , letValue = "getcmdline()" } , LetStatement { letLexpr = "l:cmdpos" , letValue = "getcmdpos()" } , GenericStatement "silent doautocmd FocusLost %" , GenericStatement "call setcmdpos(l:cmdpos)" , GenericStatement "return l:cmdline" ] } , FunctionDeclaration { functionBang = True , functionName = "terminus#private#focus_gained" , functionArguments = ArgumentList [] , functionAttributes = [ "abort" ] , functionBody = [ LetStatement { letLexpr = "l:cmdline" , letValue = "getcmdline()" } , LetStatement { letLexpr = "l:cmdpos" , letValue = "getcmdpos()" } , GenericStatement "silent! doautocmd FocusGained %" , GenericStatement "call setcmdpos(l:cmdpos)" , GenericStatement "return l:cmdline" ] } , FunctionDeclaration { functionBang = True , functionName = "terminus#private#paste" , functionArguments = ArgumentList [ Argument "ret" ] , functionAttributes = [ "abort" ] , functionBody = [ GenericStatement "set paste" , GenericStatement "return a:ret" ] } ] , Unit [ GenericStatement "if exists('g:TerminusLoaded') || &compatible || v:version < 700" , GenericStatement "finish" , GenericStatement "endif" , LetStatement { letLexpr = "g:TerminusLoaded" , letValue = "1" } , LetStatement { letLexpr = "s:cpoptions" , letValue = "&cpoptions" } , GenericStatement "set cpoptions&vim" , GenericStatement "set autoread \" if not changed in Vim, automatically pick up changes after \"git checkout\" etc" , GenericStatement "if &ttimeoutlen == -1 && &timeoutlen > 50 || &ttimeoutlen > 50" , GenericStatement "set ttimeoutlen=50 \" speed up O etc in the Terminal" , GenericStatement "endif" , LetStatement { letLexpr = "s:iterm" , letValue = "exists('$ITERM_PROFILE') ||" } , GenericStatement "\\ exists('$ITERM_SESSION_ID') || exists('$KONSOLE_DBUS_SESSION') || exists('$KONSOLE_PROFILE_NAME') || exists('g:TerminusAssumeITerm') || filereadable(expand('~/.vim/.assume-iterm'))" , LetStatement { letLexpr = "s:screenish" , letValue = "&term =~# 'screen\\|tmux'" } , LetStatement { letLexpr = "s:tmux" , letValue = "exists('$TMUX')" } , LetStatement { letLexpr = "s:xterm" , letValue = "&term =~# 'xterm'" } , LetStatement { letLexpr = "s:shape" , letValue = "get(g:, 'TerminusCursorShape', 1)" } , GenericStatement "if s:shape" , LetStatement { letLexpr = "s:insert_shape" , letValue = "+get(g:, 'TerminusInsertCursorShape', 1)" } , LetStatement { letLexpr = "s:replace_shape" , letValue = "+get(g:, 'TerminusReplaceCursorShape', 2)" } , LetStatement { letLexpr = "s:normal_shape" , letValue = "+get(g:, 'TerminusNormalCursorShape', 0)" } , GenericStatement "if s:iterm" , LetStatement { letLexpr = "s:start_insert" , letValue = "\"\\]50;CursorShape=\" . s:insert_shape . \"\\x7\"" } , LetStatement { letLexpr = "s:start_replace" , letValue = "\"\\]50;CursorShape=\" . s:replace_shape . \"\\x7\"" } , LetStatement { letLexpr = "s:end_insert" , letValue = "\"\\]50;CursorShape=\" . s:normal_shape . \"\\x7\"" } , GenericStatement "else" , LetStatement { letLexpr = "s:cursor_shape_to_vte_shape" , letValue = "{1: 6, 2: 4, 0: 2}" } , LetStatement { letLexpr = "s:insert_shape" , letValue = "s:cursor_shape_to_vte_shape[s:insert_shape]" } , LetStatement { letLexpr = "s:replace_shape" , letValue = "s:cursor_shape_to_vte_shape[s:replace_shape]" } , LetStatement { letLexpr = "s:normal_shape" , letValue = "s:cursor_shape_to_vte_shape[s:normal_shape]" } , LetStatement { letLexpr = "s:start_insert" , letValue = "\"\\[\" . s:insert_shape . ' q'" } , LetStatement { letLexpr = "s:start_replace" , letValue = "\"\\[\" . s:replace_shape . ' q'" } , LetStatement { letLexpr = "s:end_insert" , letValue = "\"\\[\" . s:normal_shape . ' q'" } , GenericStatement "endif" , GenericStatement "if s:tmux" , LetStatement { letLexpr = "s:start_insert" , letValue = "terminus#private#wrap(s:start_insert)" } , LetStatement { letLexpr = "s:start_replace" , letValue = "terminus#private#wrap(s:start_replace)" } , LetStatement { letLexpr = "s:end_insert" , letValue = "terminus#private#wrap(s:end_insert)" } , GenericStatement "endif" , LetStatement { letLexpr = "&t_SI" , letValue = "s:start_insert" } , GenericStatement "if v:version > 704 || v:version == 704 && has('patch687')" , LetStatement { letLexpr = "&t_SR" , letValue = "s:start_replace" } , GenericStatement "end" , LetStatement { letLexpr = "&t_EI" , letValue = "s:end_insert" } , GenericStatement "endif" , LetStatement { letLexpr = "s:mouse" , letValue = "get(g:, 'TerminusMouse', 1)" } , GenericStatement "if s:mouse" , GenericStatement "if has('mouse')" , GenericStatement "set mouse=a" , GenericStatement "if s:screenish || s:xterm" , GenericStatement "if !has('nvim')" , GenericStatement "if has('mouse_sgr')" , GenericStatement "set ttymouse=sgr" , GenericStatement "else" , GenericStatement "set ttymouse=xterm2" , GenericStatement "endif" , GenericStatement "endif" , GenericStatement "endif" , GenericStatement "endif" , GenericStatement "endif" , LetStatement { letLexpr = "s:focus" , letValue = "get(g:, 'TerminusFocusReporting', 1)" } , GenericStatement "if s:focus" , GenericStatement "if has('autocmd')" , GenericStatement "augroup Terminus" , GenericStatement "autocmd!" , GenericStatement "autocmd FocusGained * checktime" , GenericStatement "augroup END" , GenericStatement "endif" , LetStatement { letLexpr = "&t_ti." , letValue = "\"\\e[?1004h\"" } , LetStatement { letLexpr = "&t_te" , letValue = "\"\\e[?1004l\" . &t_te" } , GenericStatement "execute \"set =\\[O\"" , GenericStatement "execute \"set =\\[I\"" , GenericStatement "cnoremap eterminus#private#focus_lost()" , GenericStatement "cnoremap eterminus#private#focus_gained()" , GenericStatement "if v:version > 703 || v:version == 703 && has('patch438')" , GenericStatement "inoremap :silent doautocmd FocusLost %" , GenericStatement "inoremap :silent doautocmd FocusGained %" , GenericStatement "nnoremap :silent doautocmd FocusLost %" , GenericStatement "nnoremap :silent doautocmd FocusGained %" , GenericStatement "onoremap :silent doautocmd FocusLost %" , GenericStatement "onoremap :silent doautocmd FocusGained %" , GenericStatement "vnoremap :silent doautocmd FocusLost %gv" , GenericStatement "vnoremap :silent doautocmd FocusGained %gv" , GenericStatement "else" , GenericStatement "inoremap :silent doautocmd FocusLost %" , GenericStatement "inoremap :silent doautocmd FocusGained %" , GenericStatement "nnoremap :silent doautocmd FocusLost %" , GenericStatement "nnoremap :silent doautocmd FocusGained %" , GenericStatement "onoremap :silent doautocmd FocusLost %" , GenericStatement "onoremap :silent doautocmd FocusGained %" , GenericStatement "vnoremap :silent doautocmd FocusLost %gv" , GenericStatement "vnoremap :silent doautocmd FocusGained %gv" , GenericStatement "endif" , GenericStatement "endif" , LetStatement { letLexpr = "s:paste" , letValue = "get(g:, 'TerminusBracketedPaste', 1)" } , GenericStatement "if s:paste" , GenericStatement "if s:screenish || s:xterm" , LetStatement { letLexpr = "&t_ti." , letValue = "\"\\e[?2004h\"" } , LetStatement { letLexpr = "&t_te" , letValue = "\"\\e[?2004l\" . &t_te" } , GenericStatement "set pastetoggle=[201~" , GenericStatement "inoremap [200~ terminus#private#paste('')" , GenericStatement "nnoremap [200~ terminus#private#paste('i')" , GenericStatement "vnoremap [200~ terminus#private#paste('c')" , GenericStatement "cnoremap [200~ " , GenericStatement "cnoremap [201~ " , GenericStatement "endif" , GenericStatement "endif" , LetStatement { letLexpr = "&cpoptions" , letValue = "s:cpoptions" } , UnletStatement { unletBang = False , unletBody = "s:cpoptions" } ] ] ]