1
0
mirror of https://github.com/gryf/.vim.git synced 2026-03-26 15:53:33 +01:00

Compare commits

...

21 Commits

Author SHA1 Message Date
7b5070ab3e Asciidoc support 2024-07-13 18:05:13 +02:00
f98486130d Make whitespace stripping not default. 2024-07-13 17:42:32 +02:00
0da4596005 Drop local vimrc files iin favor of thinca/vim-localrc plugin. 2024-07-13 17:39:06 +02:00
8497d7595a Adapt repo to support XDG configuration placemet 2024-07-13 16:43:59 +02:00
2cc95674c2 Make python3 default shebang 2023-10-04 15:39:47 +02:00
f94b8415c7 Update python snippets 2023-04-04 19:04:28 +02:00
00ee99d9c8 Revisiting the plugins.
There are some of the plugins, which I never use in my workflow, so that
I've removing them. Other than that, narrow down filetype specific
plugins to the right file types.

Also removed js specific plugins, and rely only on those provided by
vim.
2023-04-04 18:51:44 +02:00
1a67b0b2a9 Back to surround plugin.
Turns out that vim-sandwitch can be slow in certain circumstances,
especially well seen with tpope/vim-repeat.
2023-04-04 17:22:12 +02:00
1bf338884a Remove redundant tmux conf syntax 2023-04-04 17:13:12 +02:00
9f2bf32892 Change riv.vim to vim-rst for restructured text support 2023-02-17 14:11:55 +01:00
61fc307d68 Comment update 2023-02-17 14:11:30 +01:00
a16be876d6 Added vimwiki headers support in tagbar.
Additionally for the vim config, there should be also appropriate ctags
configuration done in ~/.config/ctags/vimwiki.ctags:

--langdef=vimwiki
--langmap=vimwiki:.wiki
--regex-vimwiki=/^=[ \t]+(.+)[ \t]+=$/\1/h,header/
--regex-vimwiki=/^==[ \t]+(.+)[ \t]+==$/. \1/h,header/
--regex-vimwiki=/^===[ \t]+(.+)[ \t]+===$/.   \1/h,header/
--regex-vimwiki=/^====[ \t]+(.+)[ \t]+====$/.     \1/h,header/
--regex-vimwiki=/^=====[ \t]+(.+)[ \t]+=====$/.       \1/h,header/
--regex-vimwiki=/^======[ \t]+(.+)[ \t]+======$/.         \1/h,header/
2023-02-17 13:50:30 +01:00
a874ec9d16 Ale configuration 2023-02-17 13:50:17 +01:00
bc85cef317 Make gui font a bit smaller 2022-10-02 11:27:09 +02:00
7425fe57f1 Turn on spellcheck by default on vimwiki 2022-07-19 19:10:05 +02:00
7ce6c45ffc Replace vim-surrand with vim-sandwich 2022-07-19 19:09:35 +02:00
84675df236 Use old commands for fugitive, new "Git something" is kind of annoying 2022-04-15 10:07:35 +02:00
a03cd412e4 Remove markdown plugin. 2022-04-01 15:51:53 +02:00
6de69ddc5c Use roboto font for gvim. 2022-04-01 15:51:34 +02:00
34555fba68 Add some more filetypes to nuke whitespaces 2022-04-01 15:51:17 +02:00
5c5c46c252 Added xelatex as default parser to rubber 2022-04-01 15:50:32 +02:00
3 changed files with 87 additions and 91 deletions

View File

