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 - name: Set up development machine
hosts: localhost hosts: localhost
vars:
xdg_config_home: "~/.config"
xdg_cache_home: "~/.cache"
xdg_data_home: "~/.local/share"
roles: roles:
- bash - bash
#- dircolors #- dircolors
@ -12,4 +15,4 @@
#- readline #- readline
#- ssh #- ssh
#- tmux #- 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 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" let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
" Options {{{ " Options {{{
@ -102,10 +105,12 @@ let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
let g:rainbow#pairs = [['(',')'], ['[',']'], ['{','}']] let g:rainbow#pairs = [['(',')'], ['[',']'], ['{','}']]
if has('multi_byte') && &encoding ==# 'utf-8' if exists('airline#section#create')
let g:airline_section_z = airline#section#create(['%4l/%L 𝚌%3v']) if has('multi_byte') && &encoding ==# 'utf-8'
else " line / total : col let g:airline_section_z = airline#section#create(['%4l/%L 𝚌%3v'])
let g:airline_section_z = airline#section#create(['L%4l/%L c%3v']) else " line / total : col
let g:airline_section_z = airline#section#create(['L%4l/%L c%3v'])
endif
endif endif
if !exists('g:airline_symbols') if !exists('g:airline_symbols')
@ -132,7 +137,7 @@ let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
highlight link srec32BitAddress Constant highlight link srec32BitAddress Constant
highlight link srecChecksum Type highlight link srecChecksum Type
colorscheme solarized silent! colorscheme solarized
filetype plugin indent on filetype plugin indent on
syntax enable syntax enable
" }}} " }}}
@ -232,7 +237,7 @@ augroup vimrc " {{{
autocmd FileType gitcommit setlocal textwidth=72 autocmd FileType gitcommit setlocal textwidth=72
augroup END " }}} augroup END " }}}
if filereadable(expand("$XDG_CONFIG_HOME/vimrc.local")) if filereadable(expand("$XDG_CONFIG_HOME/vim/vimrc.local"))
source $XDG_CONFIG_HOME/vimrc.local source "$XDG_CONFIG_HOME/vim/vimrc.local"
endif 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