Earlier quoted context omitted.
I'm going to try this. I use tmux but the idea of being able to use vim for everything seems nice. If you have tips/suggestions, I'm interested.
For me, some of the things that's really important for a terminal multiplexer include: 1) Keybindings having no conflicts with other terminal applications. For that, vim's default window-management key of is unfortunate, as it is very important for delete words in bash and readline. I remap that to (CTRL-Space) instead, which is basically used by no terminal program that I am aware of. The other key binding that trip…
map 1 Termcountmap(1, "")
map 2 Termcountmap(2, "")
map 3 Termcountmap(3, "")
map 4 Termcountmap(4, "")
map 5 Termcountmap(5, "")
map 6 Termcountmap(6, "")
map 7 Termcountmap(7, "")
map 8 Termcountmap(8, "")
map 9 Termcountmap(9, "")
map! 1 Termcountmap(1, '')
map! 2 Termcountmap(2, '')
map! 3 Termcountmap(3, '')
map! 4 Termcountmap(4, '')
map! 5 Termcountmap(5, '')
map! 6 Termcountmap(6, '')
map! 7 Termcountmap(7, '')
map! 8 Termcountmap(8, '')
map! 9 Termcountmap(9, '')
tmap 1 Termcountmap(1, 'N')
tmap 2 Termcountmap(2, 'N')
tmap 3 Termcountmap(3, 'N')
tmap 4 Termcountmap(4, 'N')
tmap 5 Termcountmap(5, 'N')
tmap 6 Termcountmap(6, 'N')
tmap 7 Termcountmap(7, 'N')
tmap 8 Termcountmap(8, 'N')
tmap 9 Termcountmap(9, 'N')
function! Termcountmap(initcount, normalkeys)
let termcount = a:initcount
while 1
try
let char = getchar()
catch /^Vim:Interrupt$/
return ""
endtry
if type(char) == 0
let char = nr2char(char)
endif
if char == '0'
let termcount = termcount * 10
elseif char == '1'
let termcount = termcount * 10 + 1
elseif char == '2'
let termcount = termcount * 10 + 2
elseif char == '3'
let termcount = termcount * 10 + 3
elseif char == '4'
let termcount = termcount * 10 + 4
elseif char == '5'
let termcount = termcount * 10 + 5
elseif char == '6'
let termcount = termcount * 10 + 6
elseif char == '7'
let termcount = termcount * 10 + 7
elseif char == '8'
let termcount = termcount * 10 + 8
elseif char == '9'
let termcount = termcount * 10 + 9
elseif char == 'g'
return a:normalkeys .. termcount .. 'g'
elseif char == "\"
return a:normalkeys .. termcount .. "\\"
elseif char == 'w'
return a:normalkeys .. termcount .. "\w"
elseif char == 'W'
return a:normalkeys .. termcount .. "\W"
elseif char == 't'
return a:normalkeys .. termcount .. "\t"
elseif char == 'b'
return a:normalkeys .. termcount .. "\b"
else
return a:normalkeys .. ":\" .. termcount .. ' wincmd ' .. char .. "\\"
endif
endwhile
endfunction
map g g
map g1 Prefixcountmap (v:count * 10 + 1, "", 'g')
map g2 Prefixcountmap (v:count * 10 + 2, "", 'g')
map g3 Prefixcountmap (v:count * 10 + 3, "", 'g')
map g4 Prefixcountmap (v:count * 10 + 4, "", 'g')
map g5 Prefixcountmap (v:count * 10 + 5, "", 'g')
map g6 Prefixcountmap (v:count * 10 + 6, "", 'g')
map g7 Prefixcountmap (v:count * 10 + 7, "", 'g')
map g8 Prefixcountmap (v:count * 10 + 8, "", 'g')
map g9 Prefixcountmap (v:count * 10 + 9, "", 'g')
tmap g1 Prefixcountmap (v:count * 10 + 1, 'n', 'g')
tmap g2 Prefixcountmap (v:count * 10 + 2, 'n', 'g')
tmap g3 Prefixcountmap (v:count * 10 + 3, 'n', 'g')
tmap g4 Prefixcountmap (v:count * 10 + 4, 'n', 'g')
tmap g5 Prefixcountmap (v:count * 10 + 5, 'n', 'g')
tmap g6 Prefixcountmap (v:count * 10 + 6, 'n', 'g')
tmap g7 Prefixcountmap (v:count * 10 + 7, 'n', 'g')
tmap g8 Prefixcountmap (v:count * 10 + 8, 'n', 'g')
tmap g9 Prefixcountmap (v:count * 10 + 9, 'n', 'g')
map 1 Prefixcountmap (v:count * 10 + 1, "", '')
map 2 Prefixcountmap (v:count * 10 + 2, "", '')
map 3 Prefixcountmap (v:count * 10 + 3, "", '')
map 4 Prefixcountmap (v:count * 10 + 4, "", '')
map 5 Prefixcountmap (v:count * 10 + 5, "", '')
map 6 Prefixcountmap (v:count * 10 + 6, "", '')
map 7 Prefixcountmap (v:count * 10 + 7, "", '')
map 8 Prefixcountmap (v:count * 10 + 8, "", '')
map 9 Prefixcountmap (v:count * 10 + 9, "", '')
map! 1 Prefixcountmap (v:count * 10 + 1, '', '')
map! 2 Prefixcountmap (v:count * 10 + 2, '', '')
map! 3 Prefixcountmap (v:count * 10 + 3, '', '')
map! 4 Prefixcountmap (v:count * 10 + 4, '', '')
map! 5 Prefixcountmap (v:count * 10 + 5, '', '')
map! 6 Prefixcountmap (v:count * 10 + 6, '', '')
map! 7 Prefixcountmap (v:count * 10 + 7, '', '')
map! 8 Prefixcountmap (v:count * 10 + 8, '', '')
map! 9 Prefixcountmap (v:count * 10 + 9, '', '')
tmap 1 Prefixcountmap (v:count * 10 + 1, 'N', '')
tmap 2 Prefixcountmap (v:count * 10 + 2, 'N', '')
tmap 3 Prefixcountmap (v:count * 10 + 3, 'N', '')
tmap 4 Prefixcountmap (v:count * 10 + 4, 'N', '')
tmap 5 Prefixcountmap (v:count * 10 + 5, 'N', '')
tmap 6 Prefixcountmap (v:count * 10 + 6, 'N', '')
tmap 7 Prefixcountmap (v:count * 10 + 7, 'N', '')
tmap 8 Prefixcountmap (v:count * 10 + 8, 'N', '')
tmap 9 Prefixcountmap (v:count * 10 + 9, 'N', '')
function! Prefixcountmap(initcount, prefix, countprefix)
let termcount = a:initcount
while 1
try
let char = getchar()
catch /^Vim:Interrupt$/
return ""
endtry
if type(char) == 0
let char = nr2char(char)
endif
if char == '0'
let termcount = termcount * 10
elseif char == '1'
let termcount = termcount * 10 + 1
elseif char == '2'
let termcount = termcount * 10 + 2
elseif char == '3'
let termcount = termcount * 10 + 3
elseif char == '4'
let termcount = termcount * 10 + 4
elseif char == '5'
let termcount = termcount * 10 + 5
elseif char == '6'
let termcount = termcount * 10 + 6
elseif char == '7'
let termcount = termcount * 10 + 7
elseif char == '8'
let termcount = termcount * 10 + 8
elseif char == '9'
let termcount = termcount * 10 + 9
else
return a:prefix .. termcount .. a:countprefix .. char
endif
endwhile
endfunction