Initial Lab Setup
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
" Basic Quality of Life
|
||||
set nocompatible
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
set number
|
||||
set relativenumber " Great for jumping lines in code
|
||||
set mouse=a
|
||||
set clipboard=unnamedplus
|
||||
|
||||
" Ghostty / Modern Terminal Compatibility
|
||||
if exists('+termguicolors')
|
||||
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
" Search and UI
|
||||
set hlsearch
|
||||
set incsearch
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set wildmenu
|
||||
|
||||
" Tab Settings (Standardized for the Lab)
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
@@ -0,0 +1,14 @@
|
||||
- name: Install Vim
|
||||
ansible.builtin.apt:
|
||||
name: vim
|
||||
state: present
|
||||
|
||||
- name: Configure Vim for root
|
||||
include_tasks: setup_user.yml
|
||||
vars:
|
||||
v_user: root
|
||||
|
||||
- name: Configure Vim for volker
|
||||
include_tasks: setup_user.yml
|
||||
vars:
|
||||
v_user: volker
|
||||
@@ -0,0 +1,27 @@
|
||||
- name: Define home path
|
||||
set_fact:
|
||||
v_home: "{{ '/root' if v_user == 'root' else '/home/' + v_user }}"
|
||||
|
||||
- name: Create .vim directories
|
||||
file:
|
||||
path: "{{ v_home }}/.vim/autoload"
|
||||
state: directory
|
||||
owner: "{{ v_user }}"
|
||||
mode: '0755'
|
||||
|
||||
- name: Install vim-plug
|
||||
get_url:
|
||||
url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
dest: "{{ v_home }}/.vim/autoload/plug.vim"
|
||||
owner: "{{ v_user }}"
|
||||
|
||||
- name: Deploy .vimrc from template
|
||||
template:
|
||||
src: vimrc.j2
|
||||
dest: "{{ v_home }}/.vimrc"
|
||||
owner: "{{ v_user }}"
|
||||
|
||||
- name: Run PlugInstall
|
||||
become_user: "{{ v_user }}"
|
||||
command: vim +PlugInstall +qall
|
||||
changed_when: false
|
||||
@@ -0,0 +1,49 @@
|
||||
" --- Basic Quality of Life ---
|
||||
set nocompatible
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
set number
|
||||
set relativenumber
|
||||
set mouse=r
|
||||
set clipboard=unnamedplus
|
||||
|
||||
" --- Plugin Management (vim-plug) ---
|
||||
call plug#begin('~/.vim/plugged')
|
||||
Plug 'ojroques/vim-oscyank'
|
||||
call plug#end()
|
||||
|
||||
" --- Ghostty / Modern Terminal Compatibility ---
|
||||
if (has("termguicolors"))
|
||||
" Fix for some older vim versions in modern terms
|
||||
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
" --- Smart OSC52 Yanking (Works with Ghostty) ---
|
||||
" This allows copying to your Mac clipboard over SSH
|
||||
if has('autocmd')
|
||||
autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '' | execute 'OSCYankReg "' | endif
|
||||
endif
|
||||
|
||||
" --- UI and Search ---
|
||||
set hlsearch
|
||||
set incsearch
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set wildmenu
|
||||
|
||||
" --- Tab Settings (Standardized for the Lab) ---
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
|
||||
" --- User Specific Logic ---
|
||||
{% if v_user == 'root' %}
|
||||
" Visual warning that you are editing as ROOT
|
||||
hi StatusLine ctermbg=red ctermfg=white
|
||||
hi StatusLineNC ctermbg=red ctermfg=gray
|
||||
{% endif %}
|
||||
|
||||
" Add user identity to status line
|
||||
set statusline=%f\ %h%m%r%=USER:\ {{ v_user }}\ %p%%
|
||||
Reference in New Issue
Block a user