mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 11:30:29 +01:00
Adapt repo to support XDG configuration placemet
This commit is contained in:
16
README.rst
16
README.rst
@@ -7,9 +7,23 @@ 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.
|
||||||
|
|
||||||
|
It should be cloned as is into `$HOME`` directory, i.e:
|
||||||
|
|
||||||
|
.. code:: console
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
Other than that, there are two additional config files which can be added to
|
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
|
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.
|
config file. Both of them should be placed under ``$HOME/.vim`` or
|
||||||
|
``$XDG_COFIG_HOME/vim`` depending on your installation.
|
||||||
|
|
||||||
First one is ``vimrc.local``, which might contain additional/override options
|
First one is ``vimrc.local``, which might contain additional/override options
|
||||||
for specific machine.
|
for specific machine.
|
||||||
|
|||||||
28
vimrc
28
vimrc
@@ -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'
|
||||||
@@ -122,7 +132,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
|
||||||
@@ -767,12 +777,8 @@ 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 {{{
|
" Custom: custom config per machine {{{
|
||||||
if filereadable($MYVIMRC . '.local')
|
if filereadable($MYVIMRC . '.local')
|
||||||
|
|||||||
Reference in New Issue
Block a user