Improve/fix organization+naming for splits + load help @ 33% width

This commit is contained in:
Kevin MacMartin 2014-11-02 18:19:37 -05:00
parent e87ddba555
commit d9b2d6fc98
3 changed files with 62 additions and 55 deletions

View file

@ -43,13 +43,16 @@ endif
"filtype specific settings
autocmd Filetype text,mkd,mkdc,gitcommit,notes,mail,notmuch,rst,taskreport setlocal nonumber spell nolist linebreak breakat&vim breakat-=* breakat-=. breakat-=/ breakat-=? breakat-=, breakat-=: breakat-=; breakat-=! "set some defaults for word processing
autocmd Filetype text,gitcommit,notes,mail,notmuch,rst,taskreport setlocal wrap
autocmd FileType help* wincmd L "help windows always open vertically
autocmd FileType help* vertical resize 80 "set the window size to 80 cols
autocmd FileType help* setlocal nocursorline "remove the horizontal cursor line
autocmd FileType tmux,taskrc setlocal commentstring=#\ %s "set the comment string to #
autocmd FileType slrnrc setlocal commentstring=%%\ %s "set the comment string to %
"special side/bottom-bar settings to apply when opened
autocmd BufEnter,FileType taskreport,qf,help* setlocal nowrap nocursorcolumn "disable text wrapping and the vertical cursor line
autocmd BufEnter,FileType extradite setlocal number "enable line numbers in extradite
autocmd BufEnter,FileType help* setlocal nocursorline "remove the horizontal cursor line
"load help as a vertical split (sidebar) using one third of the window
autocmd BufEnter,FileType help* wincmd L|wincmd h|vs|wincmd =|q|wincmd l
"settings for buffers in diff mode
autocmd VimEnter,FilterWritePre * if &diff|setlocal nofoldenable|endif

View file

