public

  • Download Gist
conque_term_settings.vim
VimL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
" Conque
" http://www.vim.org/scripts/script.php?script_id=2771
 
" ~/.vim/after/ftplugin/conque_term.vim
 
augroup MyConqueTerm
autocmd!
" start Insert mode on BufEnter
autocmd BufEnter *
\ if &l:filetype ==# 'conque_term' |
\ startinsert! |
\ endif
augroup END
 
let g:ConqueTerm_Color = 1
let g:ConqueTerm_TERM = 'vt100'
let g:ConqueTerm_Syntax = 'conque'
let g:ConqueTerm_ReadUnfocused = 1
let g:ConqueTerm_CWInsert = 1
 
let g:ConqueTerm_MyTermCommand = 'zsh -7'
let g:ConqueTerm_MyTermPosition = 'J'
 
" Creates a new term buffer.
function! s:new_term()
execute "ConqueTermSplit" g:ConqueTerm_MyTermCommand
execute 'wincmd' g:ConqueTerm_MyTermPosition
setlocal bufhidden=hide
setlocal nobuflisted
setlocal buftype=nofile
setlocal noswapfile
endfunction
 
function! s:term_bufname(termnr)
return printf("%s - %d", g:ConqueTerm_MyTermCommand, a:termnr)
endfunction
 
" Shows the term buffer with the given term number.
function! s:show_term(termnr)
let bufname = s:term_bufname(a:termnr)
if bufexists(bufname)
let bufnr = bufnr(bufname)
let winnr = bufwinnr(bufnr)
if winnr == -1
execute 'sbuffer' bufnr
execute 'wincmd' g:ConqueTerm_MyTermPosition
else
execute winnr 'wincmd w'
endif
elseif a:termnr == 1
call s:new_term()
else
echo "Term buffer not created yet"
endif
endfunction
 
" Shows the term buffer with the given term number. (exclusive)
function! s:swtich_term(termnr)
let bufname = s:term_bufname(a:termnr)
if bufexists(bufname)
for nr in range(1,9)
let bufname = s:term_bufname(nr)
if bufexists(bufname)
let bufnr = bufnr(bufname)
let winnr = bufwinnr(bufnr)
if winnr != -1
execute winnr 'wincmd w'
wincmd c
endif
endif
endfor
call s:show_term(a:termnr)
elseif a:termnr == 1
call s:new_term()
else
echo "Term buffer not created yet"
endif
endfunction
 
" show the main shell
nnoremap <silent> H :<C-u>call <SID>show_term(1)<CR>
" show the shell of the given term number
for nr in range(1,9)
execute 'nnoremap <silent> <Space>'.nr.' :<C-u>call <SID>swtich_term('.nr.')<CR>'
execute 'nnoremap <silent> <Space><Space>'.nr.' :<C-u>call <SID>show_term('.nr.')<CR>'
endfor
 
" create a new shell
nnoremap <silent> <Space>sh :<C-u>call <SID>new_term()<CR>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.