Skip to content

Commit

Permalink
vimwiki: integrate config into main vimrc
Browse files Browse the repository at this point in the history
  • Loading branch information
teranex committed Feb 16, 2013
1 parent 05ac988 commit 4f29fbf
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 74 deletions.
46 changes: 44 additions & 2 deletions vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,20 @@ let g:vimwiki_hl_cb_checked=1
let g:vimwiki_hl_headers=1
let g:vimwiki_dir_link='index'
let g:vimwiki_url_mingain=1000
" define the default wiki
let wiki = {}
let wiki.path = '~/vimwiki/'
let wiki.nested_syntaxes = {
\ 'bash': 'sh',
\ 'python': 'python',
\ 'ruby': 'ruby',
\ 'html': 'html',
\ 'php': 'php',
\ 'vim': 'vim',
\ 'conf': 'conf',
\ 'gitconf': 'gitconfig',
\}
let g:vimwiki_list = [wiki]

" settings for ctrlp =====================================================
let g:ctrlp_working_path_mode = 0
Expand Down Expand Up @@ -399,9 +413,9 @@ function! s:ConfigurePHP()
setlocal fdm=indent
syn sync fromstart
endfunction
autocmd FileType php call s:ConfigurePHP()

" configure Filetypes
autocmd FileType php call s:ConfigurePHP()
autocmd FileType ruby setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType html setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType css setlocal shiftwidth=2 tabstop=2 softtabstop=2 | ColorHighlight
Expand All @@ -415,7 +429,6 @@ function! s:ConfigureGitCommit()
setlocal foldexpr=UnifiedDiffFolds()
setlocal foldlevel=0
endfunction

autocmd FileType gitcommit call s:ConfigureGitCommit()

" open the quickfix window after grepping
Expand All @@ -430,6 +443,35 @@ function! s:ConfigureTmpBuffer()
endfunction
autocmd BufReadPost {/tmp/*.eml,pentadactyl.txt} call s:ConfigureTmpBuffer()

" configure vimwiki files
function! s:ConfigureVimwiki()
Rooter
setlocal wrap
setlocal nolist
setlocal linebreak
setlocal foldmethod=marker
setlocal foldlevelstart=0
setlocal foldmarker=\ {{{,%%\ }}} " set foldmarkers so they don't include syntax regions
setlocal textwidth=100
if has('conceal')
setlocal concealcursor=c
endif
if has("gui_running")
setlocal spell
setlocal spelllang=en,nl " check spelling in both English and Dutch by default
endif

" assign ctrl-j to expand snippets, tab is used for table cells
inoremap <buffer> <C-j> <C-R>=UltiSnips_ExpandSnippetOrJump()<CR>
" quickly open the general task list
map <buffer> ,tl :e tasks/index.wiki<CR>
" quickly add a new general task
map <buffer> ,ta ,tlggjO
" quickly archive (_F_ile) a task
map <buffer> ,tf :m$-1<CR>'.
endfunction
autocmd FileType vimwiki call s:ConfigureVimwiki()

" set up to change the status line based on mode
autocmd InsertEnter * hi! link StatusLine StatusLineInsert
autocmd InsertLeave * hi! link StatusLine NONE
Expand Down
91 changes: 19 additions & 72 deletions vimwikirc
Original file line number Diff line number Diff line change
@@ -1,56 +1,3 @@
set wrap
set textwidth=100
set spell
set spelllang=en,nl " check spelling in both English and Dutch by default
set nolist
set lbr
set foldmethod=marker
set foldmarker=\ {{{,%%\ }}} " set foldmarkers so they don't include syntax regions
set foldlevelstart=0
if has('conceal')
set concealcursor=c
endif

" assign ctrl-j to expand snippets, tab is used for table cells
inoremap <C-j> <C-R>=UltiSnips_ExpandSnippetOrJump()<CR>
" natural j
map j gj
" natural k
map k gk
" quickly open the general task list
map ,tl :e tasks/index.wiki<CR>
" quickly add a new general task
map ,ta ,tlggjO
" quickly archive (_F_ile) a task
" map ,tf ddzRGkp''
map ,tf :m$-1<CR>'.
" define the default wiki
let wiki = {}
let wiki.path = '~/vimwiki/'
let wiki.nested_syntaxes = {
\ 'bash': 'sh',
\ 'python': 'python',
\ 'ruby': 'ruby',
\ 'html': 'html',
\ 'php': 'php',
\ 'vim': 'vim',
\ 'conf': 'conf',
\ 'gitconf': 'gitconfig',
\}
let g:vimwiki_list = [wiki]

" configure namazu
let g:namazu_index = "~/vimwiki/.namazu"

" configure vimwiki
function! s:ConfigureVimwiki()
Rooter
setlocal wrap spell nolist lbr foldmethod=marker foldlevelstart=0
endfunction
autocmd FileType vimwiki call s:ConfigureVimwiki()

" function! s:SyncVimwiki(op)
" let old_shell=&shell
" set shell=/bin/bash\ -i
Expand All @@ -67,24 +14,24 @@ autocmd FileType vimwiki call s:ConfigureVimwiki()
" autocmd VimLeave * call s:SyncVimwiki("full")
" endif

function! s:InsertWebpage(url)
let startline = line('.')
exec "normal! a%% {{{ ".a:url
exec "read !links -dump ".a:url." -width ".&textwidth
exec "normal! o"
exec "normal! 0i%% }}}\<CR>"
let endline = line('.')
" jump back to the first line
exec startline
endfunction

command! -nargs=1 InsertWebpage call s:InsertWebpage(<f-args>)

function! UpdateDiaryLinks()
VimwikiDiaryGenerateLinks
write
endfunction

autocmd BufRead diary.wiki call UpdateDiaryLinks()
" function! s:InsertWebpage(url)
" let startline = line('.')
" exec "normal! a%% {{{ ".a:url
" exec "read !links -dump ".a:url." -width ".&textwidth
" exec "normal! o"
" exec "normal! 0i%% }}}\<CR>"
" let endline = line('.')
" " jump back to the first line
" exec startline
" endfunction
"
" command! -nargs=1 InsertWebpage call s:InsertWebpage(<f-args>)
"
" function! UpdateDiaryLinks()
" VimwikiDiaryGenerateLinks
" write
" endfunction
"
" autocmd BufRead diary.wiki call UpdateDiaryLinks()

" vim: ft=vim

0 comments on commit 4f29fbf

Please sign in to comment.