Refactored for global vim configuration and support for multiple distros currently in use.
This commit is contained in:
commit
1e7e35b3b0
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
archive
|
||||
authorized_keys
|
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Ansible Role: dotfiles
|
||||
|
||||
This role sets up my dotfiles.
|
||||
|
||||
Tested on:
|
||||
|
||||
* Archlinux
|
||||
* Debian 10, 11, 12
|
||||
* Ubuntu 20.04, 22.04
|
||||
* !RedHat 7.9
|
||||
|
||||
## Requirements
|
||||
|
||||
None.
|
||||
|
||||
## Example Playbook
|
||||
|
||||
```yaml
|
||||
- hosts: all
|
||||
become: true
|
||||
roles:
|
||||
- bleetube.dotfiles
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
* [GNU Readline Init File Syntax](http://www.gnu.org/software/bash/manual/html_node/Readline-Init-File-Syntax.html)
|
2
defaults/main.yml
Normal file
2
defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
sysadmin_username: blee
|
2
files/bash_aliases
Normal file
2
files/bash_aliases
Normal file
@ -0,0 +1,2 @@
|
||||
alias ll='ls -AlF --group-directories-first'
|
||||
alias l='ls -lF --group-directories-first'
|
2
files/inputrc
Normal file
2
files/inputrc
Normal file
@ -0,0 +1,2 @@
|
||||
set completion-ignore-case On
|
||||
set mark-directories On
|
218
files/ir_black.vim
Normal file
218
files/ir_black.vim
Normal file
@ -0,0 +1,218 @@
|
||||
" ir_black color scheme
|
||||
" More at: http://blog.infinitered.com
|
||||
|
||||
|
||||
" ********************************************************************************
|
||||
" Standard colors used in all ir_black themes:
|
||||
" Note, x:x:x are RGB values
|
||||
"
|
||||
" normal: #f6f3e8
|
||||
"
|
||||
" string: #A8FF60 168:255:96
|
||||
" string inner (punc, code, etc): #00A0A0 0:160:160
|
||||
" number: #FF73FD 255:115:253
|
||||
" comments: #7C7C7C 124:124:124
|
||||
" keywords: #96CBFE 150:203:254
|
||||
" operators: white
|
||||
" class: #FFFFB6 255:255:182
|
||||
" method declaration name: #FFD2A7 255:210:167
|
||||
" regular expression: #E9C062 233:192:98
|
||||
" regexp alternate: #FF8000 255:128:0
|
||||
" regexp alternate 2: #B18A3D 177:138:61
|
||||
" variable: #C6C5FE 198:197:254
|
||||
"
|
||||
" Misc colors:
|
||||
" red color (used for whatever): #FF6C60 255:108:96
|
||||
" light red: #FFB6B0 255:182:176
|
||||
"
|
||||
" brown: #E18964 good for special
|
||||
"
|
||||
" lightpurpleish: #FFCCFF
|
||||
"
|
||||
" Interface colors:
|
||||
" background color: black
|
||||
" cursor (where underscore is used): #FFA560 255:165:96
|
||||
" cursor (where block is used): white
|
||||
" visual selection: #1D1E2C
|
||||
" current line: #151515 21:21:21
|
||||
" search selection: #07281C 7:40:28
|
||||
" line number: #3D3D3D 61:61:61
|
||||
|
||||
|
||||
" ********************************************************************************
|
||||
" The following are the preferred 16 colors for your terminal
|
||||
" Colors Bright Colors
|
||||
" Black #4E4E4E #7C7C7C
|
||||
" Red #FF6C60 #FFB6B0
|
||||
" Green #A8FF60 #CEFFAB
|
||||
" Yellow #FFFFB6 #FFFFCB
|
||||
" Blue #96CBFE #B5DCFE
|
||||
" Magenta #FF73FD #FF9CFE
|
||||
" Cyan #C6C5FE #DFDFFE
|
||||
" White #EEEEEE #FFFFFF
|
||||
|
||||
|
||||
" ********************************************************************************
|
||||
set background=dark
|
||||
hi clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let colors_name = "ir_black"
|
||||
|
||||
|
||||
"hi Example guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
|
||||
" General colors
|
||||
hi Normal guifg=#f6f3e8 guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
hi NonText guifg=#070707 guibg=black gui=NONE ctermfg=black ctermbg=NONE cterm=NONE
|
||||
|
||||
hi Cursor guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=reverse
|
||||
hi LineNr guifg=#3D3D3D guibg=black gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
|
||||
|
||||
hi VertSplit guifg=#202020 guibg=#202020 gui=NONE ctermfg=darkgray ctermbg=darkgray cterm=NONE
|
||||
hi StatusLine guifg=#CCCCCC guibg=#202020 gui=italic ctermfg=white ctermbg=darkgray cterm=NONE
|
||||
hi StatusLineNC guifg=black guibg=#202020 gui=NONE ctermfg=blue ctermbg=darkgray cterm=NONE
|
||||
|
||||
hi Folded guifg=#a0a8b0 guibg=#384048 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
hi Title guifg=#f6f3e8 guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
hi Visual guifg=NONE guibg=#262D51 gui=NONE ctermfg=NONE ctermbg=NONE cterm=REVERSE
|
||||
|
||||
hi SpecialKey guifg=#808080 guibg=#343434 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
|
||||
hi WildMenu guifg=green guibg=yellow gui=NONE ctermfg=black ctermbg=yellow cterm=NONE
|
||||
hi PmenuSbar guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=NONE
|
||||
"hi Ignore guifg=gray guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
|
||||
hi Error guifg=NONE guibg=NONE gui=undercurl ctermfg=white ctermbg=red cterm=NONE guisp=#FF6C60 " undercurl color
|
||||
hi ErrorMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=white ctermbg=red cterm=NONE
|
||||
hi WarningMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=white ctermbg=red cterm=NONE
|
||||
hi LongLineWarning guifg=NONE guibg=#371F1C gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
|
||||
|
||||
" Message displayed in lower left, such as --INSERT--
|
||||
hi ModeMsg guifg=black guibg=#C6C5FE gui=BOLD ctermfg=black ctermbg=cyan cterm=BOLD
|
||||
|
||||
if version >= 700 " Vim 7.x specific colors
|
||||
hi CursorLine guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD
|
||||
hi CursorColumn guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD
|
||||
hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=BOLD ctermfg=white ctermbg=darkgray cterm=NONE
|
||||
hi Pmenu guifg=#f6f3e8 guibg=#444444 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
hi PmenuSel guifg=#000000 guibg=#cae682 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
|
||||
hi Search guifg=NONE guibg=#2F2F00 gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
|
||||
endif
|
||||
|
||||
" Syntax highlighting
|
||||
hi Comment guifg=#7C7C7C guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
|
||||
hi String guifg=#A8FF60 guibg=NONE gui=NONE ctermfg=green ctermbg=NONE cterm=NONE
|
||||
hi Number guifg=#FF73FD guibg=NONE gui=NONE ctermfg=magenta ctermbg=NONE cterm=NONE
|
||||
|
||||
hi Keyword guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
|
||||
hi PreProc guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
|
||||
hi Conditional guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE " if else end
|
||||
|
||||
hi Todo guifg=#8f8f8f guibg=NONE gui=NONE ctermfg=red ctermbg=NONE cterm=NONE
|
||||
hi Constant guifg=#99CC99 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
|
||||
|
||||
hi Identifier guifg=#C6C5FE guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
|
||||
hi Function guifg=#FFD2A7 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
|
||||
hi Type guifg=#FFFFB6 guibg=NONE gui=NONE ctermfg=yellow ctermbg=NONE cterm=NONE
|
||||
hi Statement guifg=#6699CC guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE
|
||||
|
||||
hi Special guifg=#E18964 guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
|
||||
hi Delimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
|
||||
hi Operator guifg=white guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
|
||||
|
||||
hi link Character Constant
|
||||
hi link Boolean Constant
|
||||
hi link Float Number
|
||||
hi link Repeat Statement
|
||||
hi link Label Statement
|
||||
hi link Exception Statement
|
||||
hi link Include PreProc
|
||||
hi link Define PreProc
|
||||
hi link Macro PreProc
|
||||
hi link PreCondit PreProc
|
||||
hi link StorageClass Type
|
||||
hi link Structure Type
|
||||
hi link Typedef Type
|
||||
hi link Tag Special
|
||||
hi link SpecialChar Special
|
||||
hi link SpecialComment Special
|
||||
hi link Debug Special
|
||||
|
||||
|
||||
" Special for Ruby
|
||||
hi rubyRegexp guifg=#B18A3D guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
|
||||
hi rubyRegexpDelimiter guifg=#FF8000 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
|
||||
hi rubyEscape guifg=white guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
|
||||
hi rubyInterpolationDelimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
|
||||
hi rubyControl guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE "and break, etc
|
||||
"hi rubyGlobalVariable guifg=#FFCCFF guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE "yield
|
||||
hi rubyStringDelimiter guifg=#336633 guibg=NONE gui=NONE ctermfg=lightgreen ctermbg=NONE cterm=NONE
|
||||
"rubyInclude
|
||||
"rubySharpBang
|
||||
"rubyAccess
|
||||
"rubyPredefinedVariable
|
||||
"rubyBoolean
|
||||
"rubyClassVariable
|
||||
"rubyBeginEnd
|
||||
"rubyRepeatModifier
|
||||
"hi link rubyArrayDelimiter Special " [ , , ]
|
||||
"rubyCurlyBlock { , , }
|
||||
|
||||
hi link rubyClass Keyword
|
||||
hi link rubyModule Keyword
|
||||
hi link rubyKeyword Keyword
|
||||
hi link rubyOperator Operator
|
||||
hi link rubyIdentifier Identifier
|
||||
hi link rubyInstanceVariable Identifier
|
||||
hi link rubyGlobalVariable Identifier
|
||||
hi link rubyClassVariable Identifier
|
||||
hi link rubyConstant Type
|
||||
|
||||
|
||||
" Special for Java
|
||||
" hi link javaClassDecl Type
|
||||
hi link javaScopeDecl Identifier
|
||||
hi link javaCommentTitle javaDocSeeTag
|
||||
hi link javaDocTags javaDocSeeTag
|
||||
hi link javaDocParam javaDocSeeTag
|
||||
hi link javaDocSeeTagParam javaDocSeeTag
|
||||
|
||||
hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
|
||||
hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
|
||||
"hi javaClassDecl guifg=#CCFFCC guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
|
||||
|
||||
|
||||
" Special for XML
|
||||
hi link xmlTag Keyword
|
||||
hi link xmlTagName Conditional
|
||||
hi link xmlEndTag Identifier
|
||||
|
||||
|
||||
" Special for HTML
|
||||
hi link htmlTag Keyword
|
||||
hi link htmlTagName Conditional
|
||||
hi link htmlEndTag Identifier
|
||||
|
||||
|
||||
" Special for Javascript
|
||||
hi link javaScriptNumber Number
|
||||
|
||||
|
||||
" Special for Python
|
||||
"hi link pythonEscape Keyword
|
||||
|
||||
|
||||
" Special for CSharp
|
||||
hi link csXmlTag Keyword
|
||||
|
||||
|
||||
" Special for PHP
|
||||
|
||||
" Line length highlighting
|
||||
hi ColorColumn ctermbg=Black
|
||||
hi TabLine term=NONE cterm=NONE ctermfg=12 ctermbg=0
|
||||
hi TabLineFill term=NONE cterm=NONE gui=NONE
|
2
files/vim.sh
Normal file
2
files/vim.sh
Normal file
@ -0,0 +1,2 @@
|
||||
export VISUAL=vim.basic
|
||||
export EDITOR=vim.basic
|
40
files/vimrc.local
Normal file
40
files/vimrc.local
Normal file
@ -0,0 +1,40 @@
|
||||
" -- General Settings
|
||||
set mouse-=a " No mouse, see https://github.com/vim/vim/issues/12621
|
||||
set encoding=utf-8 " Necessary to show Unicode glyphs
|
||||
set scrolloff=4 " keep at least 4 lines above/below cursor visible
|
||||
set linebreak " last word line wrapping, instead of last character
|
||||
set ttyfast " fast terminal
|
||||
set incsearch " search as we type
|
||||
set smartcase " case (in)sensitive searching
|
||||
set nobackup " declutter backups (handled elsewhere)
|
||||
set noswapfile " declutter temp files (live fast, die hard)
|
||||
set number
|
||||
|
||||
" -- Syntax Highlighting
|
||||
"set background=dark " tell vim the background is dark
|
||||
colorscheme ir_black " via http://toddwerth.com/2008/04/30/the-last-vim-color-scheme-youll-ever-need/
|
||||
syntax on " enable syntax highlighting
|
||||
set hlsearch " highlight/underline search results
|
||||
"au BufRead,BufNewFile *.md setfiletype markdown
|
||||
"au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* setfiletype nginx
|
||||
|
||||
" -- Tabs
|
||||
" :h tabstop
|
||||
" http://tedlogan.com/techblog3.html
|
||||
set tabstop=4 " existing tab column length
|
||||
set softtabstop=4 " spaces per <TAB> and <BS>
|
||||
set shiftwidth=4 " spaces per indent
|
||||
set expandtab " whether to prefer spaces
|
||||
set cindent " auto-indenting for code blocks
|
||||
|
||||
" -- Keys
|
||||
" insert mode with semi-colon, because save the pinkies
|
||||
noremap ; :
|
||||
noremap , ;
|
||||
" center search results on the screen
|
||||
map N Nzz
|
||||
map n nzz
|
||||
|
||||
" Make tabs, trailing whitespace, and non-breaking spaces visible for list
|
||||
exec "set listchars=tab:\uBB\uBB,trail:\uB7,nbsp:~"
|
||||
|
3
handlers/main.yml
Normal file
3
handlers/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: restart ssh
|
||||
service: name=sshd state=restarted
|
2
meta/main.yml
Normal file
2
meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
dependencies: []
|
52
tasks/main.yml
Normal file
52
tasks/main.yml
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
- import_tasks: vim-Debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- import_tasks: vim.yml
|
||||
when: ansible_os_family != 'Debian'
|
||||
|
||||
- name: Copy bash aliases
|
||||
ansible.builtin.copy:
|
||||
src: bash_aliases
|
||||
dest: "{{ item }}/.bash_aliases"
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
|
||||
- name: Copy shell configuration
|
||||
ansible.builtin.copy:
|
||||
src: inputrc
|
||||
dest: "{{ item }}/.inputrc"
|
||||
loop:
|
||||
- /etc/skel
|
||||
- /root
|
||||
|
||||
- name: Add root bashrc and vim configuration.
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: "{{ item.regexp }}"
|
||||
line: "{{ item.line }}"
|
||||
state: present
|
||||
with_items:
|
||||
- regexp: '^(export )?EDITOR='
|
||||
line: 'export EDITOR=vim.basic'
|
||||
- regexp: '^(export )?VISUAL='
|
||||
line: 'export VISUAL=vim.basic'
|
||||
- regexp: '^(export )?HISTCONTROL='
|
||||
line: 'HISTCONTROL=ignoreboth'
|
||||
when: ansible_os_family != 'RedHat'
|
||||
|
||||
- name: Add root bashrc and vim configuration for RedHat 7.9.
|
||||
lineinfile:
|
||||
path: /root/.bashrc
|
||||
regexp: "{{ item.regexp }}"
|
||||
line: "{{ item.line }}"
|
||||
state: present
|
||||
with_items:
|
||||
- regexp: '^(export )?EDITOR='
|
||||
line: 'export EDITOR=vim'
|
||||
- regexp: '^(export )?VISUAL='
|
||||
line: 'export VISUAL=vim'
|
||||
- regexp: '^(export )?HISTCONTROL='
|
||||
line: 'HISTCONTROL=ignoreboth'
|
||||
when: ansible_os_family == 'RedHat'
|
15
tasks/vim-Debian.yml
Normal file
15
tasks/vim-Debian.yml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
- name: Ensure addon path for colors exists.
|
||||
ansible.builtin.file:
|
||||
path: /var/lib/vim/addons/colors
|
||||
state: directory
|
||||
|
||||
- name: Copy vim colorscheme to the addon path.
|
||||
ansible.builtin.copy:
|
||||
src: ir_black.vim
|
||||
dest: /var/lib/vim/addons/colors/
|
||||
|
||||
- name: Apply global vim configuration
|
||||
ansible.builtin.copy:
|
||||
src: vimrc.local
|
||||
dest: /etc/vim/
|
25
tasks/vim.yml
Normal file
25
tasks/vim.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: Ensure a path for vim addons exists.
|
||||
ansible.builtin.file:
|
||||
path: /var/lib/vim/addons/colors
|
||||
state: directory
|
||||
|
||||
- name: Copy the vim colorscheme
|
||||
ansible.builtin.copy:
|
||||
src: ir_black.vim
|
||||
dest: /var/lib/vim/addons/colors/
|
||||
|
||||
- name: Copy the global vim configuration
|
||||
ansible.builtin.copy:
|
||||
src: vimrc.local
|
||||
dest: /etc/
|
||||
|
||||
- name: Ensure vim will source a global configuration file
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/vimrc
|
||||
marker: '" {mark} ANSIBLE MANAGED BLOCK'
|
||||
block: |
|
||||
set runtimepath+=/var/lib/vim/addons
|
||||
if filereadable("/etc/vimrc.local")
|
||||
source /etc/vimrc.local
|
||||
endif
|
Loading…
Reference in New Issue
Block a user