initial checkin

This commit is contained in:
Radar231 2021-07-22 23:14:58 -04:00
commit 18dcc5f9e1
4 changed files with 183 additions and 0 deletions

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# Ansible Role: vim_setup
## Introduction
This role will set up our default vim environment for the specified user.
NOTE:
The following variable(s) must be specified in the playbook.
* {{ username }}
* {{ homedir }}

42
files/vimrc.centos Normal file
View File

@ -0,0 +1,42 @@
" .vimrc for a centos based host
" #########################################################################
" use vim settings, rather than vi settings
" must be at start of vimrc as it changes other options as a side effect
set nocompatible
" make backspace behave in a sane manner
set backspace=indent,eol,start
" switch syntax highlighting on
syntax on
set smartindent
set autoindent
set softtabstop=4
set tabstop=4
set shiftwidth=4
set expandtab
set number
set relativenumber
set showmatch
set nowrap
set smartcase
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch
" turn on full python highlighting
let python_highlight_all = 1
" set 256 colors and use specific color scheme
set t_Co=256
color zellner
set background=dark

42
files/vimrc.ubuntu Normal file
View File

@ -0,0 +1,42 @@
" .vimrc for an Ubuntu based host
" #########################################################################
" use vim settings, rather than vi settings
" must be at start of vimrc as it changes other options as a side effect
set nocompatible
" make backspace behave in a sane manner
set backspace=indent,eol,start
" switch syntax highlighting on
syntax on
set smartindent
set autoindent
set softtabstop=4
set tabstop=4
set shiftwidth=4
set expandtab
set number
set relativenumber
set showmatch
set nowrap
set smartcase
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch
" turn on full python highlighting
let python_highlight_all = 1
" set 256 colors and use specific color scheme
set t_Co=256
color calmar256-dark
set background=dark

86
tasks/main.yml Normal file
View File

@ -0,0 +1,86 @@
---
###########################################################################
#
# This role will set up our default vim environment for the specified user.
#
###########################################################################
#
# NOTE:
# the following variable(s) must be specified in the playbook
# {{ username }}
# {{ homedir }}
#
###########################################################################
# tasks file for vim_setup
- debug: msg="Installing custom vim setup"
############################################################
- name: Create .vim directory
file:
path: "{{ homedir }}/.vim"
state: directory
owner: "{{ username }}"
group: "{{ username }}"
mode: "0755"
############################################################
- name: Create .vim/undodir directory
file:
path: "{{ homedir }}/.vim/undodir"
state: directory
owner: "{{ username }}"
group: "{{ username }}"
mode: "0755"
############################################################
- name: Make sure vim-scripts package is installed (Ubuntu)
apt:
name: vim-scripts
state: latest
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS"
############################################################
- name: Make sure vim-enhanced package is install (Centos)
yum:
name: vim-enhanced
state: latest
when: ansible_distribution == "CentOS"
############################################################
- name: Create colors symlink (Ubuntu)
file:
path: "{{ homedir }}/.vim/colors"
src: "/usr/share/vim-scripts/colors"
state: link
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS"
############################################################
- name: Create colors symlink (CentOS)
file:
path: "{{ homedir }}/.vim/colors"
src: "/usr/share/vim/vim74/colors"
state: link
when: ansible_distribution == "CentOS"
############################################################
- name: Copy in default vimrc (Ubuntu)
copy:
src: "files/vimrc.ubuntu"
dest: "{{ homedir }}/.vimrc"
owner: "{{ username }}"
group: "{{ username }}"
mode: "0644"
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS"
############################################################
- name: Copy in default vimrc (CentOS)
copy:
src: "files/vimrc.centos"
dest: "{{ homedir }}/.vimrc"
owner: "{{ username }}"
group: "{{ username }}"
mode: "0644"
when: ansible_distribution == "CentOS"
# EOF