1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 11:30:29 +01:00

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.
This commit is contained in:
2025-07-15 11:07:24 +02:00
parent 6092e24242
commit 585993537f

41
vimrc
View File

@@ -260,6 +260,22 @@ function s:SetMarkdownSettings() "{{{2
map <S-F5> :ShowInBrowser<CR> 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 " autocmd BufWritePost *.md :silent make
endfunction endfunction
"}}} "}}}
@@ -410,6 +426,7 @@ endif
"Ale {{{2 "Ale {{{2
let g:ale_sh_bashate_executable="bashate -i E006" let g:ale_sh_bashate_executable="bashate -i E006"
let g:ale_virtualtext_cursor=0 let g:ale_virtualtext_cursor=0
let g:ale_linters={'python': ['ruff']}
"}}} "}}}
"KickAssembler {{{2 "KickAssembler {{{2
let g:kickass_path = '/opt/KickAssembler/KickAss.jar' 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 " Note: see statusline settings for status bar tag conf
"}}} "}}}
"VimWIKI {{{2 "VimWIKI {{{2
let g:vimwiki_list = [{'path': '~/vimwiki/', let g:vimwiki_list = [
\ {'path': '~/vimwiki/',
\ 'template_path': '~/vimwiki/', \ 'template_path': '~/vimwiki/',
\ 'path_html': '~/vimwiki_html_vw',
\ 'template_default': 'default', \ 'template_default': 'default',
\ 'template_ext': '.tpl', \ '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' 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 " Do not make syntax=vimwiki for markdown files, ignore md as vimwiki flavor
let g:vimwiki_ext2syntax = {} let g:vimwiki_ext2syntax = {}
@@ -783,6 +803,23 @@ endfunction
"write files as a root using sudo "write files as a root using sudo
command W w !sudo tee "%" > /dev/null 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 {{{ " GUI: detect graphics mode, set colorscheme {{{
if has('gui_running') if has('gui_running')