From 585993537f502bf1355a591bd0dc3b8148542924 Mon Sep 17 00:00:00 2001 From: gryf Date: Tue, 15 Jul 2025 11:07:24 +0200 Subject: [PATCH] Markdown files handle. VimWiki is greedy for filetypes, as a consequence it grabs both wiki and markdown extension and name change file filetype to "wiki". For the wiki files it's not an issue for me, but grabbing markdown files is too much. With this commit those two filetypes are separated by setting empty dict for `g:vimwiki_ext2syntax`. Other than that, added fzf-aided selector for wiki files and added ruff as the linter for python files. --- vimrc | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/vimrc b/vimrc index 3119f5d..f458f0f 100644 --- a/vimrc +++ b/vimrc @@ -260,6 +260,22 @@ function s:SetMarkdownSettings() "{{{2 map :ShowInBrowser + " https://github.com/jszakmeister/markdown2ctags + let g:tagbar_type_markdown = { + \ 'ctagstype': 'markdown', + \ 'ctagsbin' : 'markdown2ctags.py', + \ 'ctagsargs' : '-f - --sort=yes --sro=»', + \ 'kinds' : [ + \ 's:sections', + \ 'i:images' + \ ], + \ 'sro' : '»', + \ 'kind2scope' : { + \ 's' : 'section', + \ }, + \ 'sort': 0, + \ } + " autocmd BufWritePost *.md :silent make endfunction "}}} @@ -410,6 +426,7 @@ endif "Ale {{{2 let g:ale_sh_bashate_executable="bashate -i E006" let g:ale_virtualtext_cursor=0 +let g:ale_linters={'python': ['ruff']} "}}} "KickAssembler {{{2 let g:kickass_path = '/opt/KickAssembler/KickAss.jar' @@ -531,11 +548,14 @@ let g:tagbar_type_vimwiki = { " Note: see statusline settings for status bar tag conf "}}} "VimWIKI {{{2 -let g:vimwiki_list = [{'path': '~/vimwiki/', +let g:vimwiki_list = [ + \ {'path': '~/vimwiki/', \ 'template_path': '~/vimwiki/', + \ 'path_html': '~/vimwiki_html_vw', \ 'template_default': 'default', \ 'template_ext': '.tpl', - \ 'css_name': 'vimwiki_style.css'}] + \ 'css_name': 'css/main.css'} + \ ] let g:vimwiki_valid_html_tags = 'b,i,s,u,sub,sup,kbd,br,hr,span' " Do not make syntax=vimwiki for markdown files, ignore md as vimwiki flavor let g:vimwiki_ext2syntax = {} @@ -783,6 +803,23 @@ endfunction "write files as a root using sudo command W w !sudo tee "%" > /dev/null + +" stolen and modified from reddit, user and post doesn't exists enymore +function! InsertVimwikiLink() + " TODO: hardcoded, perhaps make some variables to handle this, or use + " g:vimwiki_list to guess the wiki location and default extension. + let l:wikilocation = '~/vimwiki' + let l:wikiext = '.wiki' + let files = systemlist("find " . l:wikilocation . " -name '*" . l:wikiext . + \ "' | sed 's#.*" . l:wikilocation[2:] . + \ "/##; s/\\" . l:wikiext . "$//'") + let choice = fzf#run(fzf#wrap( + \ {'source': files, + \ 'sink*': { lines -> execute("normal! a[[" . lines[0] . "]]") } + \})) +endfunction +nnoremap wl :call InsertVimwikiLink() +inoremap :call InsertVimwikiLink() "}}} " GUI: detect graphics mode, set colorscheme {{{ if has('gui_running')