Add vim role

This commit is contained in:
Fernando Schauenburg 2019-11-15 19:08:53 +00:00
parent 5be5f80179
commit ff1562506d
5 changed files with 45 additions and 9 deletions

View file

@ -1,7 +1,10 @@
---
- name: Set up development machine
hosts: localhost
vars:
xdg_config_home: "~/.config"
xdg_cache_home: "~/.cache"
xdg_data_home: "~/.local/share"
roles:
- bash
#- dircolors
@ -12,4 +15,4 @@
#- readline
#- ssh
#- tmux
#- vim
- vim

View file

@ -0,0 +1,5 @@
---
xdg_config_home: "~/.config"
xdg_cache_home: "~/.cache"
xdg_data_home: "~/.local/share"

View file

@ -1,5 +1,8 @@
set nocompatible
if $XDG_CONFIG_HOME == "" | let $XDG_CONFIG_HOME="~/.config" | endif
if $XDG_CACHE_HOME == "" | let $XDG_CACHE_HOME="~/.cache" | endif
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
" Options {{{
@ -102,11 +105,13 @@ let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
let g:rainbow#pairs = [['(',')'], ['[',']'], ['{','}']]
if exists('airline#section#create')
if has('multi_byte') && &encoding ==# 'utf-8'
let g:airline_section_z = airline#section#create(['%4l/%L 𝚌%3v'])
else " line / total : col
let g:airline_section_z = airline#section#create(['L%4l/%L c%3v'])
endif
endif
if !exists('g:airline_symbols')
let g:airline_symbols = {}
@ -132,7 +137,7 @@ let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
highlight link srec32BitAddress Constant
highlight link srecChecksum Type
colorscheme solarized
silent! colorscheme solarized
filetype plugin indent on
syntax enable
" }}}
@ -232,7 +237,7 @@ augroup vimrc " {{{
autocmd FileType gitcommit setlocal textwidth=72
augroup END " }}}
if filereadable(expand("$XDG_CONFIG_HOME/vimrc.local"))
source $XDG_CONFIG_HOME/vimrc.local
if filereadable(expand("$XDG_CONFIG_HOME/vim/vimrc.local"))
source "$XDG_CONFIG_HOME/vim/vimrc.local"
endif

23
roles/vim/tasks/main.yml Normal file
View file

@ -0,0 +1,23 @@
---
- name: Create the vim cache and config directories
file:
path: "{{ item }}"
state: directory
loop:
- "{{ xdg_cache_home }}/vim"
- "{{ xdg_config_home }}/vim"
- "{{ xdg_config_home }}/vim/autoload"
- name: Deploy vim plug and vimrc
file:
src: "{{ role_path }}/files/{{ item }}"
dest: "{{ xdg_config_home }}/vim/{{ item }}"
state: link
force: yes
loop:
- autoload/plug.vim
- vimrc
- name: Install configured vim plugins
shell: vim -u "{{ xdg_config_home }}/vim/vimrc" +PlugInstall +qall