1
0
mirror of https://github.com/gryf/.vim.git synced 2026-03-27 08:13:31 +01:00

Compare commits

..

4 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
a55590f07c Add commands for wrapper function on vw2html 2025-02-13 09:24:42 +01:00
34d7979d62 Added diffchar plugin for detailed diff 2025-02-13 09:05:44 +01:00

84
vimrc
View File

@@ -64,11 +64,11 @@ Plug 'vim-scripts/mako.vim', { 'for': 'mako' }
Plug 'vim-scripts/mako.vim--Torborg', { 'for': 'mako' }
Plug 'vimwiki/vimwiki'
Plug 'will133/vim-dirdiff'
Plug 'rickhowe/diffchar.vim'
Plug 'thinca/vim-localrc'
call plug#end()
" }}}
" }}}
filetype plugin indent on "turn plugins/indent on
syntax on "Turn syntax highlighting on
@@ -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
"}}}
@@ -343,10 +359,19 @@ function s:SetRestSettings() "{{{2
endfunction
"}}}
function s:SetVimwikiSettings() "{{{2
let b:ale_enabled=0
setlocal spell
map <F5> :Vimwiki2HTML<CR>
setlocal makeprg=vw2html\ -q\ \"%\"
map <S-F5> :Vimwiki2HTMLBrowse<CR>
map <C-F5> :VimwikiAll2HTML<CR>
map <C-F5> :PyVimwikiAll2Html<CR>
let g:tagbar_type_vimwiki = {
\ 'ctagstype' : 'vimwiki',
\ 'kinds' : [
\ 'h:header',
\ ],
\ 'sort' : 0
\ }
endfunction
"}}}
function s:SetGitcommitSettings() "{{{2
@@ -355,8 +380,8 @@ function s:SetGitcommitSettings() "{{{2
endfunction
"}}}
autocmd BufRead *.mako set filetype=mako
autocmd BufRead *.ass, *asm set filetype=kickass
autocmd BufRead,BufNewFile *.mako set filetype=mako
autocmd BufRead,BufNewFile *.ass, *asm set filetype=kickass
" make the current line highlighted only on current window
autocmd WinEnter * setlocal cursorline
@@ -401,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'
@@ -522,11 +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
@@ -748,8 +780,46 @@ function s:CycleDiffAlgorithm()
echom 'Set diff algorithm to: ' . split(l:nextalgo, ':')[1]
endfunction
" Convert wiki files to HTML
command -bang -nargs=? PyVimwikiAll2Html call ConvertVimwikiToHtml(<bang>0, 0)
command -bang -nargs=? PyVimwikiHtml call ConvertVimwikiToHtml(<bang>0, 1)
function ConvertVimwikiToHtml(forced, currentfile)
if &ft != 'vimwiki'
" not vimwiki file, do nothing
return
endif
let l:command = 'vw2html -q'
if a:forced == 1
let l:command = l:command . ' -f'
endif
if a:currentfile == 1
let l:command = l:command . ' ' . bufname("%")
endif
call system(l:command)
echom "Conversion to HTML done with command: " . l:command
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')