From 9d33b45dbc8c062a8631f3d8d19d8d466764ad23 Mon Sep 17 00:00:00 2001 From: Alex Tavarez Date: Wed, 10 Jun 2026 14:04:12 -0400 Subject: [PATCH] added files or templates to be copied or used for configuration of vim/nvim editors on remote host --- .../files/user/config/nvim/init.vim | 5 + roles/init-server/templates/vimrc.j2 | 112 ++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 roles/init-server/files/user/config/nvim/init.vim create mode 100644 roles/init-server/templates/vimrc.j2 diff --git a/roles/init-server/files/user/config/nvim/init.vim b/roles/init-server/files/user/config/nvim/init.vim new file mode 100644 index 0000000..6ca6e24 --- /dev/null +++ b/roles/init-server/files/user/config/nvim/init.vim @@ -0,0 +1,5 @@ +set runtimepath^=~/.vim runtimepath+=~/.vim/after + +let &packpath = &runtimepath + +source ~/.vimrc \ No newline at end of file diff --git a/roles/init-server/templates/vimrc.j2 b/roles/init-server/templates/vimrc.j2 new file mode 100644 index 0000000..b9ff9c2 --- /dev/null +++ b/roles/init-server/templates/vimrc.j2 @@ -0,0 +1,112 @@ +" Disable compatibility with vi which can cause unexpected issues. +set nocompatible + +" Enable type file detection. Vim will be able to try to detect the type of file in use. +filetype on + +" Enable plugins and load plugin for the detected file type. +filetype plugin on + +" Load an indent file for the detected file type. +filetype indent on + +" Turn syntax highlighting on. +syntax on + +" Add numbers to each line on the left-hand side. +set number + +" Jump to line by relative number +set relativenumber +{% if (vim_blockedcursor | default(True)) %} + +" Highlight cursor line underneath the cursor horizontally. +set cursorline + +" Highlight cursor line underneath the cursor vertically. +set cursorcolumn +{% endif %} +{% if (vim_spatialize | default(True)) %} + +" Use space characters instead of tabs. +set expandtab + +" Set tab width to 4 columns. +set tabstop={{ vim_tabgap | default(2) }} +{% endif %} + +" While searching though a file incrementally highlight matching characters as you type. +set incsearch + +" Show the mode you are on the last line. +set showmode + +" Show matching words during a search. +set showmatch + +" Use highlighting when doing a search. +set hlsearch + +" Set the commands to save in history default number is 20. +set history={{ vim_historyspan | default(20) }} +{% if (vim_pathcompletion | default(True)) %} + +" Enable auto completion menu after pressing TAB. +set wildmenu + +" Make wildmenu behave like similar to Bash completion. +set wildmode=list:longest +{% if vimignore is defined or vimignore != None %} + +" There are certain files that we would never want to edit with Vim. +" Wildmenu will ignore files with these extensions. +set wildignore={{ vimignore | join(',') }} +{% endif %} +{% endif %} + +" PLUGINS ---------------------------------------------------------------- + +" Plugin code goes here. + +call plug#begin('~/.vim/plugged') + + Plug 'flazz/vim-colorschemes' +{% if (vim_eddelimiters | default(True)) %} + Plug 'tpope/vim-surround' +{% endif %} +{% if (vim_gitspice | default(True)) %} + Plug 'airblade/vim-gitgutter' + Plug 'tpope/vim-fugitive' +{% endif %} +{% if (vim_statusline | default(True)) %} + Plug 'vim-airline/vim-airline' +{% endif %} +{% if (vim_fancycomment | default(True)) %} + Plug 'scrooloose/nerdcommenter' +{% endif %} +{% if (vim_idelangs | default(True)) %} + Plug 'dense-analysis/ale' +{% endif %} + +call plug#end() + +" MAPPINGS --------------------------------------------------------------- + +" Mappings code goes here. + +" VIMSCRIPT -------------------------------------------------------------- +{% if (vim_origami | default(True)) %} + +" This will enable code folding. +" Use the marker method of folding. +augroup filetype_vim + autocmd! + autocmd FileType vim setlocal foldmethod=marker +augroup END +{% endif %} + +" More Vimscripts code goes here. + +" STATUS LINE ------------------------------------------------------------ + +" Status bar code goes here.