mirror of
https://github.com/gryf/.vim.git
synced 2026-03-27 16:23:31 +01:00
Compare commits
13 Commits
9f2bf32892
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 585993537f | |||
| 6092e24242 | |||
| a55590f07c | |||
| 34d7979d62 | |||
| 7b5070ab3e | |||
| f98486130d | |||
| 0da4596005 | |||
| 8497d7595a | |||
| 2cc95674c2 | |||
| f94b8415c7 | |||
| 00ee99d9c8 | |||
| 1a67b0b2a9 | |||
| 1bf338884a |
17
README.rst
17
README.rst
@@ -7,14 +7,17 @@ of it.
|
|||||||
It uses `vim-plug`_ plugin manager, so after cloning, just open vim, and it
|
It uses `vim-plug`_ plugin manager, so after cloning, just open vim, and it
|
||||||
will automatically install all the plugins.
|
will automatically install all the plugins.
|
||||||
|
|
||||||
Other than that, there are two additional config files which can be added to
|
It should be cloned as is into `$HOME`` directory, i.e:
|
||||||
the configuration as a local configuration files just to not mess up with main
|
|
||||||
config file. Both of them should be placed under ``$HOME/.vim`` directory.
|
|
||||||
|
|
||||||
First one is ``vimrc.local``, which might contain additional/override options
|
.. code:: console
|
||||||
for specific machine.
|
|
||||||
|
|
||||||
The other ``plugins.local`` and similarly there can be additional plugins
|
cd $HOME
|
||||||
defined.
|
git clone https://github.com/gryf/.vim
|
||||||
|
|
||||||
|
or in ``$XDG_COFIG_HOME`` directory, which usually is set to ``$HOME/.config``:
|
||||||
|
|
||||||
|
.. code:: console
|
||||||
|
|
||||||
|
git clone https://github.com/gryf/.vim ~/.config/vim
|
||||||
|
|
||||||
.. _vim-plug: https://github.com/junegunn/vim-plug
|
.. _vim-plug: https://github.com/junegunn/vim-plug
|
||||||
|
|||||||
@@ -1,26 +1,24 @@
|
|||||||
snippet #!
|
snippet #!
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
snippet #!2
|
snippet #!2
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
snippet utf
|
snippet utf
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
snippet #!3
|
|
||||||
#!/usr/bin/env python3
|
|
||||||
snippet dbg Python Debugger abbrv
|
snippet dbg Python Debugger abbrv
|
||||||
__import__('pdb').set_trace()
|
__import__('pdb').set_trace()
|
||||||
snippet ipdb ipdb abbrv
|
snippet ipdb ipdb abbrv
|
||||||
__import__('ipdb').set_trace()
|
__import__('ipdb').set_trace()
|
||||||
snippet rpdb remote_pdb debbuger
|
snippet rpdb remote_pdb debbuger
|
||||||
__import__('remote_pdb').set_trace()
|
__import__('remote_pdb').RemotePdb('127.0.0.1', 4444).set_trace()
|
||||||
snippet msg Tk graphical message
|
snippet msg Tk graphical message
|
||||||
from Tkinter import Tk
|
import tkinter
|
||||||
import ttk
|
import tkinter.ttk
|
||||||
import tkMessageBox
|
import tkinter.messagebox
|
||||||
window = Tk()
|
window = tkinter.Tk()
|
||||||
window.wm_withdraw() # make window invisible. we only want message boxes
|
window.wm_withdraw() # make window invisible. we only want message boxes
|
||||||
ttk.Style().theme_use('clam')
|
tkinter.ttk.Style().theme_use('clam')
|
||||||
tkMessageBox.showinfo(title="${1:title}",
|
tkinter.messagebox.showinfo(title="${1:title}",
|
||||||
message="${2:msg}",
|
message="${2:msg}",
|
||||||
parent=window)
|
parent=window)
|
||||||
snippet _ Dunder completion
|
snippet _ Dunder completion
|
||||||
|
|||||||
201
vimrc
201
vimrc
@@ -1,26 +1,34 @@
|
|||||||
"Basic setup for all files {{{
|
"Basic setup for all files {{{
|
||||||
set nocompatible "VIM over VI
|
set nocompatible "VIM over VI
|
||||||
|
|
||||||
" vimplug conf {{{
|
" Get the config dir, as config can be either on ~/.vim or ~/.config/vim
|
||||||
|
let s:_confdir = fnamemodify($MYVIMRC, ':h')
|
||||||
|
|
||||||
if empty(glob('~/.vim/autoload/plug.vim'))
|
" Set colorscheme depending on the environment vim is running
|
||||||
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
if $TERM == 'linux' && !has('gui_running')
|
||||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
" fallback to basic 8-color colorscheme
|
||||||
|
let s:_colorscheme = 'pablo'
|
||||||
|
else
|
||||||
|
let s:_colorscheme = 'wombat256grf'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" vimplug conf {{{
|
||||||
|
if ! filereadable(s:_confdir . '/autoload/plug.vim')
|
||||||
|
silent exec "!curl -fLo " . s:_confdir . "/autoload/plug.vim --create-dirs"
|
||||||
|
\ "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
|
||||||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call plug#begin('~/.vim/bundle')
|
call plug#begin(s:_confdir . '/bundle')
|
||||||
|
|
||||||
Plug 'Valloric/MatchTagAlways'
|
Plug 'Valloric/MatchTagAlways', { 'for': ['html', 'xml'] }
|
||||||
Plug 'ayuanx/vim-mark-standalone'
|
Plug 'ayuanx/vim-mark-standalone'
|
||||||
Plug 'davidhalter/jedi-vim', { 'for': 'python' }
|
Plug 'davidhalter/jedi-vim', { 'for': 'python' }
|
||||||
Plug 'dogrover/vim-pentadactyl'
|
|
||||||
Plug 'ericpruitt/tmux.vim'
|
|
||||||
if has("patch-8.0.1453")
|
if has("patch-8.0.1453")
|
||||||
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
||||||
endif
|
endif
|
||||||
Plug 'dense-analysis/ale'
|
Plug 'dense-analysis/ale'
|
||||||
Plug 'fs111/pydoc.vim', { 'for': 'python' }
|
Plug 'fs111/pydoc.vim', { 'for': 'python' } " adds Pydoc command and K under cursor
|
||||||
Plug 'gryf/dragvisuals'
|
Plug 'gryf/dragvisuals'
|
||||||
Plug 'gryf/pep8-vim', { 'for': 'python' }
|
Plug 'gryf/pep8-vim', { 'for': 'python' }
|
||||||
Plug 'gryf/pylint-vim', { 'for': 'python' }
|
Plug 'gryf/pylint-vim', { 'for': 'python' }
|
||||||
@@ -28,32 +36,26 @@ Plug 'gryf/python-syntax', { 'for': 'python' }
|
|||||||
Plug 'gryf/python.vim', { 'for': 'python' }
|
Plug 'gryf/python.vim', { 'for': 'python' }
|
||||||
Plug 'gryf/pythonhelper', { 'for': 'python' }
|
Plug 'gryf/pythonhelper', { 'for': 'python' }
|
||||||
Plug 'gryf/snipmate.vim'
|
Plug 'gryf/snipmate.vim'
|
||||||
Plug 'gryf/vim-latex-compiler'
|
Plug 'gryf/vim-latex-compiler', { 'for': 'tex' }
|
||||||
Plug 'gryf/wombat256grf'
|
Plug 'gryf/wombat256grf'
|
||||||
Plug 'gryf/zoom.vim'
|
Plug 'gryf/zoom.vim' " control gui font size with '+' or '-; keys.
|
||||||
Plug 'habamax/vim-rst', { 'for': 'rst' }
|
Plug 'habamax/vim-rst', { 'for': 'rst' }
|
||||||
Plug 'honza/vim-snippets'
|
Plug 'honza/vim-snippets'
|
||||||
Plug 'kazuyukitanimura/jsbeautify'
|
|
||||||
Plug 'kien/ctrlp.vim'
|
Plug 'kien/ctrlp.vim'
|
||||||
Plug 'mattn/calendar-vim'
|
|
||||||
Plug 'mikeage/occur.vim'
|
Plug 'mikeage/occur.vim'
|
||||||
Plug 'mileszs/ack.vim'
|
Plug 'mileszs/ack.vim'
|
||||||
Plug 'myhere/vim-nodejs-complete', { 'for': 'javascript' }
|
|
||||||
Plug 'othree/html5.vim', { 'for': 'html' }
|
Plug 'othree/html5.vim', { 'for': 'html' }
|
||||||
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
|
Plug 'pcaro90/jpythonfold.vim', { 'for': 'python' }
|
||||||
Plug 'pcaro90/jpythonfold.vim'
|
|
||||||
Plug 'preservim/nerdcommenter'
|
Plug 'preservim/nerdcommenter'
|
||||||
Plug 'preservim/tagbar'
|
Plug 'preservim/tagbar'
|
||||||
Plug 'regedarek/ZoomWin'
|
Plug 'regedarek/ZoomWin'
|
||||||
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
|
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
|
||||||
Plug 'sjl/gundo.vim'
|
Plug 'sjl/gundo.vim'
|
||||||
Plug 'skammer/vim-css-color'
|
Plug 'skammer/vim-css-color', { 'for': 'css' }
|
||||||
Plug 'terryma/vim-multiple-cursors'
|
|
||||||
Plug 'tpope/vim-fugitive'
|
Plug 'tpope/vim-fugitive'
|
||||||
Plug 'tpope/vim-repeat'
|
Plug 'tpope/vim-repeat'
|
||||||
Plug 'machakann/vim-sandwich'
|
Plug 'tpope/vim-surround'
|
||||||
Plug 'vim-scripts/DrawIt'
|
Plug 'vim-scripts/DrawIt'
|
||||||
Plug 'vim-scripts/JavaScript-Indent', { 'for': 'javascript' }
|
|
||||||
Plug 'vim-scripts/LanguageTool'
|
Plug 'vim-scripts/LanguageTool'
|
||||||
Plug 'vim-scripts/ShowMarks'
|
Plug 'vim-scripts/ShowMarks'
|
||||||
Plug 'vim-scripts/indentpython', { 'for': 'python' }
|
Plug 'vim-scripts/indentpython', { 'for': 'python' }
|
||||||
@@ -62,16 +64,11 @@ Plug 'vim-scripts/mako.vim', { 'for': 'mako' }
|
|||||||
Plug 'vim-scripts/mako.vim--Torborg', { 'for': 'mako' }
|
Plug 'vim-scripts/mako.vim--Torborg', { 'for': 'mako' }
|
||||||
Plug 'vimwiki/vimwiki'
|
Plug 'vimwiki/vimwiki'
|
||||||
Plug 'will133/vim-dirdiff'
|
Plug 'will133/vim-dirdiff'
|
||||||
|
Plug 'rickhowe/diffchar.vim'
|
||||||
" Custom plugins: custom plugins per machine {{{
|
Plug 'thinca/vim-localrc'
|
||||||
" if filereadable($MYVIMRC . '.local')
|
|
||||||
if filereadable(fnamemodify($MYVIMRC, ':h') . '/plugins.local')
|
|
||||||
exec "source " . fnamemodify($MYVIMRC, ':h') . '/plugins.local'
|
|
||||||
endif
|
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
" }}}
|
" }}}
|
||||||
" }}}
|
|
||||||
|
|
||||||
filetype plugin indent on "turn plugins/indent on
|
filetype plugin indent on "turn plugins/indent on
|
||||||
syntax on "Turn syntax highlighting on
|
syntax on "Turn syntax highlighting on
|
||||||
@@ -130,7 +127,7 @@ set softtabstop=4
|
|||||||
|
|
||||||
"spell options
|
"spell options
|
||||||
set spelllang=pl,en
|
set spelllang=pl,en
|
||||||
let &spellfile=expand('~/.vim/spell/pl.utf-8.add')
|
let &spellfile=expand(s:_confdir . '/spell/pl.utf-8.add')
|
||||||
|
|
||||||
set splitbelow "Create new window below current one
|
set splitbelow "Create new window below current one
|
||||||
set swapfile "Use swap file
|
set swapfile "Use swap file
|
||||||
@@ -159,7 +156,7 @@ set noswapfile
|
|||||||
"set undodir=~/.cache
|
"set undodir=~/.cache
|
||||||
|
|
||||||
" Strip trailing whitespace option
|
" Strip trailing whitespace option
|
||||||
let stripTrailingWhitespace = 1
|
let stripTrailingWhitespace = 0
|
||||||
|
|
||||||
" Ignore missing spell files
|
" Ignore missing spell files
|
||||||
let loaded_spellfile_plugin = 1
|
let loaded_spellfile_plugin = 1
|
||||||
@@ -209,6 +206,12 @@ map <F3> :call <SID>CycleDiffAlgorithm()<cr>
|
|||||||
map <F4> :call <SID>ToggleHex()<cr>
|
map <F4> :call <SID>ToggleHex()<cr>
|
||||||
" }}}
|
" }}}
|
||||||
"FileTypes: specific vim behaviour {{{
|
"FileTypes: specific vim behaviour {{{
|
||||||
|
function s:SetAsciiDoc() "{{{2
|
||||||
|
" AsciiDoc specific options
|
||||||
|
setlocal makeprg=asciidoc\ -b\ html5\ \"%\"
|
||||||
|
map <S-F5> :ShowInBrowser<CR>
|
||||||
|
endfunction
|
||||||
|
"}}}
|
||||||
function s:SetPythonSettings() "{{{2
|
function s:SetPythonSettings() "{{{2
|
||||||
" Python specific options
|
" Python specific options
|
||||||
setlocal cinkeys-=0#
|
setlocal cinkeys-=0#
|
||||||
@@ -255,18 +258,23 @@ function s:SetMarkdownSettings() "{{{2
|
|||||||
setlocal autoindent
|
setlocal autoindent
|
||||||
setlocal formatoptions=tcq "set VIms default
|
setlocal formatoptions=tcq "set VIms default
|
||||||
|
|
||||||
function! <SID>ShowInBrowser()
|
|
||||||
let l:uri = expand("%:p:r") . ".html"
|
|
||||||
call system(g:browser . " " . l:uri)
|
|
||||||
echohl Statement
|
|
||||||
echo "Opened '" . l:uri ."' in " . g:browser
|
|
||||||
echohl None
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if !exists(":ShowInBrowser")
|
|
||||||
command ShowInBrowser call s:ShowInBrowser()
|
|
||||||
map <S-F5> :ShowInBrowser<CR>
|
map <S-F5> :ShowInBrowser<CR>
|
||||||
endif
|
|
||||||
|
" 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
|
||||||
@@ -315,20 +323,7 @@ function s:SetRestSettings() "{{{2
|
|||||||
setlocal formatoptions=tcq "set VIms default
|
setlocal formatoptions=tcq "set VIms default
|
||||||
syn spell toplevel
|
syn spell toplevel
|
||||||
|
|
||||||
function! <SID>ShowInBrowser()
|
|
||||||
let l:uri = expand("%:p:r") . ".html"
|
|
||||||
silent make
|
|
||||||
call system(g:browser . " " . l:uri)
|
|
||||||
|
|
||||||
echohl Statement
|
|
||||||
echo "Opened '" . l:uri ."' in " . g:browser
|
|
||||||
echohl None
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if !exists(":ShowInBrowser")
|
|
||||||
command ShowInBrowser call s:ShowInBrowser()
|
|
||||||
map <S-F5> :ShowInBrowser<CR>
|
map <S-F5> :ShowInBrowser<CR>
|
||||||
endif
|
|
||||||
|
|
||||||
function! WordFrequency() range
|
function! WordFrequency() range
|
||||||
let all = split(join(getline(a:firstline, a:lastline)), '\k\+')
|
let all = split(join(getline(a:firstline, a:lastline)), '\k\+')
|
||||||
@@ -364,10 +359,19 @@ function s:SetRestSettings() "{{{2
|
|||||||
endfunction
|
endfunction
|
||||||
"}}}
|
"}}}
|
||||||
function s:SetVimwikiSettings() "{{{2
|
function s:SetVimwikiSettings() "{{{2
|
||||||
|
let b:ale_enabled=0
|
||||||
setlocal spell
|
setlocal spell
|
||||||
map <F5> :Vimwiki2HTML<CR>
|
setlocal makeprg=vw2html\ -q\ \"%\"
|
||||||
map <S-F5> :Vimwiki2HTMLBrowse<CR>
|
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
|
endfunction
|
||||||
"}}}
|
"}}}
|
||||||
function s:SetGitcommitSettings() "{{{2
|
function s:SetGitcommitSettings() "{{{2
|
||||||
@@ -376,18 +380,14 @@ function s:SetGitcommitSettings() "{{{2
|
|||||||
endfunction
|
endfunction
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
"remove all trailing whitespace for specified files before write
|
autocmd BufRead,BufNewFile *.mako set filetype=mako
|
||||||
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces(0, 'n')
|
autocmd BufRead,BufNewFile *.ass, *asm set filetype=kickass
|
||||||
|
|
||||||
"set correct filetype for tmux
|
|
||||||
autocmd BufRead *.tmux.conf set filetype=tmux
|
|
||||||
autocmd BufRead *.mako set filetype=mako
|
|
||||||
autocmd BufRead *.ass, *asm set filetype=kickass
|
|
||||||
|
|
||||||
" make the current line highlighted only on current window
|
" make the current line highlighted only on current window
|
||||||
autocmd WinEnter * setlocal cursorline
|
autocmd WinEnter * setlocal cursorline
|
||||||
autocmd WinLeave * setlocal nocursorline
|
autocmd WinLeave * setlocal nocursorline
|
||||||
|
|
||||||
|
autocmd FileType asciidoc call <SID>SetAsciiDoc()
|
||||||
autocmd FileType python call <SID>SetPythonSettings()
|
autocmd FileType python call <SID>SetPythonSettings()
|
||||||
autocmd FileType json call <SID>SetJavaScriptSettings()
|
autocmd FileType json call <SID>SetJavaScriptSettings()
|
||||||
autocmd FileType javascript call <SID>SetJavaScriptSettings()
|
autocmd FileType javascript call <SID>SetJavaScriptSettings()
|
||||||
@@ -426,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'
|
||||||
@@ -546,16 +547,18 @@ let g:tagbar_type_vimwiki = {
|
|||||||
\ }
|
\ }
|
||||||
" Note: see statusline settings for status bar tag conf
|
" Note: see statusline settings for status bar tag conf
|
||||||
"}}}
|
"}}}
|
||||||
"Sandwitch {{{2
|
|
||||||
" Make sandwitch to use my memorymuscle craved shorcuts for surround
|
|
||||||
runtime macros/sandwich/keymap/surround.vim
|
|
||||||
"}}}
|
|
||||||
"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'
|
||||||
|
" Do not make syntax=vimwiki for markdown files, ignore md as vimwiki flavor
|
||||||
|
let g:vimwiki_ext2syntax = {}
|
||||||
"redefine tab key for vimwiki
|
"redefine tab key for vimwiki
|
||||||
map <Leader>wn <Plug>VimwikiNextWord
|
map <Leader>wn <Plug>VimwikiNextWord
|
||||||
map <Leader>wp <Plug>VimwikiPrevWord
|
map <Leader>wp <Plug>VimwikiPrevWord
|
||||||
@@ -589,6 +592,19 @@ endfunction
|
|||||||
"}}}
|
"}}}
|
||||||
" FUNCTIONS: usefull functions for all of the files {{{
|
" FUNCTIONS: usefull functions for all of the files {{{
|
||||||
|
|
||||||
|
" open file in a browser. Usefull for documentation filetypes like reST, md or
|
||||||
|
" asciidoc
|
||||||
|
function! <SID>ShowInBrowser()
|
||||||
|
let l:uri = expand("%:p:r") . ".html"
|
||||||
|
silent make
|
||||||
|
call system(g:browser . " " . l:uri)
|
||||||
|
|
||||||
|
echohl Statement
|
||||||
|
echo "Opened '" . l:uri ."' in " . g:browser
|
||||||
|
echohl None
|
||||||
|
endfunction
|
||||||
|
command ShowInBrowser call s:ShowInBrowser()
|
||||||
|
|
||||||
" Simple wrapper for :make command
|
" Simple wrapper for :make command
|
||||||
function <SID>Make()
|
function <SID>Make()
|
||||||
echohl Statement
|
echohl Statement
|
||||||
@@ -764,8 +780,46 @@ function s:CycleDiffAlgorithm()
|
|||||||
echom 'Set diff algorithm to: ' . split(l:nextalgo, ':')[1]
|
echom 'Set diff algorithm to: ' . split(l:nextalgo, ':')[1]
|
||||||
endfunction
|
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
|
"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')
|
||||||
@@ -781,16 +835,7 @@ if has('gui_running')
|
|||||||
au GUIEnter * set vb t_vb=
|
au GUIEnter * set vb t_vb=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
silent! colorscheme wombat256grf
|
silent! exec 'colorscheme ' . s:_colorscheme
|
||||||
|
|
||||||
if $TERM == 'linux' && !has('gui_running')
|
|
||||||
" fallback to basic 8-color colorscheme
|
|
||||||
colorscheme pablo
|
|
||||||
endif
|
|
||||||
"}}}
|
|
||||||
" Custom: custom config per machine {{{
|
|
||||||
if filereadable($MYVIMRC . '.local')
|
|
||||||
exec "source " . $MYVIMRC . '.local'
|
|
||||||
endif
|
|
||||||
"}}}
|
"}}}
|
||||||
" vim:ts=4:sw=4:wrap:fdm=marker:
|
" vim:ts=4:sw=4:wrap:fdm=marker:
|
||||||
|
|||||||
Reference in New Issue
Block a user