Add vim role
This commit is contained in:
parent
5be5f80179
commit
ff1562506d
5 changed files with 45 additions and 9 deletions
|
@ -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
|
||||
|
|
5
roles/vim/defaults/main.yml
Normal file
5
roles/vim/defaults/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
xdg_config_home: "~/.config"
|
||||
xdg_cache_home: "~/.cache"
|
||||
xdg_data_home: "~/.local/share"
|
||||
|
|
@ -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,10 +105,12 @@ let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
|
|||
|
||||
let g:rainbow#pairs = [['(',')'], ['[',']'], ['{','}']]
|
||||
|
||||
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'])
|
||||
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')
|
||||
|
@ -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
23
roles/vim/tasks/main.yml
Normal 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
|
||||
|
Loading…
Add table
Reference in a new issue