Skip to content

Instantly share code, notes, and snippets.

@shspage
Last active March 27, 2019 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shspage/574d6d3532d8b9996731caeec4331c11 to your computer and use it in GitHub Desktop.
Save shspage/574d6d3532d8b9996731caeec4331c11 to your computer and use it in GitHub Desktop.
[vim][.vimrc] Ctrl+矢印で端末サイズを変更する(暫定) ... 初めてvimスクリプトらしきものを書いてみた。こんな感じでいいのかな?
" 端末サイズ変更
" n : 幅(columns)または高さ(lines)に足す数
" is_width : 幅=TRUE, 高さ=FALSE
"TODO: 最大化状態の取得と解除
"TODO: 1行で "set〜" "redr" を実行する書き方があれば関数化することもないのだが
function! ResizeTerminal (n, is_width)
if a:is_width
execute "set columns+=" . a:n
else
execute "set lines+=" . a:n
endif
redr
endfunction
" Ctrl + 矢印で端末サイズ変更 (gnomeのショートカット(Alt+F8 からの 矢印/Shift+矢印)でも出来るけど手数が増える)
nnoremap <silent> <C-Left> :call ResizeTerminal(-8, 1)<CR>
nnoremap <silent> <C-Right> :call ResizeTerminal(8, 1)<CR>
nnoremap <silent> <C-Up> :call ResizeTerminal(-4, 0)<CR>
nnoremap <silent> <C-Down> :call ResizeTerminal(4, 0)<CR>
" Ctrl + Shift + Down で、高さをスクリーン天地ほぼ一杯にする
nnoremap <silent> <C-S-Down> :call ResizeTerminal(100, 0)<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment