paulbsd-salt/states/neovim/templates/init.vim.j2

69 lines
1.8 KiB
Plaintext
Raw Normal View History

2022-05-14 11:23:16 +02:00
"{{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "neovim/map.jinja" import neovim with context %}
" NeoVIM global configs
colorscheme {{ neovim.config.use_theme }}
filetype plugin on
{%- if neovim.config.use_syntax %}
syntax on
{%- endif %}
{% macro cfg(command, setting) -%}
{% for key, value in setting.items() %}
{{ command }} {{ value.name }}{% if value.value is defined %}={{ value.value }}{% endif %}
{%- endfor %}
{% endmacro -%}
" NeoVIM lets
{{- cfg("let", neovim.config.lets) }}
" NeoVIM sets
{{- cfg("set", neovim.config.sets) }}
2022-07-16 00:48:49 +02:00
function! RemoveComments()
"silent %s/\t/ /g
2024-01-13 13:27:10 +01:00
"silent %s/ *#.*//g
2022-07-16 00:48:49 +02:00
silent g/^#/d
silent g/^$/d
2024-01-13 13:27:10 +01:00
"silent sort
2022-07-16 00:48:49 +02:00
endfunction
2024-01-27 10:41:39 +01:00
function! Reformat()
:normal gg=G
endfunction
command! Reformat call Reformat()
2024-01-13 13:27:10 +01:00
command! RemoveComments call RemoveComments()
2022-05-14 11:23:16 +02:00
nnoremap <F9> :!%:p
if has("autocmd")
au VimEnter,InsertLeave * silent execute '!echo -ne "\e[2 q"' | redraw!
au InsertEnter,InsertChange *
2023-03-11 10:08:26 +01:00
\ if v:insertmode == 'i' |
2022-05-14 11:23:16 +02:00
\ silent execute '!echo -ne "\e[6 q"' | redraw! |
\ elseif v:insertmode == 'r' |
\ silent execute '!echo -ne "\e[4 q"' | redraw! |
\ endif
au VimLeave * silent execute '!echo -ne "\e[ q"' | redraw!
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 <silent> <C-b> :NERDTreeToggle<CR>
" Support for end-of-lines
" au BufWritePre * :set binary | set noeol
" au BufWritePost * :set nobinary | set eol
vnoremap <C-a> g<C-a>
vnoremap <C-x> g<C-x>
vnoremap g<C-a> <C-a>
2023-03-11 10:08:26 +01:00
vnoremap g<C-x> <C-x>