diff --git a/README.md b/README.md index 195d9d9..779eb4f 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ tell vim to open `abc.txt` - `g:terminal_list`: set to 0 to hide terminal buffer in the buffer list. - `g:terminal_fixheight`: set to 1 to set `winfixheight` for the terminal window. - `g:terminal_close`: set to 1 to close window if process finished. +- `g:terminal_skip_key_init`: set to 1 if you don't use the 'ALT' key and don't want this plugin to adjust options that recognises it. ## Remember diff --git a/doc/terminal_help.txt b/doc/terminal_help.txt index 43673fd..2812c17 100644 --- a/doc/terminal_help.txt +++ b/doc/terminal_help.txt @@ -108,6 +108,9 @@ Settings ~ - 'g:terminal_fixheight': set to 1 to set 'winfixheight' for the terminal window. - 'g:terminal_close': set to 1 to close window if process finished. +- 'g:terminal_skip_key_init': set to 1 if you don't use the 'ALT' key and + don't want this plugin to adjust options that recognises it. + =============================================================================== *terminal_help-remember* diff --git a/plugin/terminal_help.vim b/plugin/terminal_help.vim index 6a98d1f..4656dd4 100644 --- a/plugin/terminal_help.vim +++ b/plugin/terminal_help.vim @@ -381,7 +381,9 @@ endfunc "---------------------------------------------------------------------- " enable alt key in terminal vim "---------------------------------------------------------------------- -if has('nvim') == 0 && has('gui_running') == 0 +if has('nvim') == 0 + \ && has('gui_running') == 0 + \ && get(g:, 'terminal_skip_key_init', 0) == 0 set ttimeout if $TMUX != '' set ttimeoutlen=35 @@ -389,9 +391,7 @@ if has('nvim') == 0 && has('gui_running') == 0 set ttimeoutlen=85 endif function! s:meta_code(key) - if get(g:, 'terminal_skip_key_init', 0) == 0 - exec "set =\e".a:key - endif + exec "set =\e".a:key endfunc for i in range(10) call s:meta_code(nr2char(char2nr('0') + i)) @@ -407,9 +407,7 @@ if has('nvim') == 0 && has('gui_running') == 0 call s:meta_code(c) endfor function! s:key_escape(name, code) - if get(g:, 'terminal_skip_key_init', 0) == 0 - exec "set ".a:name."=\e".a:code - endif + exec "set ".a:name."=\e".a:code endfunc call s:key_escape('', 'OP') call s:key_escape('', 'OQ')