1
0
mirror of https://github.com/gryf/.vim.git synced 2026-03-30 11:53:32 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
585993537f 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.
2025-07-15 11:13:17 +02:00
6092e24242 Silence warning messages from vw2html,
Make markdown files not be swallowed by vimwiki ft.
2025-04-15 16:34:02 +02:00

55
vimrc
View File

@@ -260,6 +260,22 @@ function s:SetMarkdownSettings() "{{{2
map <S-F5> :ShowInBrowser<CR>
" 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
"}}}
@@ -345,9 +361,17 @@ endfunction
function s:SetVimwikiSettings() "{{{2
let b:ale_enabled=0
setlocal spell
setlocal makeprg=vw2html\ \"%\"
setlocal makeprg=vw2html\ -q\ \"%\"
map <S-F5> :Vimwiki2HTMLBrowse<CR>
map <C-F5> :PyVimwikiAll2Html<CR>
let g:tagbar_type_vimwiki = {
\ 'ctagstype' : 'vimwiki',
\ 'kinds' : [
\ 'h:header',
\ ],
\ 'sort' : 0
\ }
endfunction
"}}}
function s:SetGitcommitSettings() "{{{2
@@ -402,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'
@@ -523,12 +548,17 @@ 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 = {}
"redefine tab key for vimwiki
map <Leader>wn <Plug>VimwikiNextWord
map <Leader>wp <Plug>VimwikiPrevWord
@@ -758,7 +788,7 @@ function ConvertVimwikiToHtml(forced, currentfile)
" not vimwiki file, do nothing
return
endif
let l:command = 'vw2html'
let l:command = 'vw2html -q'
if a:forced == 1
let l:command = l:command . ' -f'
endif
@@ -773,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 <leader>wl :call InsertVimwikiLink()<CR>
inoremap <C-x><C-w> <Esc>:call InsertVimwikiLink()<CR>
"}}}
" GUI: detect graphics mode, set colorscheme {{{
if has('gui_running')