From bcc5d11f253403471b6dd5eaeaabf27e84acfc00 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 25 Sep 2021 16:06:06 +0200 Subject: [PATCH] updated vim state --- states/vim/defaults.yaml | 9 +++++++-- states/vim/vimrc.j2 | 26 ++++++++++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/states/vim/defaults.yaml b/states/vim/defaults.yaml index e541f5e..9681b5e 100644 --- a/states/vim/defaults.yaml +++ b/states/vim/defaults.yaml @@ -10,6 +10,9 @@ vim: defaults_vim: name: "g:skip_defaults_vim" value: 1 + rustfmt_autosave: + name: g:rustfmt_autosave + value: 1 sets: fileencoding: name: fileencoding @@ -20,6 +23,10 @@ vim: encoding: name: encoding value: utf-8 + eol: + name: eol + nofixeol: + name: nofixeol nocompatible: name: nocompatible mouse: @@ -36,8 +43,6 @@ vim: value: indent,eol,start autoindent: name: autoindent - nofixeol: - name: nofixeol nocindent: name: nocindent ic: diff --git a/states/vim/vimrc.j2 b/states/vim/vimrc.j2 index 50afed9..df5372d 100644 --- a/states/vim/vimrc.j2 +++ b/states/vim/vimrc.j2 @@ -1,16 +1,24 @@ "{{ salt['pillar.get']('salt_managed', default='Salt Managed') }} {%- from "vim/map.jinja" import vim with context %} + +" VIM global configs colorscheme {{ vim.config.use_theme }} filetype plugin on {%- if vim.config.use_syntax %} syntax on {%- endif %} -{% for key, value in vim.config.lets.items() %} -let {{ value.name }}{% if value.value is defined %}={{ value.value }}{% endif %} -{%- endfor %} -{% for key, value in vim.config.sets.items() %} -set {{ value.name }}{% if value.value is defined %}={{ value.value }}{% endif %} + +{% macro cfg(command, setting) -%} +{% for key, value in setting.items() %} +{{ command }} {{ value.name }}{% if value.value is defined %}={{ value.value }}{% endif %} {%- endfor %} +{% endmacro -%} + +" VIM lets +{{- cfg("let", vim.config.lets) }} + +" VIM sets +{{- cfg("set", vim.config.sets) }} nnoremap :!%:p @@ -26,9 +34,15 @@ if has("autocmd") endif " NERDTree +set wildignore+=*.pyc,*.o,*.obj,*.svn,*.swp,*.class,*.hg,*.DS_Store,*.min.* let g:NERDTreeShowHidden = 1 let g:NERDTreeMinimalUI = 1 let g:NERDTreeIgnore = [] let g:NERDTreeStatusline = '' +let g:NERDTreeRespectWildIgnore=1 autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif -nnoremap :NERDTreeToggle \ No newline at end of file +nnoremap :NERDTreeToggle + +" Support for end-of-lines +" au BufWritePre * :set binary | set noeol +" au BufWritePost * :set nobinary | set eol \ No newline at end of file