@@ -7,14 +7,17 @@ of it.
It uses `vim-plug`_ plugin manager, so after cloning, just open vim, and it
will automatically install all the plugins.
Other than that, there are two additional config files which can be added to
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.
It should be cloned as is into `$HOME`` directory, i.e:
First one is ``vimrc.local``, which might contain additional/override options
for specific machine.
.. code:: console
The other ``plugins.local`` and similarly there can be additional plugins
defined.
cd $HOME
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

View File

@@ -1,27 +1,25 @@
snippet #!
#!/usr/bin/env python
#!/usr/bin/env python3
snippet #!2
#!/usr/bin/env python2
# coding: utf-8
snippet utf
# coding: utf-8
snippet #!3
#!/usr/bin/env python3
snippet dbg Python Debugger abbrv
__import__('pdb').set_trace()
snippet ipdb ipdb abbrv
__import__('ipdb').set_trace()
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
from Tkinter import Tk
import ttk
import tkMessageBox
window = Tk()
import tkinter
import tkinter.ttk
import tkinter.messagebox
window = tkinter.Tk()
window.wm_withdraw() # make window invisible. we only want message boxes
ttk.Style().theme_use('clam')
tkMessageBox.showinfo(title="${1:title}",
message="${2:msg}",
parent=window)
tkinter.ttk.Style().theme_use('clam')
tkinter.messagebox.showinfo(title="${1:title}",
message="${2:msg}",
parent=window)
snippet _ Dunder completion
__${1:init}__$0

139
vimrc
View File

@@ -1,26 +1,34 @@
"Basic setup for all files {{{
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'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" Set colorscheme depending on the environment vim is running
if $TERM == 'linux' && !has('gui_running')
" 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
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 'davidhalter/jedi-vim', { 'for': 'python' }
Plug 'dogrover/vim-pentadactyl'
Plug 'ericpruitt/tmux.vim'
if has("patch-8.0.1453")
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
endif
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/pep8-vim', { 'for': 'python' }
Plug 'gryf/pylint-vim', { 'for': 'python' }
@@ -28,33 +36,26 @@ Plug 'gryf/python-syntax', { 'for': 'python' }
Plug 'gryf/python.vim', { 'for': 'python' }
Plug 'gryf/pythonhelper', { 'for': 'python' }
Plug 'gryf/snipmate.vim'
Plug 'gryf/vim-latex-compiler'
Plug 'gryf/vim-latex-compiler', { 'for': 'tex' }
Plug 'gryf/wombat256grf'
Plug 'gryf/zoom.vim'
Plug 'gu-fan/riv.vim', { 'for': 'rst' }
Plug 'gryf/zoom.vim' " control gui font size with '+' or '-; keys.
Plug 'habamax/vim-rst', { 'for': 'rst' }
Plug 'honza/vim-snippets'
Plug 'kazuyukitanimura/jsbeautify'
Plug 'kien/ctrlp.vim'
Plug 'mattn/calendar-vim'
Plug 'mikeage/occur.vim'
Plug 'mileszs/ack.vim'
Plug 'myhere/vim-nodejs-complete', { 'for': 'javascript' }
Plug 'othree/html5.vim', { 'for': 'html' }
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'pcaro90/jpythonfold.vim'
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
Plug 'pcaro90/jpythonfold.vim', { 'for': 'python' }
Plug 'preservim/nerdcommenter'
Plug 'preservim/tagbar'
Plug 'regedarek/ZoomWin'
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
Plug 'sjl/gundo.vim'
Plug 'skammer/vim-css-color'
Plug 'terryma/vim-multiple-cursors'
Plug 'skammer/vim-css-color', { 'for': 'css' }
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'vim-scripts/DrawIt'
Plug 'vim-scripts/JavaScript-Indent', { 'for': 'javascript' }
Plug 'vim-scripts/LanguageTool'
Plug 'vim-scripts/ShowMarks'
Plug 'vim-scripts/indentpython', { 'for': 'python' }
@@ -63,12 +64,7 @@ Plug 'vim-scripts/mako.vim', { 'for': 'mako' }
Plug 'vim-scripts/mako.vim--Torborg', { 'for': 'mako' }
Plug 'vimwiki/vimwiki'
Plug 'will133/vim-dirdiff'
" Custom plugins: custom plugins per machine {{{
" if filereadable($MYVIMRC . '.local')
if filereadable(fnamemodify($MYVIMRC, ':h') . '/plugins.local')
exec "source " . fnamemodify($MYVIMRC, ':h') . '/plugins.local'
endif
Plug 'thinca/vim-localrc'
call plug#end()
" }}}
@@ -131,7 +127,7 @@ set softtabstop=4
"spell options
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 swapfile "Use swap file
@@ -160,7 +156,7 @@ set noswapfile
"set undodir=~/.cache
" Strip trailing whitespace option
let stripTrailingWhitespace = 1
let stripTrailingWhitespace = 0
" Ignore missing spell files
let loaded_spellfile_plugin = 1
@@ -210,6 +206,12 @@ map <F3> :call <SID>CycleDiffAlgorithm()<cr>
map <F4> :call <SID>ToggleHex()<cr>
" }}}
"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
" Python specific options
setlocal cinkeys-=0#
@@ -256,18 +258,7 @@ function s:SetMarkdownSettings() "{{{2
setlocal autoindent
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>
endif
map <S-F5> :ShowInBrowser<CR>
" autocmd BufWritePost *.md :silent make
endfunction
@@ -316,20 +307,7 @@ function s:SetRestSettings() "{{{2
setlocal formatoptions=tcq "set VIms default
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>
endif
map <S-F5> :ShowInBrowser<CR>
function! WordFrequency() range
let all = split(join(getline(a:firstline, a:lastline)), '\k\+')
@@ -365,6 +343,7 @@ function s:SetRestSettings() "{{{2
endfunction
"}}}
function s:SetVimwikiSettings() "{{{2
setlocal spell
map <F5> :Vimwiki2HTML<CR>
map <S-F5> :Vimwiki2HTMLBrowse<CR>
map <C-F5> :VimwikiAll2HTML<CR>
@@ -376,11 +355,6 @@ function s:SetGitcommitSettings() "{{{2
endfunction
"}}}
"remove all trailing whitespace for specified files before write
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces(0, 'n')
"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
@@ -388,6 +362,7 @@ autocmd BufRead *.ass, *asm set filetype=kickass
autocmd WinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
autocmd FileType asciidoc call <SID>SetAsciiDoc()
autocmd FileType python call <SID>SetPythonSettings()
autocmd FileType json call <SID>SetJavaScriptSettings()
autocmd FileType javascript call <SID>SetJavaScriptSettings()
@@ -423,6 +398,10 @@ if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
"}}}
"Ale {{{2
let g:ale_sh_bashate_executable="bashate -i E006"
let g:ale_virtualtext_cursor=0
"}}}
"KickAssembler {{{2
let g:kickass_path = '/opt/KickAssembler/KickAss.jar'
"}}}
@@ -465,6 +444,10 @@ vmap <expr> <C-UP> DVB_Drag('up')
vmap <expr> D DVB_Duplicate()
let g:DVB_TrimWS = 1
"}}}
"Fugitive {{{2
" I like simple G* commands, i.e. Gblame over Git blame
let g:fugitive_legacy_commands = 1
"}}}
"Gundo {{{2
map <Leader>u :GundoToggle<cr>
let g:gundo_prefer_python3 = 1
@@ -520,6 +503,7 @@ let g:riv_auto_format_table = 0
"}}}
" Rubber / vim-latex-compiler {{{2
let g:rubber_make_on_save = 0
let g:rubber_command = 'xelatex'
" }}}
"ShowMarks {{{2
let g:showmarks_ignore_type = "hqprm"
@@ -528,6 +512,13 @@ let g:showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
"Tagbar {{{2
nmap <Leader>t :Tagbar<CR>
let g:tagbar_compact = 1
let g:tagbar_type_vimwiki = {
\ 'ctagstype' : 'vimwiki',
\ 'kinds' : [
\ 'h:header',
\ ],
\ 'sort' : 0
\ }
" Note: see statusline settings for status bar tag conf
"}}}
"VimWIKI {{{2
@@ -569,6 +560,19 @@ endfunction
"}}}
" 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
function <SID>Make()
echohl Statement
@@ -587,7 +591,7 @@ function <SID>StripTrailingWhitespaces(force, mode) range
return
endif
if a:force == 1 || &ft =~ 'python\|rst\|wiki\|javascript\|css\|html\|xml'
if a:force == 1 || &ft =~ 'python\|rst\|wiki\|javascript\|css\|html\|xml\|yaml\|sh'
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
@@ -749,7 +753,7 @@ command W w !sudo tee "%" > /dev/null
"}}}
" GUI: detect graphics mode, set colorscheme {{{
if has('gui_running')
set guifont=DejaVuSansMono\ Nerd\ Font\ Mono\ 12
set guifont=RobotoMono\ Nerd\ Font\ 11
set mouse=a "Enable mouse support
" No toolbar, menu, scrollbars, draw simple text tabs. This would keep
" window in one place, and also this will conserve space. Tabs are huge
@@ -761,16 +765,7 @@ if has('gui_running')
au GUIEnter * set vb t_vb=
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: