Update daybook vim functions
This commit is contained in:
+18
-10
@@ -222,7 +222,7 @@ function! InsertDivider()
|
||||
call cursor(line('.'), len(indent) + len(leader) + 1)
|
||||
endfunction
|
||||
|
||||
function! StartDailyReview()
|
||||
function! DaybookStart()
|
||||
let today = strftime('%d')
|
||||
let yesterday = strftime('%d', localtime() - 86400)
|
||||
|
||||
@@ -232,6 +232,7 @@ function! StartDailyReview()
|
||||
|
||||
let todayLog = fnameescape($'log/{today}-daily.md')
|
||||
let yesterdayLog = fnameescape($'log/{yesterday}-daily.md')
|
||||
let todayLogExists = filereadable(todayLog)
|
||||
|
||||
NERDTreeClose
|
||||
execute $'edit {yesterdayLog}'
|
||||
@@ -242,11 +243,14 @@ function! StartDailyReview()
|
||||
set nowrap
|
||||
wincmd l
|
||||
vertical resize 107
|
||||
|
||||
execute $'edit {todayLog}'
|
||||
if ! todayLogExists
|
||||
:0r templates/daily.md
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! CopyTriggerFiles()
|
||||
function! DaybookCopyTriggers()
|
||||
let day = strftime('%d')
|
||||
let month = strftime('%m')
|
||||
let year = strftime('%Y')
|
||||
@@ -268,18 +272,24 @@ function! CopyTriggerFiles()
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! DaybookCopyUnfinished()
|
||||
let yesterday = strftime('%d', localtime() - 86400)
|
||||
let yesterdayLog = fnameescape($'log/{yesterday}-daily.md')
|
||||
execute $':r!cat {yesterdayLog} | grep "^\* \[ \]"'
|
||||
endfunction
|
||||
|
||||
" Key Mappings #####################################################################################
|
||||
|
||||
nnoremap <F1> :NERDTreeToggle \| wincmd p \| vertical resize 111 \| wincmd p<CR>
|
||||
nnoremap <F2> :NERDTreeFind<CR>
|
||||
nnoremap <F3> :'a,.!sort -fg<CR>
|
||||
nnoremap <F4> :IndentGuidesToggle<CR>
|
||||
inoremap <F5> <Esc>:call InsertDivider()<CR>
|
||||
nnoremap <F5> <Esc>:call InsertDivider()<CR>
|
||||
nnoremap <F6> :set hlsearch!<CR>
|
||||
nnoremap <F7> :cp<CR>
|
||||
nnoremap <F8> :cwindow<CR>
|
||||
nnoremap <F9> :cn<CR>
|
||||
nnoremap <F11> <Esc>:call StartDailyReview()<CR>
|
||||
nnoremap <F11> <Esc>:call DaybookStart()<CR>
|
||||
|
||||
nnoremap <Leader>c :ALEGoToTypeDefinition<CR>
|
||||
nnoremap <Leader>d :ALEGoToDefinition<CR>
|
||||
@@ -291,16 +301,14 @@ nnoremap <Leader>r :ALEFindReferences<CR>
|
||||
nnoremap <Leader>x :ALEToggle<CR>
|
||||
nnoremap <Leader>w :w<CR>
|
||||
|
||||
nnoremap <Leader>ev :edit $MYVIMRC<CR>
|
||||
nnoremap <Leader>sv :source $MYVIMRC<CR>
|
||||
nnoremap <Leader>ve :edit $MYVIMRC<CR>
|
||||
nnoremap <Leader>vs :source $MYVIMRC<CR>
|
||||
|
||||
nnoremap ' :BufExplorer<CR>
|
||||
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
|
||||
inoremap kj <esc>
|
||||
|
||||
" Local Overrides ##################################################################################
|
||||
|
||||
silent! source $HOME/.vimrc.local " user or machine specific .vimrc
|
||||
@@ -313,7 +321,7 @@ augroup file-specific
|
||||
autocmd BufRead COMMIT_EDITMSG set textwidth=70 colorcolumn=70
|
||||
autocmd BufRead Makefile setlocal noexpandtab
|
||||
autocmd BufRead *.scss setlocal shiftwidth=4
|
||||
autocmd BufNewFile,BufRead *.md Wrapwidth 100 | setlocal textwidth=0 spell wrap
|
||||
autocmd BufNewFile,BufRead *.md setlocal textwidth=0 spell wrap | Wrapwidth 100
|
||||
autocmd WinResized *.md Wrapwidth 100
|
||||
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
|
||||
augroup END
|
||||
@@ -322,7 +330,7 @@ augroup END
|
||||
|
||||
augroup startup
|
||||
autocmd!
|
||||
autocmd VimEnter * if argc() == 0 | NERDTree | wincmd p | vertical resize 111
|
||||
autocmd VimEnter * if argc() == 0 | NERDTree | wincmd p | vertical resize 107
|
||||
autocmd CursorHold,FocusLost * silent! wall
|
||||
autocmd FileType qf execute "resize " . float2nr(&lines * 1 / 3)
|
||||
augroup END
|
||||
|
||||
Reference in New Issue
Block a user