1
0
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:
2024-07-13 16:43:59 +02:00
parent 2cc95674c2
commit 8497d7595a
2 changed files with 32 additions and 12 deletions

View File

@@ -7,9 +7,23 @@ of it.
It uses `vim-plug`_ plugin manager, so after cloning, just open vim, and it
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
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
for specific machine.

28
vimrc
View File

@@ -1,15 +1,25 @@
"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', { 'for': ['html', 'xml'] }
Plug 'ayuanx/vim-mark-standalone'
@@ -122,7 +132,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
@@ -767,12 +777,8 @@ 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')