notetaking
This commit is contained in:
parent
2494d5ce01
commit
140088e237
2 changed files with 55 additions and 1 deletions
8
.vimrc
8
.vimrc
|
|
@ -99,6 +99,7 @@ call plug#begin($HOME . '/.vim/bundle')
|
|||
Plug $HOME . '/.vim/bundle/repos/github.com/Shougo/dein.vim'
|
||||
Plug 'let-def/vimbufsync'
|
||||
Plug 'lambdalisue/suda.vim'
|
||||
Plug 'skywind3000/asyncrun.vim'
|
||||
|
||||
" Plugins that I almost never use
|
||||
"Plug 'vim-scripts/DrawIt'
|
||||
|
|
@ -222,6 +223,8 @@ nmap <silent> gy <Plug>(coc-type-definition)
|
|||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
imap <Leader>, <Plug>(coc-snippets-expand)
|
||||
imap <Leader>ff <Plug>(coc-fix-current)
|
||||
nmap <Leader>ff <Plug>(coc-fix-current)
|
||||
|
||||
" Use K to show documentation in preview window
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
|
@ -670,6 +673,7 @@ command! -complete=shellcmd -nargs=+ Shell call s:ExecuteInShellOutput(<q-args>)
|
|||
command! -complete=shellcmd -nargs=+ Exec call s:ExecuteInShell(<q-args>)
|
||||
command! -nargs=* Make call s:ExecuteInShellOutput('make '.<q-args>)
|
||||
command! -nargs=* PTW call s:ExecuteInShell('ptw post --client=vim "'.<q-args>.'"')
|
||||
command! -nargs=* CaptureNote :AsyncRun -silent capture --viewing %:p <q-args> 2>&1 > /dev/null
|
||||
|
||||
" Highlight all instances of word under cursor, when idle.
|
||||
" Useful when studying strange source code.
|
||||
|
|
@ -806,7 +810,7 @@ inoremap jj <Esc>
|
|||
|
||||
" Leader key functions
|
||||
" See quickfix.
|
||||
nnoremap <Leader>ff :LFix<CR>
|
||||
"nnoremap <Leader>ff :LFix<CR>
|
||||
" See quickfix.
|
||||
nnoremap <Leader>ss :SyntasticSetLoclist<CR>
|
||||
" Next quickfix.
|
||||
|
|
@ -816,6 +820,8 @@ nnoremap <Leader>fp :lprev<CR>
|
|||
"nnoremap <silent> <Leader>aa :<C-u>Denite -mode=normal -buffer-name=search-buffer grep<CR>
|
||||
nnoremap <silent> <Leader>ac :<C-u>Denite -resume -buffer-name=search-buffer grep<CR>
|
||||
"nnoremap <silent> <Leader>aw :<C-u>DeniteCursorWord -buffer-name=search-buffer grep<CR>
|
||||
"
|
||||
nnoremap <silent> <Leader>nn :CaptureNote
|
||||
call denite#custom#map('insert', '<Enter>', '<C-o>')
|
||||
"call denite#custom#var('grep', 'command', ['rg'])
|
||||
"call denite#custom#var('grep', 'default_opts',
|
||||
|
|
|
|||
48
bin/capture
Executable file
48
bin/capture
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
VAULT_FILE="capture.md"
|
||||
VAULT_PATH="$HOME/notebook"
|
||||
FILE_IN_VIEW=""
|
||||
POSITIONAL=()
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-f|--file)
|
||||
VAULT_FILE="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
--viewing)
|
||||
FILE_IN_VIEW="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*) # unknown option
|
||||
POSITIONAL+=("$1") # save it in an array for later
|
||||
shift # past argument
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
TO_PATH="${VAULT_PATH}/${VAULT_FILE}"
|
||||
|
||||
cd ${VAULT_PATH}
|
||||
git pull -q
|
||||
|
||||
echo "" >> ${TO_PATH}
|
||||
echo "##### `date`" >> ${TO_PATH}
|
||||
if [ -n "${FILE_IN_VIEW}" ]; then
|
||||
echo "In file _${FILE_IN_VIEW}_" >> ${TO_PATH}
|
||||
fi
|
||||
for s in "${POSITIONAL[@]}" # restore positional parameters
|
||||
do
|
||||
echo -n "${s} " >> ${TO_PATH}
|
||||
done
|
||||
echo "" >> TO_PATH
|
||||
|
||||
git add ${TO_PATH}
|
||||
git commit -q -m "capture `date +%FT%T`"
|
||||
git push -q 2>&1 > /dev/null
|
||||
Loading…
Add table
Add a link
Reference in a new issue