1
0
mirror of https://github.com/gryf/.vim.git synced 2026-04-20 17:01:24 +02:00

Compare commits

...

4 Commits

2 changed files with 52 additions and 60 deletions
+10 -7
View File
@@ -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
+42 -53
View File
@@ -1,15 +1,25 @@
"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', { 'for': ['html', 'xml'] } Plug 'Valloric/MatchTagAlways', { 'for': ['html', 'xml'] }
Plug 'ayuanx/vim-mark-standalone' Plug 'ayuanx/vim-mark-standalone'
@@ -28,7 +38,7 @@ Plug 'gryf/pythonhelper', { 'for': 'python' }
Plug 'gryf/snipmate.vim' Plug 'gryf/snipmate.vim'
Plug 'gryf/vim-latex-compiler', { 'for': 'tex' } Plug 'gryf/vim-latex-compiler', { 'for': 'tex' }
Plug 'gryf/wombat256grf' Plug 'gryf/wombat256grf'
Plug 'gryf/zoom.vim' " control gui font size with '+' or '-; keys. 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 'kien/ctrlp.vim' Plug 'kien/ctrlp.vim'
@@ -54,12 +64,7 @@ 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 'thinca/vim-localrc'
" 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
call plug#end() call plug#end()
" }}} " }}}
@@ -122,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
@@ -151,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
@@ -201,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#
@@ -247,18 +258,7 @@ function s:SetMarkdownSettings() "{{{2
setlocal autoindent setlocal autoindent
setlocal formatoptions=tcq "set VIms default setlocal formatoptions=tcq "set VIms default
function! <SID>ShowInBrowser() map <S-F5> :ShowInBrowser<CR>
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
" autocmd BufWritePost *.md :silent make " autocmd BufWritePost *.md :silent make
endfunction endfunction
@@ -307,20 +307,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() map <S-F5> :ShowInBrowser<CR>
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
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\+')
@@ -368,9 +355,6 @@ function s:SetGitcommitSettings() "{{{2
endfunction endfunction
"}}} "}}}
"remove all trailing whitespace for specified files before write
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces(0, 'n')
autocmd BufRead *.mako set filetype=mako autocmd BufRead *.mako set filetype=mako
autocmd BufRead *.ass, *asm set filetype=kickass autocmd BufRead *.ass, *asm set filetype=kickass
@@ -378,6 +362,7 @@ autocmd BufRead *.ass, *asm set filetype=kickass
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()
@@ -575,6 +560,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
@@ -767,16 +765,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: