From 077979bbc8f2fc4c7b60190b0fb40f9fc9187974 Mon Sep 17 00:00:00 2001 From: Guillaume Dott Date: Mon, 8 Apr 2019 19:11:21 +0200 Subject: [PATCH] vim: convert config to xdg --- .gitignore | 1 + vim/vimrc | 41 ++++++++++++++++++++++------------------- zsh/.zshenv | 1 + 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 1377554..58a81a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.swp +vim/bundle diff --git a/vim/vimrc b/vim/vimrc index ad7813e..5a6b1e2 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,12 +1,29 @@ set nocompatible +" XDG +set undodir=$XDG_CACHE_HOME/vim/undo +set directory=$XDG_CACHE_HOME/vim/swap +set backupdir=$XDG_CACHE_HOME/vim/backup +set viminfo+='1000,n$XDG_CACHE_HOME/vim/viminfo +set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$XDG_CONFIG_HOME/vim/after + +let g:session_directory=$XDG_CACHE_HOME."/vim/sessions" + +for directory in [&undodir, &directory, &backupdir, g:session_directory] + if !filewritable(expand(directory)) + call mkdir(expand(directory), "p") + endif +endfor + " VUNDLE " { -if filereadable(expand("$HOME/.vim/bundle/vundle/README.md")) +let bundledir=$XDG_CONFIG_HOME."/vim/bundle/" + +if filereadable(expand(bundledir."vundle/README.md")) filetype off " required! - set rtp+=~/.vim/bundle/vundle/ - call vundle#rc() + let &rtp=&rtp.",".bundledir."vundle/" + call vundle#begin(bundledir) " let Vundle manage Vundle " required! @@ -38,6 +55,8 @@ if filereadable(expand("$HOME/.vim/bundle/vundle/README.md")) Plugin 'scrooloose/nerdcommenter' Plugin 'VisIncr' + + call vundle#end() endif " } @@ -102,19 +121,8 @@ set undolevels=150 set ttimeoutlen=100 set undofile - -if !filewritable(expand("~/.vim/tmp/undo")) - call mkdir(expand("~/.vim/tmp/undo"), "p") -endif -set undodir=~/.vim/tmp/undo - set backup -if !filewritable(expand("~/.vim/tmp/backup")) - call mkdir(expand("~/.vim/tmp/backup"), "p") -endif -set backupdir=~/.vim/tmp/backup - let mapleader = "," let g:bufferhint_MaxWidth = 200 @@ -170,11 +178,6 @@ let g:UltiSnipsJumpForwardTrigger="" let g:session_autoload = 'no' let g:session_autosave = 'no' -let g:session_directory=$HOME."/.vim/tmp/sessions" -if !filewritable(expand(g:session_directory)) - call mkdir(expand(g:session_directory), "p") -endif - autocmd FileType ruby let b:switch_custom_definitions = \ [ \ { diff --git a/zsh/.zshenv b/zsh/.zshenv index 76a46d5..810ef26 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -23,4 +23,5 @@ export KEYTIMEOUT=1 export EDITOR=vim export PAGER=less +export VIMINIT=":source $XDG_CONFIG_HOME/vim/vimrc" export ZDOTDIR=${XDG_CONFIG_HOME}/zsh