/
notes.vimrc
85 lines (64 loc) · 1.78 KB
/
notes.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
set nocp
set backspace=indent,eol,start
set novisualbell " don't blink
set noerrorbells "don't make noise
set cursorline " highlight current line
set shiftwidth=2
set tabstop=2
set expandtab
" autoindent just re-uses the indent of the pervious line
set autoindent
set backup " keep a backup file
set backupdir=.backups/
set directory=.backups/
nnoremap <CR> "=strftime("✍ %F %r\n")<CR>po<TAB>
"remember last cursor postion
" TODO doesnt work
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
"don't use any of the default vim stuff
set runtimepath=./
call pathogen#runtime_append_all_bundles()
" load all the plugins
runtime! plugin/**/*.vim
""""""""""""""""""""""""""""""""""
" have nerdtree quit if it's the last window open
" https://github.com/scrooloose/nerdtree/issues#issue/21
"
function! NERDTreeQuit()
redir => buffersoutput
silent buffers
redir END
" 1BufNo 2Mods. 3File 4LineNo
let pattern = '^\s*\(\d\+\)\(.....\) "\(.*\)"\s\+line \(\d\+\)$'
let windowfound = 0
for bline in split(buffersoutput, "\n")
let m = matchlist(bline, pattern)
if (len(m) > 0)
if (m[2] =~ '..a..')
let windowfound = 1
endif
endif
endfor
if (!windowfound)
quitall
endif
endfunction
autocmd WinEnter * call NERDTreeQuit()
" nerdtree browsing
let NERDTreeHighlightCursorline=0
let NERDTreeStatusline="\%{strftime('%F')}"
let NERDTreeWinSize=20
"TODO: remove the top 5 lines...
" open the tree
NERDTree notesdb
" set the focus on the first buffer
wincmd l
" move to the bottom of the page.
$
" TODO:
" syntax highlighting
"syntax enable " not syn on, we want to define our own
"set syntax=notes-syntax
" right hand-side todolist
" gVim links -> open in browser.
" easy pasting