@ -72,11 +72,11 @@
" <Ctrl-w>{ | (N) -> rotate counter-clockwise
" <Ctrl-w>} | (N) -> rotate clockwise
" <Ctrl-w>] | (N) -> split vertically
" <Ctrl-w>0 | (N) -> create a vertical split 25% of the window
" <Ctrl-w>) | (N) -> create a vertical split 75% of the window
" <Ctrl-w>0 | (N) -> create a vertical split 33% of the window
" <Ctrl-w>) | (N) -> create a vertical split 66% of the window
" <Ctrl-w>[ | (N) -> split horizontally
" <Ctrl-w>9 | (N) -> create a horizontal split 25% of the window
" <Ctrl-w>( | (N) -> create a horizontal split 75% of the window
" <Ctrl-w>9 | (N) -> create a horizontal split 33% of the window
" <Ctrl-w>( | (N) -> create a horizontal split 66% of the window
"
" (display)
" <Backspace> | (N) -> reset window and clear search
@ -326,10 +326,10 @@
cabbrev <expr><silent> gitstatus ':Gstatus<CR>'
cabbrev <expr><silent> GitCommit ':Gcommit<CR>'
cabbrev <expr><silent> gitcommit ':Gcommit<CR>'
cabbrev <expr><silent> vs25 ':VS25<CR>'
cabbrev <expr><silent> vs75 ':VS75<CR>'
cabbrev <expr><silent> sp25 ':SP25<CR>'
cabbrev <expr><silent> sp75 ':SP75<CR>'
cabbrev <expr><silent> vs33 ':VS33<CR>'
cabbrev <expr><silent> vs66 ':VS66<CR>'
cabbrev <expr><silent> sp33 ':SP33<CR>'
cabbrev <expr><silent> sp66 ':SP66<CR>'
cabbrev diff vertical diffsplit
cabbrev sudow SudoWrite
cabbrev wsudo SudoWrite
@ -414,11 +414,11 @@
nmap <expr><silent> <C-w>{ ':wincmd R<CR>'
nmap <expr><silent> <C-w>} ':wincmd r<CR>'
nmap <expr><silent> <C-w>] ':vs<CR>'
nmap <expr><silent> <C-w>0 ':VS25<CR>'
nmap <expr><silent> <C-w>) ':VS75<CR>'
nmap <expr><silent> <C-w>0 ':VS33<CR>'
nmap <expr><silent> <C-w>) ':VS66<CR>'
nmap <expr><silent> <C-w>[ ':sp<CR>:wincmd j<CR>'
nmap <expr><silent> <C-w>9 ':SP25<CR>'
nmap <expr><silent> <C-w>( ':SP75<CR>'
nmap <expr><silent> <C-w>9 ':SP33<CR>'
nmap <expr><silent> <C-w>( ':SP66<CR>'
"}
"DISPLAY:{

View file

@ -85,50 +85,54 @@
set timeout timeoutlen=500 "how long before timing out for mappings
set ttimeout ttimeoutlen=100 "how long before timing out for terminal key codes
if has('autocmd')
"enable the auto-creation of missing folders in a save path
if !exists('*s:MakeNewDir')
function s:MakeNewDir(fullpath, buf)
if empty(getbufvar(a:buf,'&buftype')) && a:fullpath!~#'\v^\w+\:\/'
let dirpath=fnamemodify(a:fullpath,':h')
if !isdirectory(dirpath)|call mkdir(dirpath,'p')|endif
endif
endfunction
augroup WriteDir
"FUNCTIONS: {{{
if has('autocmd')
"enable the auto-creation of missing folders in a save path
if !exists('*s:MakeNewDir')
function s:MakeNewDir(fullpath, buf)
if empty(getbufvar(a:buf,'&buftype')) && a:fullpath!~#'\v^\w+\:\/'
let dirpath=fnamemodify(a:fullpath,':h')
if !isdirectory(dirpath)|call mkdir(dirpath,'p')|endif
endif
endfunction
augroup WriteDir
autocmd!
autocmd BufWritePre * :call s:MakeNewDir(expand('<afile>'),+expand('<abuf>'))
augroup END
endif
"update the current filetype when a file is renamed
augroup RenameCheckFiletype
autocmd!
autocmd BufWritePre * :call s:MakeNewDir(expand('<afile>'),+expand('<abuf>'))
autocmd BufFilePost * filetype detect
augroup END
endif
"update the current filetype when a file is renamed
augroup RenameCheckFiletype
autocmd!
autocmd BufFilePost * filetype detect
augroup END
endif
"functions to create a split using 33% and 66% of the height
function s:SPResize33()
sp|wincmd =|q
endfunction
function s:sp33()
sp|call s:SPResize33()|wincmd j
endfunction
command! -buffer SP33 call s:sp33()
function s:sp66()
sp|wincmd j|call s:SPResize33()
endfunction
command! -buffer SP66 call s:sp66()
function s:VSResize75()
vs|wincmd =|q
endfunction
function s:vs75()
vs|call s:VSResize75()
endfunction
command! -buffer VS75 call s:vs75()
function s:vs25()
vs|wincmd h|call s:VSResize75()|wincmd l
endfunction
command! -buffer VS25 call s:vs25()
function s:SPResize25()
sp|wincmd =|q
endfunction
function s:sp25()
sp|call s:SPResize25()|wincmd j
endfunction
command! -buffer SP25 call s:sp25()
function s:sp75()
sp|wincmd j|call s:SPResize25()
endfunction
command! -buffer SP75 call s:sp75()
"functions to create a vertical split using 33% and 66% width
function s:VSResize66()
vs|wincmd =|q
endfunction
function s:vs66()
vs|call s:VSResize66()
endfunction
command! -buffer VS66 call s:vs66()
function s:vs33()
vs|wincmd h|call s:VSResize66()|wincmd l
endfunction
command! -buffer VS33 call s:vs33()
"}}}
"}}}
"}}}