Initial
This commit is contained in:
45
README.md
Normal file
45
README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Personal Ansible Desktop Configs
|
||||
|
||||
I use Ansible to configure all of my desktops, laptops, and servers. I use the Ansible Pull method, which I describe in both my Ansible Pull tutorial (already uploaded) and my Ansible desktop tutorial (will be published by December 11th 2020). It's fully automated, and scripts everything from system services to GNOME desktop settings.
|
||||
|
||||
## Disclaimer
|
||||
This repository contains a copy of the Ansible configuration that I use for laptops, desktops as well as servers.
|
||||
Please don't directly use this against your own machines, as it is something I developed for myself and may not translate to your use-case. It even configures OpenSSH, so if you run it you may get locked out. I've provided this as a HUGE example you can use to build your own, and compare syntax.
|
||||
|
||||
## How does it work?
|
||||
As mentioned above, it uses Ansible pull, so some familiarity with that is required. Luckily for you, I have a few videos on my channel that describes how Ansible pull works. Check out the LearnLinuxTV channel, the videos can be found in the Ansible playlist. I use Ansible in "pull-mode" because it handles the dynamic nature of laptops and desktops better. Afterall, they aren't always turned on. And I don't like to maintain multiple things for one purpose, so I have the same repo configuring servers as well.
|
||||
|
||||
The folder structure breaks down like this:
|
||||
|
||||
**local.yml**: This is the Playbook that Ansible expects to find by default in pull-mode, think of it as an "index" of sorts that pulls other Playbooks in.
|
||||
|
||||
|
||||
**ansible.cfg**: Configuration settings for Ansible goes here.
|
||||
|
||||
|
||||
**group_vars/**: This directory is where I can place variables that will be applied on every system.
|
||||
|
||||
|
||||
**host_vars/**: Each laptop/desktop/server gets a host_vars file in this folder, named after its hostname. Sets variables specific to that computer.
|
||||
|
||||
|
||||
**hosts**: This is the inventory file. Even in pull-mode, an inventory file can be used. This is how Ansible knows what group to put a machine in.
|
||||
|
||||
|
||||
**playbooks**: Additional playbooks that I may want to run, or have triggered.
|
||||
|
||||
|
||||
**roles/**: This directory contains my base, workstation, and server roles. Every host gets the base role. Then either 'workstation' or 'server', depending on what it is.
|
||||
|
||||
**roles/base**: This role is for every host, regardles of the type of device it is. This role contains things that are intended to be on every host, such as default configs, users, etc.
|
||||
|
||||
**roles/workstation**: After the base role runs on a host, this role runs only on hosts that are designated to be workstations. GUI-specific things, such as GUI apps (Firefox, etc), Flatpaks, wallpaper, etc. Has a folder for the GNOME and MATE desktops.
|
||||
|
||||
**roles/server**: After the base role runs on a host, this role runs only on hosts designated as servers. Monitoring plugins, unattended-updates, server firewall rules, and other server-related things are configured here.
|
||||
|
||||
After it's run for the first time manually, this Ansible config creates its own Cronjob for itself on that machine so you never have to run it manually again going forward, and it will track all future commits and run them against all your machines as soon as you commit a change. You can find the playbook for Cron in the base role.
|
||||
|
||||
## How do I run it?
|
||||
You don't, you use this to build your own. Go through my Ansible desktop tutorial that launches on December 11th to build your "skeleton", then use this repo for syntax reference. If you insist on running this, you run it with the following command after installing Ansible:
|
||||
|
||||
ansible-pull -U https://github.com/LearnLinuxTV/personal_ansible_desktop_configs.git
|
||||
4
ansible.cfg
Normal file
4
ansible.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[defaults]
|
||||
inventory = hosts
|
||||
log_path = /var/log/ansible.log
|
||||
retry_files_enabled = False
|
||||
3
group_vars/all
Normal file
3
group_vars/all
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
telegram_chat_id: ""
|
||||
telegram_token: ""
|
||||
53
host_vars/bzoicas-linux
Normal file
53
host_vars/bzoicas-linux
Normal file
@@ -0,0 +1,53 @@
|
||||
---
|
||||
branch: master
|
||||
|
||||
ansible_cron_minute: "*/5"
|
||||
ssh_port: 22
|
||||
ssh_users: "bzoicas"
|
||||
|
||||
# platform-specific
|
||||
ansible_python_interpreter: /usr/bin/python3
|
||||
microcode_amd_install: false
|
||||
microcode_intel_install: false
|
||||
|
||||
# app defaults
|
||||
gui_editor: gvim
|
||||
terminal_emulator: terminator
|
||||
web_browser: flatpak run org.mozilla.firefox
|
||||
|
||||
# application selection
|
||||
audacity: true
|
||||
authy: true
|
||||
autofs: false
|
||||
chromium: false
|
||||
chrome: false
|
||||
brave: true
|
||||
darktable: true
|
||||
firefox: true
|
||||
foliate: false
|
||||
games: false
|
||||
glimpse: true
|
||||
keepassxc: true
|
||||
libreoffice: true
|
||||
lutris: true
|
||||
mattermost: true
|
||||
nextcloud: true
|
||||
packer: true
|
||||
signal: true
|
||||
spotify: true
|
||||
steam: false
|
||||
syncthing: false
|
||||
terraform: false
|
||||
thunderbird: false
|
||||
todoist: false
|
||||
ulauncher: false
|
||||
vagrant: false
|
||||
virtualbox: false
|
||||
vivaldi: false
|
||||
vlc: true
|
||||
vscodium: true
|
||||
|
||||
# desktop environment selection
|
||||
gnome: false
|
||||
mate: false
|
||||
xfce: true
|
||||
66
local.yml
Normal file
66
local.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
# tasks to complete before running roles
|
||||
- hosts: all
|
||||
tags: always
|
||||
become: true
|
||||
pre_tasks:
|
||||
- name: pre-run | update package cache (arch)
|
||||
tags: always
|
||||
pacman: update_cache=yes
|
||||
changed_when: False
|
||||
when: ansible_distribution == "Archlinux"
|
||||
|
||||
- name: pre-run | update package cache (debian, etc)
|
||||
tags: always
|
||||
apt: update_cache=yes
|
||||
changed_when: False
|
||||
when: ansible_distribution in ["Debian", "Ubuntu"]
|
||||
|
||||
# run roles
|
||||
- hosts: all
|
||||
tags: base
|
||||
become: true
|
||||
roles:
|
||||
- base
|
||||
|
||||
- hosts: workstation
|
||||
tags: workstation
|
||||
become: true
|
||||
roles:
|
||||
- workstation
|
||||
|
||||
# - hosts: server
|
||||
# tags: server
|
||||
# become: true
|
||||
# roles:
|
||||
# - server
|
||||
|
||||
# end of run cleanup and reporting
|
||||
- hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: cleanup package cache (debian and ubuntu)
|
||||
tags: always
|
||||
apt:
|
||||
autoclean: yes
|
||||
changed_when: false
|
||||
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
|
||||
|
||||
- name: autoremove orphan packages (debian and ubuntu)
|
||||
tags: always
|
||||
apt:
|
||||
autoremove: yes
|
||||
purge: yes
|
||||
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
|
||||
|
||||
# - name: send completion alert
|
||||
# include_tasks: playbooks/send_completion_alert.yml
|
||||
# tags: always
|
||||
# when:
|
||||
# - task_failed is not defined
|
||||
|
||||
# - name: send failure alert
|
||||
# include_tasks: playbooks/send_failure_alert.yml
|
||||
# tags: always
|
||||
# when:
|
||||
# - task_failed is defined
|
||||
# - task_failed == true
|
||||
14
playbooks/send_completion_alert.yml
Normal file
14
playbooks/send_completion_alert.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
- name: notify healthchecks.io that the job ran
|
||||
uri:
|
||||
url: https://hc-ping.com/{{ healthcheck_uuid }}
|
||||
changed_when: False
|
||||
when: healthcheck_uuid is defined
|
||||
|
||||
- name: send completion notification via telegram
|
||||
tags: always
|
||||
telegram:
|
||||
token: "{{ telegram_token }}"
|
||||
chat_id: "{{ telegram_chat_id }}"
|
||||
msg_format: markdown
|
||||
msg: "✔️ Ansible provision finished on *{{ ansible_hostname }}*"
|
||||
changed_when: False
|
||||
30
playbooks/send_failure_alert.yml
Normal file
30
playbooks/send_failure_alert.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
- block:
|
||||
- name: send failure notification via telegram
|
||||
tags: always
|
||||
telegram:
|
||||
token: "{{ telegram_token }}"
|
||||
chat_id: "{{ telegram_chat_id }}"
|
||||
msg_format: markdown
|
||||
msg: "⚠️ Ansible provision failed on *{{ ansible_hostname }}*\n\n
|
||||
*Task*: {{ ansible_failed_task.name }}\n
|
||||
*Action*: {{ ansible_failed_task.action }}\n
|
||||
*Error Message*: \n ```{{ ansible_failed_result | to_nice_json }}```"
|
||||
changed_when: False
|
||||
|
||||
rescue:
|
||||
- name: send failure notification via telegram
|
||||
tags: always
|
||||
telegram:
|
||||
token: "{{ telegram_token }}"
|
||||
chat_id: "{{ telegram_chat_id }}"
|
||||
msg_format: markdown
|
||||
msg: "⚠️ Ansible provision failed on *{{ ansible_hostname }}*\n\n
|
||||
The specific error couldn't be shown, check the log."
|
||||
changed_when: False
|
||||
|
||||
- name: ansible job failed, clear cache later on to trigger another provision run
|
||||
become: yes
|
||||
at:
|
||||
command: "if ! pgrep -f ansible-pull >/dev/null; then rm -rf /home/simone/.ansible; fi"
|
||||
count: 60
|
||||
units: minutes
|
||||
7
roles/base/files/ansible_setup/logrotate
Normal file
7
roles/base/files/ansible_setup/logrotate
Normal file
@@ -0,0 +1,7 @@
|
||||
/var/log/ansible.log {
|
||||
rotate 3
|
||||
daily
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
deb http://deb.debian.org/debian stable main contrib non-free
|
||||
deb-src http://deb.debian.org/debian stable main contrib non-free
|
||||
|
||||
deb http://deb.debian.org/debian-security/ stable/updates main contrib non-free
|
||||
deb-src http://deb.debian.org/debian-security/ stable/updates main contrib non-free
|
||||
|
||||
deb http://deb.debian.org/debian stable-updates main contrib non-free
|
||||
deb-src http://deb.debian.org/debian stable-updates main contrib non-free
|
||||
19
roles/base/files/system_setup/image_prep.sh
Normal file
19
roles/base/files/system_setup/image_prep.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
#### Clear log files
|
||||
find /var/log -type f -name "*log" -exec truncate -s 0 {} \;
|
||||
truncate -s 0 /var/log/*tmp
|
||||
|
||||
|
||||
#### Clear user files
|
||||
find /home -type f -name .bash_history -exec rm {} \;
|
||||
|
||||
if [ -f /root/.bash_history ]; then
|
||||
rm /root/.bash_history
|
||||
fi
|
||||
|
||||
find /home -type f -name .viminfo -exec rm {} \;
|
||||
if [ -f /root/.viminfo ]; then
|
||||
rm /root/.viminfo
|
||||
fi
|
||||
4
roles/base/files/system_setup/openssh_issue.net
Normal file
4
roles/base/files/system_setup/openssh_issue.net
Normal file
@@ -0,0 +1,4 @@
|
||||
Use of this system is private. If you are not authorized, disconnect immediately.
|
||||
Failure to comply will result in your destruction.
|
||||
|
||||
|
||||
36
roles/base/files/system_setup/pi_cpu_temp.py
Normal file
36
roles/base/files/system_setup/pi_cpu_temp.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# from:
|
||||
# https://www.pragmaticlinux.com/2020/06/check-the-raspberry-pi-cpu-temperature/
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Program to demonstrate how to obtain the current value of the CPU temperature.
|
||||
"""
|
||||
print('Current CPU temperature is {:.2f}°C.'.format(get_cpu_temp()))
|
||||
print('CPU begins throttling at 60°C, and reaches critical at 80°C.')
|
||||
|
||||
|
||||
def get_cpu_temp():
|
||||
"""
|
||||
Obtains the current value of the CPU temperature.
|
||||
:returns: Current value of the CPU temperature if successful, zero value otherwise.
|
||||
:rtype: float
|
||||
"""
|
||||
# Initialize the result.
|
||||
result = 0.0
|
||||
# The first line in this file holds the CPU temperature as an integer times 1000.
|
||||
# Read the first line and remove the newline character at the end of the string.
|
||||
with open('/sys/class/thermal/thermal_zone0/temp') as f:
|
||||
line = f.readline().strip()
|
||||
# Test if the string is an integer as expected.
|
||||
if line.isdigit():
|
||||
# Convert the string with the CPU temperature to a float in degrees Celsius.
|
||||
result = float(line) / 1000
|
||||
# Give the result back to the caller.
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
79
roles/base/files/users/bzoicas/bash/bash_aliases
Normal file
79
roles/base/files/users/bzoicas/bash/bash_aliases
Normal file
@@ -0,0 +1,79 @@
|
||||
# aliases
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../../../'
|
||||
alias ....='cd ../../../../'
|
||||
alias back='cd $OLDPWD'
|
||||
alias c='clear'
|
||||
alias cd..='cd ..'
|
||||
alias cp='cp -iv'
|
||||
alias chmod="chmod -c"
|
||||
alias chmod="chmod -c"
|
||||
alias df='df -h -x squashfs -x tmpfs -x devtmpfs'
|
||||
alias diff='colordiff'
|
||||
alias egrep='egrep --colour=auto'
|
||||
alias e="vim -O "
|
||||
alias E="vim -o "
|
||||
alias extip='curl icanhazip.com'
|
||||
alias grep='grep --color=auto'
|
||||
alias l.=' ls -lhFa --time-style=long-iso --color=auto'
|
||||
alias ll=' ls -al'
|
||||
alias ls=' ls -lhF --time-style=long-iso --color=auto'
|
||||
alias lsmount='mount |column -t'
|
||||
alias mkdir='mkdir -pv'
|
||||
alias ports='netstat -tulanp'
|
||||
alias h='history'
|
||||
alias j='jobs -l'
|
||||
alias mv='mv -iv'
|
||||
alias speedtest='curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -'
|
||||
alias sproxy='ssh -p 2099 -D 9090 -q -C -N -f bzoicas@vpn.home-network.io'
|
||||
alias ssha='eval $(ssh-agent) && ssh-add'
|
||||
alias svim='sudo vim'
|
||||
alias tn=' tmux new -s'
|
||||
alias vdestroy='vagrant destroy'
|
||||
alias vssh='vagrant ssh'
|
||||
alias vup='vagrant up'
|
||||
alias watch='watch -d'
|
||||
alias weather='curl wttr.in'
|
||||
alias wget='wget -c'
|
||||
|
||||
## get top process eating memory
|
||||
alias mem5='ps auxf | sort -nr -k 4 | head -5'
|
||||
alias mem10='ps auxf | sort -nr -k 4 | head -10'
|
||||
|
||||
## get top process eating cpu ##
|
||||
alias cpu5='ps auxf | sort -nr -k 3 | head -5'
|
||||
alias cpu10='ps auxf | sort -nr -k 3 | head -10'
|
||||
|
||||
## List largest directories (aka "ducks")
|
||||
alias dir5='du -cksh * | sort -hr | head -n 5'
|
||||
alias dir10='du -cksh * | sort -hr | head -n 10'
|
||||
|
||||
# Safetynets
|
||||
# do not delete / or prompt if deleting more than 3 files at a time #
|
||||
alias rm='rm -I --preserve-root'
|
||||
|
||||
# confirmation #
|
||||
alias mv='mv -i'
|
||||
alias cp='cp -i'
|
||||
alias ln='ln -i'
|
||||
|
||||
# Parenting changing perms on / #
|
||||
alias chown='chown --preserve-root'
|
||||
alias chmod='chmod --preserve-root'
|
||||
alias chgrp='chgrp --preserve-root'
|
||||
|
||||
# reload bash config
|
||||
alias reload="source ~/.bashrc"
|
||||
|
||||
# Manage packages easier
|
||||
if [ -f /usr/bin/apt ]; then
|
||||
alias update='sudo apt update'
|
||||
alias upgrade='sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt clean'
|
||||
alias install='sudo apt install'
|
||||
fi
|
||||
|
||||
if [ -f /usr/bin/pacman ]; then
|
||||
alias update='sudo pacman -Syyy'
|
||||
alias upgrade='sudo pacman -Syu'
|
||||
alias install='sudo pacman -S'
|
||||
fi
|
||||
39
roles/base/files/users/bzoicas/bash/bash_functions
Normal file
39
roles/base/files/users/bzoicas/bash/bash_functions
Normal file
@@ -0,0 +1,39 @@
|
||||
## Functions
|
||||
# Make a directory, then go there
|
||||
md() {
|
||||
test -n "$1" || return
|
||||
mkdir -p "$1" && cd "$1"
|
||||
}
|
||||
|
||||
# "path" shows current path, one element per line.
|
||||
# If an argument is supplied, grep for it.
|
||||
path() {
|
||||
test -n "$1" && {
|
||||
echo $PATH | perl -p -e "s/:/\n/g;" | grep -i "$1"
|
||||
} || {
|
||||
echo $PATH | perl -p -e "s/:/\n/g;"
|
||||
}
|
||||
}
|
||||
|
||||
extract () {
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjvf $1 ;;
|
||||
*.tar.gz) tar xzvf $1 ;;
|
||||
*.tar.xz) tar xvf $1 ;;
|
||||
*.bz2) bzip2 -d $1 ;;
|
||||
*.rar) unrar2dir $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip2dir $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*.ace) unace x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
3
roles/base/files/users/bzoicas/bash/bash_profile
Normal file
3
roles/base/files/users/bzoicas/bash/bash_profile
Normal file
@@ -0,0 +1,3 @@
|
||||
if [ -f ~/.bashrc ]; then
|
||||
source ~/.bashrc
|
||||
fi
|
||||
2
roles/base/files/users/bzoicas/bash/bash_prompt
Normal file
2
roles/base/files/users/bzoicas/bash/bash_prompt
Normal file
@@ -0,0 +1,2 @@
|
||||
# PS1 Prompt
|
||||
tty -s && export PS1="\[\033[38;5;35m\]\t [\[\033[38;5;33m\]\j\[\033[38;5;35m\]] [\h:\[$(tput sgr0)\]\[\033[38;5;33m\]\w\[$(tput setaf 3)\]\[\033[38;5;35m\]]\n\\[\033[38;5;35m\]🦄 \[$(tput sgr0)\]"
|
||||
51
roles/base/files/users/bzoicas/bash/bashrc
Normal file
51
roles/base/files/users/bzoicas/bash/bashrc
Normal file
@@ -0,0 +1,51 @@
|
||||
# source bash prompt
|
||||
source ~/.bash/bash_prompt
|
||||
|
||||
# Source bash aliases
|
||||
source ~/.bash/bash_aliases
|
||||
|
||||
# Source bash functions
|
||||
source ~/.bash/bash_functions
|
||||
|
||||
# Env
|
||||
export TERM=xterm-256color
|
||||
export EDITOR=vim
|
||||
|
||||
|
||||
# Don't add duplicate lines or lines beginning with a space to the history
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# Set history format to include timestamps
|
||||
HISTTIMEFORMAT="%Y-%m-%d %T "
|
||||
|
||||
# Correct simple errors while using cd
|
||||
shopt -s cdspell
|
||||
|
||||
# Add /home/$USER/bin to $PATH
|
||||
case :$PATH: in
|
||||
*:/home/$USER/bin:*) ;;
|
||||
*) PATH=/home/$USER/bin:$PATH ;;
|
||||
esac
|
||||
|
||||
# Add /home/$USER/.local/bin to $PATH
|
||||
case :$PATH: in
|
||||
*:/home/$USER/.local/bin:*) ;;
|
||||
*) PATH=/home/$USER/.local/bin:$PATH ;;
|
||||
esac
|
||||
|
||||
# Safetynets
|
||||
# do not delete / or prompt if deleting more than 3 files at a time #
|
||||
alias rm='rm -I --preserve-root'
|
||||
|
||||
# confirmation #
|
||||
alias mv='mv -i'
|
||||
alias cp='cp -i'
|
||||
alias ln='ln -i'
|
||||
|
||||
# Parenting changing perms on / #
|
||||
alias chown='chown --preserve-root'
|
||||
alias chmod='chmod --preserve-root'
|
||||
alias chgrp='chgrp --preserve-root'
|
||||
|
||||
# reload bash config
|
||||
alias reload="source ~/.bashrc"
|
||||
3
roles/base/files/users/bzoicas/bash/profile
Normal file
3
roles/base/files/users/bzoicas/bash/profile
Normal file
@@ -0,0 +1,3 @@
|
||||
if [ -f ~/.bashrc ]; then
|
||||
source ~/.bashrc
|
||||
fi
|
||||
3
roles/base/files/users/bzoicas/git/gitconfig
Normal file
3
roles/base/files/users/bzoicas/git/gitconfig
Normal file
@@ -0,0 +1,3 @@
|
||||
[user]
|
||||
name = bzoicas
|
||||
email =
|
||||
26
roles/base/files/users/bzoicas/htop/htoprc
Normal file
26
roles/base/files/users/bzoicas/htop/htoprc
Normal file
@@ -0,0 +1,26 @@
|
||||
# Beware! This file is rewritten by htop when settings are changed in the interface.
|
||||
# The parser is also very primitive, and not human-friendly.
|
||||
fields=0 48 17 18 38 39 40 2 46 47 49 1
|
||||
sort_key=46
|
||||
sort_direction=1
|
||||
hide_threads=0
|
||||
hide_kernel_threads=1
|
||||
hide_userland_threads=0
|
||||
shadow_other_users=0
|
||||
show_thread_names=0
|
||||
show_program_path=1
|
||||
highlight_base_name=0
|
||||
highlight_megabytes=1
|
||||
highlight_threads=1
|
||||
tree_view=0
|
||||
header_margin=1
|
||||
detailed_cpu_time=0
|
||||
cpu_count_from_zero=0
|
||||
update_process_names=0
|
||||
account_guest_in_cpu_meter=0
|
||||
color_scheme=0
|
||||
delay=15
|
||||
left_meters=LeftCPUs2 CPU Memory Swap
|
||||
left_meter_modes=1 1 1 1
|
||||
right_meters=RightCPUs2 Tasks LoadAverage Uptime
|
||||
right_meter_modes=1 2 2 2
|
||||
2
roles/base/files/users/bzoicas/inputrc
Normal file
2
roles/base/files/users/bzoicas/inputrc
Normal file
@@ -0,0 +1,2 @@
|
||||
# Disable the annoying terminal beep
|
||||
set bell-style none
|
||||
143
roles/base/files/users/bzoicas/mc/mc.ini
Normal file
143
roles/base/files/users/bzoicas/mc/mc.ini
Normal file
@@ -0,0 +1,143 @@
|
||||
[Midnight-Commander]
|
||||
verbose=1
|
||||
pause_after_run=1
|
||||
shell_patterns=1
|
||||
auto_save_setup=1
|
||||
preallocate_space=0
|
||||
auto_menu=0
|
||||
use_internal_view=1
|
||||
use_internal_edit=0
|
||||
clear_before_exec=1
|
||||
confirm_delete=1
|
||||
confirm_overwrite=1
|
||||
confirm_execute=0
|
||||
confirm_history_cleanup=1
|
||||
confirm_exit=0
|
||||
confirm_directory_hotlist_delete=1
|
||||
safe_delete=0
|
||||
mouse_repeat_rate=100
|
||||
double_click_speed=250
|
||||
use_8th_bit_as_meta=0
|
||||
confirm_view_dir=0
|
||||
mouse_move_pages_viewer=1
|
||||
mouse_close_dialog=0
|
||||
fast_refresh=0
|
||||
drop_menus=0
|
||||
wrap_mode=1
|
||||
old_esc_mode=1
|
||||
old_esc_mode_timeout=1000000
|
||||
cd_symlinks=1
|
||||
show_all_if_ambiguous=0
|
||||
max_dirt_limit=10
|
||||
use_file_to_guess_type=1
|
||||
alternate_plus_minus=0
|
||||
only_leading_plus_minus=1
|
||||
show_output_starts_shell=0
|
||||
xtree_mode=0
|
||||
num_history_items_recorded=60
|
||||
file_op_compute_totals=1
|
||||
classic_progressbar=1
|
||||
vfs_timeout=60
|
||||
ftpfs_directory_timeout=900
|
||||
use_netrc=1
|
||||
ftpfs_retry_seconds=30
|
||||
ftpfs_always_use_proxy=0
|
||||
ftpfs_use_passive_connections=1
|
||||
ftpfs_use_passive_connections_over_proxy=0
|
||||
ftpfs_use_unix_list_options=1
|
||||
ftpfs_first_cd_then_ls=1
|
||||
fish_directory_timeout=900
|
||||
editor_tab_spacing=8
|
||||
editor_word_wrap_line_length=72
|
||||
editor_fill_tabs_with_spaces=0
|
||||
editor_return_does_auto_indent=0
|
||||
editor_backspace_through_tabs=0
|
||||
editor_fake_half_tabs=1
|
||||
editor_option_save_mode=0
|
||||
editor_option_save_position=1
|
||||
editor_option_auto_para_formatting=0
|
||||
editor_option_typewriter_wrap=0
|
||||
editor_edit_confirm_save=1
|
||||
editor_syntax_highlighting=1
|
||||
editor_persistent_selections=1
|
||||
editor_drop_selection_on_copy=1
|
||||
editor_cursor_beyond_eol=0
|
||||
editor_cursor_after_inserted_block=0
|
||||
editor_visible_tabs=1
|
||||
editor_visible_spaces=1
|
||||
editor_line_state=0
|
||||
editor_simple_statusbar=0
|
||||
editor_check_new_line=0
|
||||
editor_show_right_margin=0
|
||||
editor_group_undo=1
|
||||
editor_state_full_filename=1
|
||||
editor_ask_filename_before_edit=0
|
||||
nice_rotating_dash=1
|
||||
mcview_remember_file_position=0
|
||||
auto_fill_mkdir_name=1
|
||||
copymove_persistent_attr=1
|
||||
editor_backup_extension=~
|
||||
editor_filesize_threshold=64M
|
||||
editor_stop_format_chars=-+*\\,.;:&>
|
||||
mcview_eof=
|
||||
ignore_ftp_chattr_errors=true
|
||||
skin=dark
|
||||
|
||||
[Layout]
|
||||
message_visible=1
|
||||
keybar_visible=1
|
||||
xterm_title=1
|
||||
output_lines=0
|
||||
command_prompt=1
|
||||
menubar_visible=1
|
||||
free_space=1
|
||||
horizontal_split=0
|
||||
vertical_equal=1
|
||||
left_panel_size=119
|
||||
horizontal_equal=1
|
||||
top_panel_size=1
|
||||
|
||||
[Misc]
|
||||
timeformat_recent=%b %e %H:%M
|
||||
timeformat_old=%b %e %Y
|
||||
ftp_proxy_host=gate
|
||||
ftpfs_password=anonymous@
|
||||
display_codepage=UTF-8
|
||||
source_codepage=Other_8_bit
|
||||
autodetect_codeset=
|
||||
spell_language=en
|
||||
clipboard_store=
|
||||
clipboard_paste=
|
||||
|
||||
[Colors]
|
||||
base_color=
|
||||
xterm=
|
||||
color_terminals=
|
||||
|
||||
xterm-256color=
|
||||
|
||||
[Panels]
|
||||
show_mini_info=true
|
||||
kilobyte_si=false
|
||||
mix_all_files=false
|
||||
show_backups=true
|
||||
show_dot_files=true
|
||||
fast_reload=false
|
||||
fast_reload_msg_shown=false
|
||||
mark_moves_down=true
|
||||
reverse_files_only=true
|
||||
auto_save_setup_panels=false
|
||||
navigate_with_arrows=false
|
||||
panel_scroll_pages=true
|
||||
mouse_move_pages=true
|
||||
filetype_mode=true
|
||||
permission_mode=false
|
||||
torben_fj_mode=false
|
||||
quick_search_mode=2
|
||||
select_flags=6
|
||||
|
||||
[Panelize]
|
||||
Find *.orig after patching=find . -name \\*.orig -print
|
||||
Find SUID and SGID programs=find . \\( \\( -perm -04000 -a -perm /011 \\) -o \\( -perm -02000 -a -perm /01 \\) \\) -print
|
||||
Find rejects after patching=find . -name \\*.rej -print
|
||||
Modified git files=git ls-files --modified
|
||||
25
roles/base/files/users/bzoicas/tmux/tmux-battery.sh
Normal file
25
roles/base/files/users/bzoicas/tmux/tmux-battery.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
SYMBOL='⬜'
|
||||
|
||||
if [[ `uname` == 'Linux' ]]; then
|
||||
current_charge=$(cat /proc/acpi/battery/BAT1/state | grep 'remaining capacity' | awk '{print $3}')
|
||||
total_charge=$(cat /proc/acpi/battery/BAT1/info | grep 'last full capacity' | awk '{print $4}')
|
||||
else
|
||||
battery_info=`ioreg -rc AppleSmartBattery`
|
||||
current_charge=$(echo $battery_info | grep -o '"CurrentCapacity" = [0-9]\+' | awk '{print $3}')
|
||||
total_charge=$(echo $battery_info | grep -o '"MaxCapacity" = [0-9]\+' | awk '{print $3}')
|
||||
fi
|
||||
|
||||
charged_slots=$(echo "(($current_charge/$total_charge)*10)+1" | bc -l | cut -d '.' -f 1)
|
||||
if [[ $charged_slots -gt 10 ]]; then
|
||||
charged_slots=10
|
||||
fi
|
||||
|
||||
echo -n '#[fg=red]'
|
||||
for i in `seq 1 $charged_slots`; do echo -n "$SYMBOL"; done
|
||||
|
||||
if [[ $charged_slots -lt 10 ]]; then
|
||||
echo -n '#[fg=red]'
|
||||
for i in `seq 1 $(echo "10-$charged_slots" | bc)`; do echo -n "$SYMBOL"; done
|
||||
fi
|
||||
116
roles/base/files/users/bzoicas/tmux/tmux.conf.server
Normal file
116
roles/base/files/users/bzoicas/tmux/tmux.conf.server
Normal file
@@ -0,0 +1,116 @@
|
||||
# Initial setup
|
||||
set -g default-terminal xterm-256color
|
||||
set -g status-keys vi
|
||||
|
||||
|
||||
# use C-j and C-f for the prefix.
|
||||
set-option -g prefix C-j
|
||||
set-option -g prefix2 C-f
|
||||
unbind-key C-j
|
||||
bind-key C-j send-prefix
|
||||
set -g base-index 1
|
||||
|
||||
|
||||
# Use Alt-arrow keys without prefix key to switch panes
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
|
||||
|
||||
# Set easier window split keys
|
||||
bind-key v split-window -h
|
||||
bind-key h split-window -v
|
||||
|
||||
|
||||
# Shift arrow to switch windows
|
||||
bind -n S-Left previous-window
|
||||
bind -n S-Right next-window
|
||||
|
||||
|
||||
# Easily reorder windows with CTRL+SHIFT+Arrow
|
||||
bind-key -n C-S-Left swap-window -t -1
|
||||
bind-key -n C-S-Right swap-window -t +1
|
||||
|
||||
|
||||
# Synchronize panes
|
||||
bind-key y set-window-option synchronize-panes\; display-message "synchronize mode toggled."
|
||||
|
||||
|
||||
# Easy config reload
|
||||
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
|
||||
|
||||
|
||||
# Easy clear history
|
||||
bind-key L clear-history
|
||||
|
||||
|
||||
# Key bindings for copy-paste
|
||||
setw -g mode-keys vi
|
||||
unbind p
|
||||
bind p paste-buffer
|
||||
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
||||
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
|
||||
|
||||
|
||||
# Mouse Mode
|
||||
set -g mouse on
|
||||
|
||||
|
||||
# Lengthen the amount of time status messages are displayed
|
||||
set-option -g display-time 3000
|
||||
set-option -g display-panes-time 3000
|
||||
|
||||
|
||||
# Set the base-index to 1 rather than 0
|
||||
set -g base-index 1
|
||||
set-window-option -g pane-base-index 1
|
||||
|
||||
|
||||
# Automatically set window title
|
||||
set-window-option -g automatic-rename on
|
||||
set-option -g set-titles on
|
||||
|
||||
|
||||
# Window activity monitor
|
||||
setw -g monitor-activity on
|
||||
set -g visual-activity on
|
||||
|
||||
|
||||
# Allow the arrow key to be used immediately after changing windows.
|
||||
set-option -g repeat-time 0
|
||||
|
||||
|
||||
# No delay for escape key press
|
||||
set -sg escape-time 0
|
||||
|
||||
|
||||
# Window activity monitor
|
||||
setw -g monitor-activity on
|
||||
set -g visual-activity on
|
||||
|
||||
|
||||
# Plugins
|
||||
run-shell /home/bzoicas/.tmux/plugins/continuum/continuum.tmux
|
||||
run-shell /home/bzoicas/.tmux/plugins/resurrect/resurrect.tmux
|
||||
set -g @continuum-restore 'on'
|
||||
set -g @continuum-boot 'on'
|
||||
|
||||
|
||||
# Theme
|
||||
set-window-option -g window-status-current-style bold,bg=colour35,fg=colour234
|
||||
set-window-option -g window-status-style fg=colour35
|
||||
set -g window-status-activity-style bg=blue,fg=black
|
||||
set-option -g message-style bg=colour237,fg=colour231
|
||||
set-option -g pane-border-style fg=colour36
|
||||
set-option -g pane-active-border-style fg=colour35
|
||||
|
||||
|
||||
# Status Bar
|
||||
set -g status-justify centre
|
||||
set -g status-bg black
|
||||
set -g status-fg colour35
|
||||
set -g status-interval 60
|
||||
set -g status-left-length 50
|
||||
set -g status-left "#[bg=colour35]💻#[fg=colour234,bold] #H #[bg=colour234,nobold]#[fg=colour35] [#S] $tmux_target_lower "
|
||||
set -g status-right '#[bg=colour234]#[fg=colour35]📈 #(cut -d " " -f 1-3 /proc/loadavg) #[bg=colour35]🕔 #[fg=colour234,bold]%H:%M '
|
||||
116
roles/base/files/users/bzoicas/tmux/tmux.conf.workstation
Normal file
116
roles/base/files/users/bzoicas/tmux/tmux.conf.workstation
Normal file
@@ -0,0 +1,116 @@
|
||||
# Initial setup
|
||||
set -g default-terminal xterm-256color
|
||||
set -g status-keys vi
|
||||
|
||||
|
||||
# use C-j and C-f for the prefix.
|
||||
set-option -g prefix C-j
|
||||
set-option -g prefix2 C-f
|
||||
unbind-key C-j
|
||||
bind-key C-j send-prefix
|
||||
set -g base-index 1
|
||||
|
||||
|
||||
# Use Alt-arrow keys without prefix key to switch panes
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
|
||||
|
||||
# Set easier window split keys
|
||||
bind-key v split-window -h
|
||||
bind-key h split-window -v
|
||||
|
||||
|
||||
# Shift arrow to switch windows
|
||||
bind -n S-Left previous-window
|
||||
bind -n S-Right next-window
|
||||
|
||||
|
||||
# Easily reorder windows with CTRL+SHIFT+Arrow
|
||||
bind-key -n C-S-Left swap-window -t -1
|
||||
bind-key -n C-S-Right swap-window -t +
|
||||
|
||||
|
||||
# Synchronize panes
|
||||
bind-key y set-window-option synchronize-panes\; display-message "synchronize mode toggled."
|
||||
|
||||
|
||||
# Easy config reload
|
||||
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
|
||||
|
||||
|
||||
# Easy clear history
|
||||
bind-key L clear-history
|
||||
|
||||
|
||||
# Key bindings for copy-paste
|
||||
setw -g mode-keys vi
|
||||
unbind p
|
||||
bind p paste-buffer
|
||||
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
||||
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
|
||||
|
||||
|
||||
# Mouse Mode
|
||||
set -g mouse on
|
||||
|
||||
|
||||
# Lengthen the amount of time status messages are displayed
|
||||
set-option -g display-time 3000
|
||||
set-option -g display-panes-time 3000
|
||||
|
||||
|
||||
# Set the base-index to 1 rather than 0
|
||||
set -g base-index 1
|
||||
set-window-option -g pane-base-index 1
|
||||
|
||||
|
||||
# Automatically set window title
|
||||
set-window-option -g automatic-rename on
|
||||
set-option -g set-titles on
|
||||
|
||||
|
||||
# Window activity monitor
|
||||
setw -g monitor-activity on
|
||||
set -g visual-activity on
|
||||
|
||||
|
||||
# Allow the arrow key to be used immediately after changing windows.
|
||||
set-option -g repeat-time 0
|
||||
|
||||
|
||||
# No delay for escape key press
|
||||
set -sg escape-time 0
|
||||
|
||||
|
||||
# Window activity monitor
|
||||
setw -g monitor-activity on
|
||||
set -g visual-activity on
|
||||
|
||||
|
||||
# Plugins
|
||||
run-shell /home/bzoicas/.tmux/plugins/continuum/continuum.tmux
|
||||
run-shell /home/bzoicas/.tmux/plugins/resurrect/resurrect.tmux
|
||||
set -g @continuum-restore 'on'
|
||||
set -g @continuum-boot 'on'
|
||||
|
||||
|
||||
# Theme
|
||||
set-window-option -g window-status-current-style bold,bg=colour35,fg=colour234
|
||||
set-window-option -g window-status-style fg=colour35
|
||||
set -g window-status-activity-style bg=blue,fg=black
|
||||
set-option -g message-style bg=colour237,fg=colour231
|
||||
set-option -g pane-border-style fg=colour36
|
||||
set-option -g pane-active-border-style fg=colour35
|
||||
|
||||
|
||||
# Status Bar
|
||||
set -g status-justify centre
|
||||
set -g status-bg black
|
||||
set -g status-fg colour35
|
||||
set -g status-interval 60
|
||||
set -g status-left-length 50
|
||||
set -g status-left "#[bg=colour35]💻#[fg=colour234,bold] #H #[bg=colour234,nobold]#[fg=colour35] [#S] $tmux_target_lower "
|
||||
set -g status-right '#[bg=colour234]#[fg=colour35]📈 #(cut -d " " -f 1-3 /proc/loadavg) #[bg=colour35]🕔 #[fg=colour234,bold]%H:%M '
|
||||
159
roles/base/files/users/bzoicas/vim/bubblegum-256-dark.vim
Normal file
159
roles/base/files/users/bzoicas/vim/bubblegum-256-dark.vim
Normal file
@@ -0,0 +1,159 @@
|
||||
" Bubblegum 256 Dark
|
||||
" Author: baskerville <nihilhill@gmail.com>
|
||||
" URL: github.com/baskerville/bubblegum
|
||||
" Created: 2011
|
||||
" Version: 0.3
|
||||
|
||||
hi clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let g:colors_name="bubblegum-256-dark"
|
||||
|
||||
|
||||
" Main
|
||||
hi Normal ctermfg=249 ctermbg=235 cterm=none guifg=#B2B2B2 guibg=#262626 gui=none
|
||||
hi Comment ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
|
||||
" Constant
|
||||
hi Constant ctermfg=186 ctermbg=235 cterm=none guifg=#D7D787 guibg=#262626 gui=none
|
||||
hi String ctermfg=187 ctermbg=235 cterm=none guifg=#D7D7AF guibg=#262626 gui=none
|
||||
hi Character ctermfg=187 ctermbg=235 cterm=none guifg=#D7D7AF guibg=#262626 gui=none
|
||||
hi Number ctermfg=179 ctermbg=235 cterm=none guifg=#D7AF5F guibg=#262626 gui=none
|
||||
hi Boolean ctermfg=187 ctermbg=235 cterm=none guifg=#D7D7AF guibg=#262626 gui=none
|
||||
hi Float ctermfg=179 ctermbg=235 cterm=none guifg=#D7AF5F guibg=#262626 gui=none
|
||||
|
||||
" Variable Name
|
||||
hi Identifier ctermfg=182 ctermbg=235 cterm=none guifg=#D7AFD7 guibg=#262626 gui=none
|
||||
hi Function ctermfg=182 ctermbg=235 cterm=none guifg=#D7AFD7 guibg=#262626 gui=none
|
||||
|
||||
" Statement
|
||||
hi Statement ctermfg=110 ctermbg=235 cterm=none guifg=#87AFD7 guibg=#262626 gui=none
|
||||
hi Conditional ctermfg=110 ctermbg=235 cterm=none guifg=#87AFD7 guibg=#262626 gui=none
|
||||
hi Repeat ctermfg=110 ctermbg=235 cterm=none guifg=#87AFD7 guibg=#262626 gui=none
|
||||
hi Label ctermfg=110 ctermbg=235 cterm=none guifg=#87AFD7 guibg=#262626 gui=none
|
||||
hi Operator ctermfg=110 ctermbg=235 cterm=none guifg=#87AFD7 guibg=#262626 gui=none
|
||||
hi Keyword ctermfg=110 ctermbg=235 cterm=none guifg=#87AFD7 guibg=#262626 gui=none
|
||||
hi Exception ctermfg=110 ctermbg=235 cterm=none guifg=#87AFD7 guibg=#262626 gui=none
|
||||
|
||||
" Preprocessor
|
||||
hi PreProc ctermfg=150 ctermbg=235 cterm=none guifg=#AFD787 guibg=#262626 gui=none
|
||||
hi Include ctermfg=150 ctermbg=235 cterm=none guifg=#AFD787 guibg=#262626 gui=none
|
||||
hi Define ctermfg=150 ctermbg=235 cterm=none guifg=#AFD787 guibg=#262626 gui=none
|
||||
hi Macro ctermfg=150 ctermbg=235 cterm=none guifg=#AFD787 guibg=#262626 gui=none
|
||||
hi PreCondit ctermfg=150 ctermbg=235 cterm=none guifg=#AFD787 guibg=#262626 gui=none
|
||||
|
||||
" Type
|
||||
hi Type ctermfg=146 ctermbg=235 cterm=none guifg=#AFAFD7 guibg=#262626 gui=none
|
||||
hi StorageClass ctermfg=146 ctermbg=235 cterm=none guifg=#AFAFD7 guibg=#262626 gui=none
|
||||
hi Structure ctermfg=146 ctermbg=235 cterm=none guifg=#AFAFD7 guibg=#262626 gui=none
|
||||
hi Typedef ctermfg=146 ctermbg=235 cterm=none guifg=#AFAFD7 guibg=#262626 gui=none
|
||||
|
||||
" Special
|
||||
hi Special ctermfg=174 ctermbg=235 cterm=none guifg=#D78787 guibg=#262626 gui=none
|
||||
hi SpecialChar ctermfg=174 ctermbg=235 cterm=none guifg=#D78787 guibg=#262626 gui=none
|
||||
hi Tag ctermfg=174 ctermbg=235 cterm=none guifg=#D78787 guibg=#262626 gui=none
|
||||
hi Delimiter ctermfg=174 ctermbg=235 cterm=none guifg=#D78787 guibg=#262626 gui=none
|
||||
hi SpecialComment ctermfg=174 ctermbg=235 cterm=none guifg=#D78787 guibg=#262626 gui=none
|
||||
hi Debug ctermfg=174 ctermbg=235 cterm=none guifg=#D78787 guibg=#262626 gui=none
|
||||
hi Underlined ctermfg=249 ctermbg=235 cterm=underline guifg=#B2B2B2 guibg=#262626 gui=underline
|
||||
hi Ignore ctermfg=235 ctermbg=235 cterm=none guifg=#262626 guibg=#262626 gui=none
|
||||
hi Error ctermfg=231 ctermbg=167 cterm=none guifg=#FFFFFF guibg=#D75F5F gui=none
|
||||
hi Todo ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
|
||||
" Window
|
||||
hi StatusLine ctermfg=249 ctermbg=237 cterm=none guifg=#B2B2B2 guibg=#3A3A3A gui=none
|
||||
hi StatusLineNC ctermfg=244 ctermbg=237 cterm=none guifg=#808080 guibg=#3A3A3A gui=none
|
||||
hi TabLine ctermfg=249 ctermbg=237 cterm=none guifg=#B2B2B2 guibg=#3A3A3A gui=none
|
||||
hi TabLineSel ctermfg=253 ctermbg=238 cterm=none guifg=#DADADA guibg=#444444 gui=none
|
||||
hi TabLineFill ctermfg=249 ctermbg=237 cterm=none guifg=#B2B2B2 guibg=#3A3A3A gui=none
|
||||
hi VertSplit ctermfg=237 ctermbg=237 cterm=none guifg=#3A3A3A guibg=#3A3A3A gui=none
|
||||
|
||||
" Menu
|
||||
hi Pmenu ctermfg=249 ctermbg=237 cterm=none guifg=#B2B2B2 guibg=#3A3A3A gui=none
|
||||
hi PmenuSel ctermfg=231 ctermbg=244 cterm=none guifg=#FFFFFF guibg=#808080 gui=none
|
||||
hi PmenuSbar ctermfg=231 ctermbg=244 cterm=none guifg=#FFFFFF guibg=#808080 gui=none
|
||||
hi PmenuThumb ctermfg=187 ctermbg=187 cterm=none guifg=#D7D7AF guibg=#D7D7AF gui=none
|
||||
hi WildMenu ctermfg=232 ctermbg=98 cterm=none guifg=#080808 guibg=#875FD7 gui=none
|
||||
|
||||
" Selection
|
||||
hi Visual ctermfg=235 ctermbg=117 cterm=none guifg=#262626 guibg=#87D7FF gui=none
|
||||
hi VisualNOS ctermfg=235 ctermbg=80 cterm=none guifg=#262626 guibg=#5FD7D7 gui=none
|
||||
|
||||
" Message
|
||||
hi ErrorMsg ctermfg=210 ctermbg=235 cterm=none guifg=#FF8787 guibg=#262626 gui=none
|
||||
hi WarningMsg ctermfg=140 ctermbg=235 cterm=none guifg=#AF87D7 guibg=#262626 gui=none
|
||||
hi MoreMsg ctermfg=72 ctermbg=235 cterm=none guifg=#5FAF87 guibg=#262626 gui=none
|
||||
hi ModeMsg ctermfg=222 ctermbg=235 cterm=bold guifg=#FFD787 guibg=#262626 gui=bold
|
||||
hi Question ctermfg=38 ctermbg=235 cterm=none guifg=#00AFD7 guibg=#262626 gui=none
|
||||
|
||||
" Mark
|
||||
hi Folded ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
hi FoldColumn ctermfg=79 ctermbg=237 cterm=none guifg=#5FD7AF guibg=#3A3A3A gui=none
|
||||
hi SignColumn ctermfg=79 ctermbg=237 cterm=none guifg=#5FD7AF guibg=#3A3A3A gui=none
|
||||
hi ColorColumn ctermfg=79 ctermbg=237 cterm=none guifg=#5FD7AF guibg=#3A3A3A gui=none
|
||||
hi LineNr ctermfg=244 ctermbg=237 cterm=none guifg=#808080 guibg=#3A3A3A gui=none
|
||||
hi MatchParen ctermfg=16 ctermbg=215 cterm=none guifg=#000000 guibg=#FFAF5F gui=none
|
||||
|
||||
" Cursor
|
||||
hi CursorColumn ctermfg=249 ctermbg=237 cterm=none guifg=#B2B2B2 guibg=#3A3A3A gui=none
|
||||
hi CursorLine ctermfg=249 ctermbg=237 cterm=none guifg=#B2B2B2 guibg=#3A3A3A gui=none
|
||||
hi CursorLineNr ctermfg=249 ctermbg=237 cterm=none guifg=#B2B2B2 guibg=#3A3A3A gui=none
|
||||
|
||||
" Search
|
||||
hi Search ctermfg=16 ctermbg=179 cterm=none guifg=#000000 guibg=#D7AF5F gui=none
|
||||
hi IncSearch ctermfg=231 ctermbg=168 cterm=none guifg=#FFFFFF guibg=#D75F87 gui=none
|
||||
|
||||
" Diff Mode
|
||||
hi DiffAdd ctermfg=16 ctermbg=149 cterm=none guifg=#000000 guibg=#AFD75F gui=none
|
||||
hi DiffChange ctermfg=16 ctermbg=217 cterm=none guifg=#000000 guibg=#FFAFAF gui=none
|
||||
hi DiffText ctermfg=16 ctermbg=211 cterm=bold guifg=#000000 guibg=#FF87AF gui=bold
|
||||
hi DiffDelete ctermfg=16 ctermbg=249 cterm=none guifg=#000000 guibg=#B2B2B2 gui=none
|
||||
|
||||
" Spell
|
||||
hi SpellBad ctermfg=210 ctermbg=235 cterm=underline guifg=#FF8787 guibg=#262626 gui=underline
|
||||
hi SpellCap ctermfg=174 ctermbg=235 cterm=underline guifg=#D78787 guibg=#262626 gui=underline
|
||||
hi SpellRare ctermfg=181 ctermbg=235 cterm=underline guifg=#D7AFAF guibg=#262626 gui=underline
|
||||
hi SpellLocal ctermfg=180 ctermbg=235 cterm=underline guifg=#D7AF87 guibg=#262626 gui=underline
|
||||
|
||||
" Misc
|
||||
hi SpecialKey ctermfg=114 ctermbg=235 cterm=none guifg=#87D787 guibg=#262626 gui=none
|
||||
hi NonText ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
hi Directory ctermfg=103 ctermbg=235 cterm=none guifg=#8787AF guibg=#262626 gui=none
|
||||
hi Title ctermfg=109 ctermbg=235 cterm=none guifg=#87AFAF guibg=#262626 gui=none
|
||||
hi Conceal ctermfg=77 ctermbg=235 cterm=none guifg=#5FD75F guibg=#262626 gui=none
|
||||
hi Noise ctermfg=247 ctermbg=235 cterm=none guifg=#9E9E9E guibg=#262626 gui=none
|
||||
hi helpHyperTextJump ctermfg=74 ctermbg=235 cterm=none guifg=#5FAFD7 guibg=#262626 gui=none
|
||||
hi perlSharpBang ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
hi rubySharpBang ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
hi jsFuncCall ctermfg=116 ctermbg=235 cterm=none guifg=#87D7D7 guibg=#262626 gui=none
|
||||
|
||||
" Html
|
||||
hi javaScriptNumber ctermfg=179 ctermbg=235 cterm=none guifg=#D7AF5F guibg=#262626 gui=none
|
||||
hi htmlTag ctermfg=147 ctermbg=235 cterm=none guifg=#AFAFFF guibg=#262626 gui=none
|
||||
hi htmlEndTag ctermfg=147 ctermbg=235 cterm=none guifg=#AFAFFF guibg=#262626 gui=none
|
||||
hi htmlTagName ctermfg=175 ctermbg=235 cterm=none guifg=#D787AF guibg=#262626 gui=none
|
||||
hi htmlString ctermfg=144 ctermbg=235 cterm=none guifg=#AFAF87 guibg=#262626 gui=none
|
||||
|
||||
" Vim
|
||||
hi vimFold ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
hi vimCommentTitle ctermfg=249 ctermbg=235 cterm=none guifg=#B2B2B2 guibg=#262626 gui=none
|
||||
|
||||
" Diff File
|
||||
hi diffFile ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
hi diffLine ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
hi diffAdded ctermfg=107 ctermbg=235 cterm=none guifg=#87AF5F guibg=#262626 gui=none
|
||||
hi diffRemoved ctermfg=175 ctermbg=235 cterm=none guifg=#D787AF guibg=#262626 gui=none
|
||||
hi diffChanged ctermfg=179 ctermbg=235 cterm=none guifg=#D7AF5F guibg=#262626 gui=none
|
||||
hi diffOldLine ctermfg=104 ctermbg=235 cterm=none guifg=#8787D7 guibg=#262626 gui=none
|
||||
|
||||
" Mail
|
||||
hi mailSubject ctermfg=109 ctermbg=235 cterm=none guifg=#87AFAF guibg=#262626 gui=none
|
||||
hi mailSignature ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
|
||||
" Markdown
|
||||
hi markdownCode ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
hi markdownCodeBlock ctermfg=244 ctermbg=235 cterm=none guifg=#808080 guibg=#262626 gui=none
|
||||
hi markdownItalic ctermfg=252 ctermbg=235 cterm=none guifg=#D0D0D0 guibg=#262626 gui=none
|
||||
6
roles/base/files/users/bzoicas/vim/cmake.vim
Normal file
6
roles/base/files/users/bzoicas/vim/cmake.vim
Normal file
@@ -0,0 +1,6 @@
|
||||
setlocal tabstop=2
|
||||
setlocal softtabstop=2
|
||||
setlocal shiftwidth=2
|
||||
setlocal textwidth=80
|
||||
setlocal smarttab
|
||||
setlocal expandtab
|
||||
78
roles/base/files/users/bzoicas/vim/cpp.vim
Normal file
78
roles/base/files/users/bzoicas/vim/cpp.vim
Normal file
@@ -0,0 +1,78 @@
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_CPP_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_CPP_ftplugin = 1
|
||||
|
||||
" =================================================
|
||||
" tab
|
||||
" =================================================
|
||||
setlocal tabstop=2
|
||||
setlocal softtabstop=2
|
||||
setlocal shiftwidth=2
|
||||
|
||||
" =================================================
|
||||
" Completion
|
||||
" =================================================
|
||||
" dictionary
|
||||
setlocal dictionary=~/.vim/dict/cpp-libstdc++.dict,~/.vim/dict/c-eglibc.dict,~/.vim/dict/cpp-boost.dict
|
||||
|
||||
" tags
|
||||
|
||||
" OmniCppComplete
|
||||
let OmniCpp_NamespaceSearch = 1
|
||||
let OmniCpp_GlobalScopeSearch = 1
|
||||
let OmniCpp_ShowAccess = 1
|
||||
let OmniCpp_MayCompleteDot = 1
|
||||
let OmniCpp_MayCompleteArrow = 1
|
||||
let OmniCpp_MayCompleteScope = 1
|
||||
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
|
||||
|
||||
" Set completement for C++
|
||||
setlocal omnifunc=cppcomplete#Complete
|
||||
|
||||
" Set F12 to use ctags for C++
|
||||
map <F12> :!ctags -R –c++-kinds=+p –fields=+iaS –extra=+q .<CR>
|
||||
|
||||
" =================================================
|
||||
" cscope settings
|
||||
" =================================================
|
||||
nmap <C-@>s :cs find s <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <C-@>g :cs find g <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <C-@>c :cs find c <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <C-@>t :cs find t <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <C-@>e :cs find e <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <C-@>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
|
||||
nmap <C-@>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
|
||||
nmap <C-@>d :cs find d <C-R>=expand("<cword>")<CR><CR>
|
||||
|
||||
if has("cscope")
|
||||
setlocal csprg=/usr/bin/cscope
|
||||
setlocal csto=0
|
||||
setlocal cst
|
||||
setlocal nocsverb
|
||||
" add any database in current directory
|
||||
if filereadable("cscope.out")
|
||||
cs add cscope.out
|
||||
" else add database pointed to by environment
|
||||
elseif $CSCOPE_DB != ""
|
||||
cs add $CSCOPE_DB
|
||||
endif
|
||||
|
||||
setlocal csverb
|
||||
setlocal cscopetag
|
||||
setlocal cscopequickfix=s-,g-,c-,d-,t-,e-,f-,i-
|
||||
endif
|
||||
|
||||
function! s:clang_format()
|
||||
let now_line = line(".")
|
||||
exec ":%! clang-format -style=Google"
|
||||
exec ":" . now_line
|
||||
endfunction
|
||||
|
||||
if executable('clang-format')
|
||||
augroup cpp_clang_format
|
||||
autocmd!
|
||||
autocmd BufWrite,FileWritePre,FileAppendPre *.[ch]pp call s:clang_format()
|
||||
augroup END
|
||||
endif
|
||||
75
roles/base/files/users/bzoicas/vim/darktango.vim
Normal file
75
roles/base/files/users/bzoicas/vim/darktango.vim
Normal file
@@ -0,0 +1,75 @@
|
||||
" Vim color file
|
||||
" Name: DarkTango
|
||||
" Maintainer: Panos Laganakos <panos.laganakos@gmail.com>
|
||||
" Version: 0.3
|
||||
|
||||
|
||||
set background=dark
|
||||
if version > 580
|
||||
" no guarantees for version 5.8 and below, but this makes it stop
|
||||
" complaining
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
endif
|
||||
|
||||
let g:colors_name="darktango"
|
||||
|
||||
hi Normal guibg=#2e3436 guifg=#d3d7cf
|
||||
|
||||
" {{{ syntax
|
||||
hi Comment guifg=#555753
|
||||
hi Title guifg=#eeeeec
|
||||
hi Underlined guifg=#20b0eF gui=none
|
||||
hi Statement guifg=#888a85
|
||||
hi Type guifg=#ce5c00
|
||||
hi PreProc guifg=#eeeeec
|
||||
hi Constant guifg=#babdb6
|
||||
hi Identifier guifg=#ce5c00
|
||||
hi Special guifg=#eeeeec
|
||||
hi Ignore guifg=#f57900
|
||||
hi Todo guibg=#ce5c00 guifg=#eeeeec
|
||||
"hi Error
|
||||
"}}}
|
||||
|
||||
" {{{ groups
|
||||
hi Cursor guibg=#babdb6 guifg=#2e3436
|
||||
"hi CursorIM
|
||||
hi Directory guifg=#bbd0df
|
||||
"hi DiffAdd
|
||||
"hi DiffChange
|
||||
"hi DiffDelete
|
||||
"hi DiffText
|
||||
"hi ErrorMsg
|
||||
hi VertSplit guibg=#555753 guifg=#2e3436 gui=none
|
||||
hi Folded guibg=#555753 guifg=#eeeeec
|
||||
hi FoldColumn guibg=#2e3436 guifg=#555753
|
||||
hi LineNr guibg=#2e3436 guifg=#555753
|
||||
hi MatchParen guibg=#babdb6 guifg=#2e3436
|
||||
hi ModeMsg guifg=#ce5c00
|
||||
hi MoreMsg guifg=#ce5c00
|
||||
hi NonText guibg=#2e3436 guifg=#555753
|
||||
hi Question guifg=#aabbcc
|
||||
hi Search guibg=#fce94f guifg=#c4a000
|
||||
hi IncSearch guibg=#c4a000 guifg=#fce94f
|
||||
hi SpecialKey guifg=#ce5c00
|
||||
hi StatusLine guibg=#555753 guifg=#eeeeec gui=none
|
||||
hi StatusLineNC guibg=#555753 guifg=#272334 gui=none
|
||||
hi Visual guibg=#fcaf3e guifg=#ce5c00
|
||||
"hi VisualNOS
|
||||
hi WarningMsg guifg=salmon
|
||||
"hi WildMenu
|
||||
"hi Menu
|
||||
"hi Scrollbar guibg=grey30 guifg=tan
|
||||
"hi Tooltip
|
||||
hi Pmenu guibg=#babdb6 guifg=#555753
|
||||
hi PmenuSel guibg=#eeeeec guifg=#2e3436
|
||||
hi CursorLine guibg=#212628
|
||||
" }}}
|
||||
|
||||
" {{{ terminal
|
||||
" TODO
|
||||
" }}}
|
||||
|
||||
"vim: sw=4
|
||||
504
roles/base/files/users/bzoicas/vim/html.vim
Normal file
504
roles/base/files/users/bzoicas/vim/html.vim
Normal file
@@ -0,0 +1,504 @@
|
||||
" Vim indent script for HTML
|
||||
" General: "{{{
|
||||
" File: html.vim (Vimscript #2075)
|
||||
" Author: Andy Wokula <anwoku@yahoo.de>
|
||||
" Last Change: 2014 Jan 27
|
||||
" Rev Days: 18
|
||||
" Version: 0.10
|
||||
" Vim Version: Vim7
|
||||
" Description:
|
||||
" Improved version of the distributed html indent script, faster on a
|
||||
" range of lines.
|
||||
"
|
||||
" Credits:
|
||||
" indent/html.vim (2006 Jun 05) from J. Zellner
|
||||
" indent/css.vim (2006 Dec 20) from N. Weibull
|
||||
"
|
||||
" History:
|
||||
" 2014 Jan 27 (v0.10) added b:html_indent_usestate; and a bug fix
|
||||
" 2012 Oct 21 (v0.9) added support for shiftwidth()
|
||||
" 2011 Sep 09 (v0.8) added HTML5 tags (thx to J. Zuckerman)
|
||||
" 2008 Apr 28 (v0.6) revised customization
|
||||
" 2008 Mar 09 (v0.5) fixed 'indk' issue (thx to C.J. Robinson)
|
||||
" }}}
|
||||
|
||||
" Init Folklore, check user settings (2nd time ++) "{{{
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=HtmlIndent()
|
||||
setlocal indentkeys=o,O,<Return>,<>>,{,},!^F
|
||||
|
||||
let b:indent = {"lnum": -1}
|
||||
let b:undo_indent = "set inde< indk<| unlet b:indent"
|
||||
|
||||
" Load Once:
|
||||
if exists("*HtmlIndent")
|
||||
call HtmlIndent_CheckUserSettings()
|
||||
finish
|
||||
endif
|
||||
|
||||
" Patch 7.3.694
|
||||
if exists('*shiftwidth')
|
||||
let s:ShiftWidth = function('shiftwidth')
|
||||
else
|
||||
func! s:ShiftWidth()
|
||||
return &shiftwidth
|
||||
endfunc
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo-=C
|
||||
"}}}
|
||||
|
||||
func! HtmlIndent_CheckUserSettings() "{{{
|
||||
if exists("g:html_indent_inctags")
|
||||
call s:AddITags(split(g:html_indent_inctags, ","))
|
||||
endif
|
||||
if exists("g:html_indent_autotags")
|
||||
call s:RemoveITags(split(g:html_indent_autotags, ","))
|
||||
endif
|
||||
|
||||
let indone = {"zero": 0
|
||||
\,"auto": "indent(prevnonblank(v:lnum-1))"
|
||||
\,"inc": "b:indent.blocktagind + s:ShiftWidth()"}
|
||||
if exists("g:html_indent_script1")
|
||||
let s:js1indent = get(indone, g:html_indent_script1, indone.zero)
|
||||
endif
|
||||
if exists("g:html_indent_style1")
|
||||
let s:css1indent = get(indone, g:html_indent_style1, indone.zero)
|
||||
endif
|
||||
endfunc "}}}
|
||||
|
||||
" Init Script Vars "{{{
|
||||
let s:usestate = 1
|
||||
let s:css1indent = 0
|
||||
let s:js1indent = 0
|
||||
" not to be changed:
|
||||
let s:endtags = [0,0,0,0,0,0,0,0] " some places unused
|
||||
let s:newstate = {}
|
||||
let s:countonly = 0
|
||||
"}}}
|
||||
func! s:AddITags(taglist) "{{{
|
||||
for itag in a:taglist
|
||||
let s:indent_tags[itag] = 1
|
||||
let s:indent_tags['/'.itag] = -1
|
||||
endfor
|
||||
endfunc "}}}
|
||||
func! s:AddBlockTag(tag, id, ...) "{{{
|
||||
if !(a:id >= 2 && a:id < 2+len(s:endtags))
|
||||
return
|
||||
endif
|
||||
let s:indent_tags[a:tag] = a:id
|
||||
if a:0 == 0
|
||||
let s:indent_tags['/'.a:tag] = -a:id
|
||||
let s:endtags[a:id-2] = "</".a:tag.">"
|
||||
else
|
||||
let s:indent_tags[a:1] = -a:id
|
||||
let s:endtags[a:id-2] = a:1
|
||||
endif
|
||||
endfunc "}}}
|
||||
func! s:RemoveITags(taglist) "{{{
|
||||
" remove itags (protect blocktags from being removed)
|
||||
for itag in a:taglist
|
||||
if !has_key(s:indent_tags, itag) || s:indent_tags[itag] != 1
|
||||
continue
|
||||
endif
|
||||
unlet s:indent_tags[itag]
|
||||
if itag =~ '^\w\+$'
|
||||
unlet s:indent_tags["/".itag]
|
||||
endif
|
||||
endfor
|
||||
endfunc "}}}
|
||||
" Add Indent Tags: {{{
|
||||
if !exists("s:indent_tags")
|
||||
let s:indent_tags = {}
|
||||
endif
|
||||
|
||||
" old tags:
|
||||
call s:AddITags(['a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big',
|
||||
\ 'blockquote', 'button', 'caption', 'center', 'cite', 'code', 'colgroup',
|
||||
\ 'del', 'dfn', 'dir', 'div', 'dl', 'em', 'fieldset', 'font', 'form',
|
||||
\ 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'i', 'iframe', 'ins', 'kbd',
|
||||
\ 'label', 'legend', 'map', 'menu', 'noframes', 'noscript', 'object', 'ol',
|
||||
\ 'optgroup', 'q', 's', 'samp', 'select', 'small', 'span', 'strong', 'sub',
|
||||
\ 'sup', 'table', 'textarea', 'title', 'tt', 'u', 'ul', 'var', 'th', 'td',
|
||||
\ 'tr', 'tfoot', 'thead'])
|
||||
|
||||
" tags added 2011 Sep 09 (especially HTML5 tags):
|
||||
call s:AddITags(['area', 'article', 'aside', 'audio', 'bdi', 'canvas',
|
||||
\ 'command', 'datalist', 'details', 'embed', 'figure', 'footer',
|
||||
\ 'header', 'group', 'keygen', 'mark', 'math', 'meter', 'nav', 'output',
|
||||
\ 'progress', 'ruby', 'section', 'svg', 'texture', 'time', 'video',
|
||||
\ 'wbr', 'text'])
|
||||
|
||||
"}}}
|
||||
" Add Block Tags: contain alien content "{{{
|
||||
call s:AddBlockTag('pre', 2)
|
||||
call s:AddBlockTag('script', 3)
|
||||
call s:AddBlockTag('style', 4)
|
||||
call s:AddBlockTag('<!--', 5, '-->')
|
||||
"}}}
|
||||
|
||||
func! s:CountITags(...) "{{{
|
||||
|
||||
" relative indent steps for current line [unit &sw]:
|
||||
let s:curind = 0
|
||||
" relative indent steps for next line [unit &sw]:
|
||||
let s:nextrel = 0
|
||||
|
||||
if a:0==0
|
||||
let s:block = s:newstate.block
|
||||
let tmpline = substitute(s:curline, '<\zs\/\=\w\+\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
|
||||
if s:block == 3
|
||||
let s:newstate.scripttype = s:GetScriptType(matchstr(tmpline, '\C.*<SCRIPT\>\zs[^>]*'))
|
||||
endif
|
||||
let s:newstate.block = s:block
|
||||
else
|
||||
let s:block = 0 " assume starting outside of a block
|
||||
let s:countonly = 1 " don't change state
|
||||
let tmpline = substitute(s:altline, '<\zs\/\=\w\+\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
|
||||
let s:countonly = 0
|
||||
endif
|
||||
endfunc "}}}
|
||||
func! s:CheckTag(itag) "{{{
|
||||
" "tag" or "/tag" or "<!--" or "-->"
|
||||
let ind = get(s:indent_tags, a:itag)
|
||||
if ind == -1
|
||||
" closing tag
|
||||
if s:block != 0
|
||||
" ignore itag within a block
|
||||
return "foo"
|
||||
endif
|
||||
if s:nextrel == 0
|
||||
let s:curind -= 1
|
||||
else
|
||||
let s:nextrel -= 1
|
||||
endif
|
||||
" if s:curind >= 1
|
||||
" let s:curind -= 1
|
||||
" else
|
||||
" let s:nextrel -= 1
|
||||
" endif
|
||||
elseif ind == 1
|
||||
" opening tag
|
||||
if s:block != 0
|
||||
return "foo"
|
||||
endif
|
||||
let s:nextrel += 1
|
||||
elseif ind != 0
|
||||
" block-tag (opening or closing)
|
||||
return s:Blocktag(a:itag, ind)
|
||||
endif
|
||||
" else ind==0 (other tag found): keep indent
|
||||
return "foo" " no matter
|
||||
endfunc "}}}
|
||||
func! s:Blocktag(blocktag, ind) "{{{
|
||||
if a:ind > 0
|
||||
" a block starts here
|
||||
if s:block != 0
|
||||
" already in a block (nesting) - ignore
|
||||
" especially ignore comments after other blocktags
|
||||
return "foo"
|
||||
endif
|
||||
let s:block = a:ind " block type
|
||||
if s:countonly
|
||||
return "foo"
|
||||
endif
|
||||
let s:newstate.blocklnr = v:lnum
|
||||
" save allover indent for the endtag
|
||||
let s:newstate.blocktagind = b:indent.baseindent + (s:nextrel + s:curind) * s:ShiftWidth()
|
||||
if a:ind == 3
|
||||
return "SCRIPT" " all except this must be lowercase
|
||||
" line is to be checked again for the type attribute
|
||||
endif
|
||||
else
|
||||
let s:block = 0
|
||||
" we get here if starting and closing block-tag on same line
|
||||
endif
|
||||
return "foo"
|
||||
endfunc "}}}
|
||||
func! s:GetScriptType(str) "{{{
|
||||
if a:str == "" || a:str =~ "java"
|
||||
return "javascript"
|
||||
else
|
||||
return ""
|
||||
endif
|
||||
endfunc "}}}
|
||||
|
||||
func! s:FreshState(lnum) "{{{
|
||||
" Look back in the file (lines 1 to a:lnum-1) to calc a state for line
|
||||
" a:lnum. A state is to know ALL relevant details about the lines
|
||||
" 1..a:lnum-1, initial calculating (here!) can be slow, but updating is
|
||||
" fast (incremental).
|
||||
" State:
|
||||
" lnum last indented line == prevnonblank(a:lnum - 1)
|
||||
" block = 0 a:lnum located within special tag: 0:none, 2:<pre>,
|
||||
" 3:<script>, 4:<style>, 5:<!--
|
||||
" baseindent use this indent for line a:lnum as a start - kind of
|
||||
" autoindent (if block==0)
|
||||
" scripttype = '' type attribute of a script tag (if block==3)
|
||||
" blocktagind indent for current opening (get) and closing (set)
|
||||
" blocktag (if block!=0)
|
||||
" blocklnr lnum of starting blocktag (if block!=0)
|
||||
" inattr line {lnum} starts with attributes of a tag
|
||||
let state = {}
|
||||
let state.lnum = prevnonblank(a:lnum - 1)
|
||||
let state.scripttype = ""
|
||||
let state.blocktagind = -1
|
||||
let state.block = 0
|
||||
let state.baseindent = 0
|
||||
let state.blocklnr = 0
|
||||
let state.inattr = 0
|
||||
|
||||
if state.lnum == 0
|
||||
return state
|
||||
endif
|
||||
|
||||
" Heuristic:
|
||||
" remember startline state.lnum
|
||||
" look back for <pre, </pre, <script, </script, <style, </style tags
|
||||
" remember stopline
|
||||
" if opening tag found,
|
||||
" assume a:lnum within block
|
||||
" else
|
||||
" look back in result range (stopline, startline) for comment
|
||||
" \ delimiters (<!--, -->)
|
||||
" if comment opener found,
|
||||
" assume a:lnum within comment
|
||||
" else
|
||||
" assume usual html for a:lnum
|
||||
" if a:lnum-1 has a closing comment
|
||||
" look back to get indent of comment opener
|
||||
" FI
|
||||
|
||||
" look back for blocktag
|
||||
call cursor(a:lnum, 1)
|
||||
let [stopline, stopcol] = searchpos('\c<\zs\/\=\%(pre\>\|script\>\|style\>\)', "bW")
|
||||
" fugly ... why isn't there searchstr()
|
||||
let tagline = tolower(getline(stopline))
|
||||
let blocktag = matchstr(tagline, '\/\=\%(pre\>\|script\>\|style\>\)', stopcol-1)
|
||||
if stopline > 0 && blocktag[0] != "/"
|
||||
" opening tag found, assume a:lnum within block
|
||||
let state.block = s:indent_tags[blocktag]
|
||||
if state.block == 3
|
||||
let state.scripttype = s:GetScriptType(matchstr(tagline, '\>[^>]*', stopcol))
|
||||
endif
|
||||
let state.blocklnr = stopline
|
||||
" check preceding tags in the line:
|
||||
let s:altline = tagline[: stopcol-2]
|
||||
call s:CountITags(1)
|
||||
let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * s:ShiftWidth()
|
||||
return state
|
||||
elseif stopline == state.lnum
|
||||
" handle special case: previous line (= state.lnum) contains a
|
||||
" closing blocktag which is preceded by line-noise;
|
||||
" blocktag == "/..."
|
||||
let swendtag = match(tagline, '^\s*</') >= 0
|
||||
if !swendtag
|
||||
let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bW")
|
||||
let s:altline = tolower(getline(bline)[: bcol-2])
|
||||
call s:CountITags(1)
|
||||
let state.baseindent = indent(bline) + (s:nextrel+s:curind) * s:ShiftWidth()
|
||||
return state
|
||||
endif
|
||||
endif
|
||||
|
||||
" else look back for comment
|
||||
call cursor(a:lnum, 1)
|
||||
let [comline, comcol, found] = searchpos('\(<!--\)\|-->', 'bpW', stopline)
|
||||
if found == 2
|
||||
" comment opener found, assume a:lnum within comment
|
||||
let state.block = 5
|
||||
let state.blocklnr = comline
|
||||
" check preceding tags in the line:
|
||||
let s:altline = tolower(getline(comline)[: comcol-2])
|
||||
call s:CountITags(1)
|
||||
let state.blocktagind = indent(comline) + (s:curind + s:nextrel) * s:ShiftWidth()
|
||||
return state
|
||||
endif
|
||||
|
||||
" else within usual html
|
||||
let s:altline = tolower(getline(state.lnum))
|
||||
" check a:lnum-1 for closing comment (we need indent from the opening line)
|
||||
let comcol = stridx(s:altline, '-->')
|
||||
if comcol >= 0
|
||||
call cursor(state.lnum, comcol+1)
|
||||
let [comline, comcol] = searchpos('<!--', 'bW')
|
||||
if comline == state.lnum
|
||||
let s:altline = s:altline[: comcol-2]
|
||||
else
|
||||
let s:altline = tolower(getline(comline)[: comcol-2])
|
||||
endif
|
||||
call s:CountITags(1)
|
||||
let state.baseindent = indent(comline) + (s:nextrel+s:curind) * s:ShiftWidth()
|
||||
return state
|
||||
" TODO check tags that follow "-->"
|
||||
endif
|
||||
|
||||
" else no comments
|
||||
call s:CountITags(1)
|
||||
let state.baseindent = indent(state.lnum) + s:nextrel * s:ShiftWidth()
|
||||
" line starts with end tag
|
||||
let swendtag = match(s:altline, '^\s*</') >= 0
|
||||
if !swendtag
|
||||
let state.baseindent += s:curind * s:ShiftWidth()
|
||||
endif
|
||||
return state
|
||||
endfunc "}}}
|
||||
|
||||
func! s:Alien2() "{{{
|
||||
" <pre> block
|
||||
return -1
|
||||
endfunc "}}}
|
||||
func! s:Alien3() "{{{
|
||||
" <script> javascript
|
||||
if prevnonblank(v:lnum-1) == b:indent.blocklnr
|
||||
" indent for the first line after <script>
|
||||
return eval(s:js1indent)
|
||||
endif
|
||||
if b:indent.scripttype == "javascript"
|
||||
return cindent(v:lnum)
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunc "}}}
|
||||
func! s:Alien4() "{{{
|
||||
" <style>
|
||||
if prevnonblank(v:lnum-1) == b:indent.blocklnr
|
||||
" indent for first content line
|
||||
return eval(s:css1indent)
|
||||
endif
|
||||
return s:CSSIndent()
|
||||
endfunc
|
||||
|
||||
func! s:CSSIndent() "{{{
|
||||
" adopted $VIMRUNTIME/indent/css.vim
|
||||
if getline(v:lnum) =~ '^\s*[*}]'
|
||||
return cindent(v:lnum)
|
||||
endif
|
||||
let minline = b:indent.blocklnr
|
||||
let pnum = s:css_prevnoncomment(v:lnum - 1, minline)
|
||||
if pnum <= minline
|
||||
" < is to catch errors
|
||||
" indent for first content line after comments
|
||||
return eval(s:css1indent)
|
||||
endif
|
||||
let ind = indent(pnum) + s:css_countbraces(pnum, 1) * s:ShiftWidth()
|
||||
let pline = getline(pnum)
|
||||
if pline =~ '}\s*$'
|
||||
let ind -= (s:css_countbraces(pnum, 0) - (pline =~ '^\s*}')) * s:ShiftWidth()
|
||||
endif
|
||||
return ind
|
||||
endfunc "}}}
|
||||
func! s:css_prevnoncomment(lnum, stopline) "{{{
|
||||
" caller starts from a line a:lnum-1 that is not a comment
|
||||
let lnum = prevnonblank(a:lnum)
|
||||
let ccol = match(getline(lnum), '\*/')
|
||||
if ccol < 0
|
||||
return lnum
|
||||
endif
|
||||
call cursor(lnum, ccol+1)
|
||||
let lnum = search('/\*', 'bW', a:stopline)
|
||||
if indent(".") == virtcol(".")-1
|
||||
return prevnonblank(lnum-1)
|
||||
else
|
||||
return lnum
|
||||
endif
|
||||
endfunc "}}}
|
||||
func! s:css_countbraces(lnum, count_open) "{{{
|
||||
let brs = substitute(getline(a:lnum),'[''"].\{-}[''"]\|/\*.\{-}\*/\|/\*.*$\|[^{}]','','g')
|
||||
let n_open = 0
|
||||
let n_close = 0
|
||||
for brace in split(brs, '\zs')
|
||||
if brace == "{"
|
||||
let n_open += 1
|
||||
elseif brace == "}"
|
||||
if n_open > 0
|
||||
let n_open -= 1
|
||||
else
|
||||
let n_close += 1
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
return a:count_open ? n_open : n_close
|
||||
endfunc "}}}
|
||||
|
||||
"}}}
|
||||
func! s:Alien5() "{{{
|
||||
" <!-- -->
|
||||
return -1
|
||||
endfunc "}}}
|
||||
|
||||
func! HtmlIndent() "{{{
|
||||
let s:curline = tolower(getline(v:lnum))
|
||||
let indentunit = s:ShiftWidth()
|
||||
|
||||
let s:newstate = {}
|
||||
let s:newstate.lnum = v:lnum
|
||||
|
||||
" does the line start with a closing tag?
|
||||
let swendtag = match(s:curline, '^\s*</') >= 0
|
||||
|
||||
if prevnonblank(v:lnum-1) != b:indent.lnum || (exists("b:html_indent_usestate") && !b:html_indent_usestate)
|
||||
" start over, don't use state
|
||||
let b:indent = s:FreshState(v:lnum)
|
||||
endif
|
||||
|
||||
if b:indent.block >= 2
|
||||
" within block
|
||||
let endtag = s:endtags[b:indent.block-2]
|
||||
let blockend = stridx(s:curline, endtag)
|
||||
if blockend >= 0
|
||||
" block ends here
|
||||
let s:newstate.block = 0
|
||||
" calc indent for REST OF LINE (may start more blocks):
|
||||
let s:curline = strpart(s:curline, blockend+strlen(endtag))
|
||||
call s:CountITags()
|
||||
if swendtag && b:indent.block != 5
|
||||
let indent = b:indent.blocktagind + s:curind * indentunit
|
||||
let s:newstate.baseindent = indent + s:nextrel * indentunit
|
||||
else
|
||||
let indent = s:Alien{b:indent.block}()
|
||||
let s:newstate.baseindent = b:indent.blocktagind + s:nextrel * indentunit
|
||||
endif
|
||||
call extend(b:indent, s:newstate, "force")
|
||||
return indent
|
||||
else
|
||||
" block continues
|
||||
" indent this line with alien method
|
||||
let indent = s:Alien{b:indent.block}()
|
||||
call extend(b:indent, s:newstate, "force")
|
||||
return indent
|
||||
endif
|
||||
else
|
||||
" not within a block - within usual html
|
||||
" if < 2 then always 0
|
||||
let s:newstate.block = b:indent.block
|
||||
call s:CountITags()
|
||||
if swendtag
|
||||
let indent = b:indent.baseindent + s:curind * indentunit
|
||||
let s:newstate.baseindent = indent + s:nextrel * indentunit
|
||||
else
|
||||
let indent = b:indent.baseindent
|
||||
let s:newstate.baseindent = indent + (s:curind + s:nextrel) * indentunit
|
||||
endif
|
||||
call extend(b:indent, s:newstate, "force")
|
||||
return indent
|
||||
endif
|
||||
|
||||
endfunc "}}}
|
||||
|
||||
" check user settings (first time), clear cpo, Modeline: {{{1
|
||||
|
||||
" DEBUG:
|
||||
com! -nargs=* IndHtmlLocal <args>
|
||||
|
||||
call HtmlIndent_CheckUserSettings()
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim:set fdm=marker ts=8:
|
||||
569
roles/base/files/users/bzoicas/vim/jellybeans.vim
Normal file
569
roles/base/files/users/bzoicas/vim/jellybeans.vim
Normal file
@@ -0,0 +1,569 @@
|
||||
" Vim color file
|
||||
"
|
||||
" " __ _ _ _ "
|
||||
" " \ \ ___| | |_ _| |__ ___ __ _ _ __ ___ "
|
||||
" " \ \/ _ \ | | | | | _ \ / _ \/ _ | _ \/ __| "
|
||||
" " /\_/ / __/ | | |_| | |_| | __/ |_| | | | \__ \ "
|
||||
" " \___/ \___|_|_|\__ |____/ \___|\____|_| |_|___/ "
|
||||
" " \___/ "
|
||||
"
|
||||
" "A colorful, dark color scheme for Vim."
|
||||
"
|
||||
" File: jellybeans.vim
|
||||
" URL: github.com/nanotech/jellybeans.vim
|
||||
" Scripts URL: vim.org/scripts/script.php?script_id=2555
|
||||
" Maintainer: NanoTech (nanotech.nanotechcorp.net)
|
||||
" Version: 1.6~git
|
||||
" Last Change: January 15th, 2012
|
||||
" License: MIT
|
||||
" Contributors: Daniel Herbert (pocketninja)
|
||||
" Henry So, Jr. <henryso@panix.com>
|
||||
" David Liang <bmdavll at gmail dot com>
|
||||
" Rich Healey (richo)
|
||||
" Andrew Wong (w0ng)
|
||||
"
|
||||
" Copyright (c) 2009-2012 NanoTech
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any per‐
|
||||
" son obtaining a copy of this software and associated doc‐
|
||||
" umentation files (the “Software”), to deal in the Soft‐
|
||||
" ware without restriction, including without limitation
|
||||
" the rights to use, copy, modify, merge, publish, distrib‐
|
||||
" ute, sublicense, and/or sell copies of the Software, and
|
||||
" to permit persons to whom the Software is furnished to do
|
||||
" so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice
|
||||
" shall be included in all copies or substantial portions
|
||||
" of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
|
||||
" KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
" THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICU‐
|
||||
" LAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CON‐
|
||||
" TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON‐
|
||||
" NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
" THE SOFTWARE.
|
||||
|
||||
set background=dark
|
||||
|
||||
hi clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let colors_name = "jellybeans"
|
||||
|
||||
if has("gui_running") || &t_Co == 88 || &t_Co == 256
|
||||
let s:low_color = 0
|
||||
else
|
||||
let s:low_color = 1
|
||||
endif
|
||||
|
||||
" Color approximation functions by Henry So, Jr. and David Liang {{{
|
||||
" Added to jellybeans.vim by Daniel Herbert
|
||||
|
||||
" returns an approximate grey index for the given grey level
|
||||
fun! s:grey_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 23
|
||||
return 0
|
||||
elseif a:x < 69
|
||||
return 1
|
||||
elseif a:x < 103
|
||||
return 2
|
||||
elseif a:x < 127
|
||||
return 3
|
||||
elseif a:x < 150
|
||||
return 4
|
||||
elseif a:x < 173
|
||||
return 5
|
||||
elseif a:x < 196
|
||||
return 6
|
||||
elseif a:x < 219
|
||||
return 7
|
||||
elseif a:x < 243
|
||||
return 8
|
||||
else
|
||||
return 9
|
||||
endif
|
||||
else
|
||||
if a:x < 14
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 8) / 10
|
||||
let l:m = (a:x - 8) % 10
|
||||
if l:m < 5
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the actual grey level represented by the grey index
|
||||
fun! s:grey_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 46
|
||||
elseif a:n == 2
|
||||
return 92
|
||||
elseif a:n == 3
|
||||
return 115
|
||||
elseif a:n == 4
|
||||
return 139
|
||||
elseif a:n == 5
|
||||
return 162
|
||||
elseif a:n == 6
|
||||
return 185
|
||||
elseif a:n == 7
|
||||
return 208
|
||||
elseif a:n == 8
|
||||
return 231
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 8 + (a:n * 10)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index for the given grey index
|
||||
fun! s:grey_color(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 9
|
||||
return 79
|
||||
else
|
||||
return 79 + a:n
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 25
|
||||
return 231
|
||||
else
|
||||
return 231 + a:n
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns an approximate color index for the given color level
|
||||
fun! s:rgb_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 69
|
||||
return 0
|
||||
elseif a:x < 172
|
||||
return 1
|
||||
elseif a:x < 230
|
||||
return 2
|
||||
else
|
||||
return 3
|
||||
endif
|
||||
else
|
||||
if a:x < 75
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 55) / 40
|
||||
let l:m = (a:x - 55) % 40
|
||||
if l:m < 20
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the actual color level for the given color index
|
||||
fun! s:rgb_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 139
|
||||
elseif a:n == 2
|
||||
return 205
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 55 + (a:n * 40)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index for the given R/G/B color indices
|
||||
fun! s:rgb_color(x, y, z)
|
||||
if &t_Co == 88
|
||||
return 16 + (a:x * 16) + (a:y * 4) + a:z
|
||||
else
|
||||
return 16 + (a:x * 36) + (a:y * 6) + a:z
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the given R/G/B color levels
|
||||
fun! s:color(r, g, b)
|
||||
" get the closest grey
|
||||
let l:gx = s:grey_number(a:r)
|
||||
let l:gy = s:grey_number(a:g)
|
||||
let l:gz = s:grey_number(a:b)
|
||||
|
||||
" get the closest color
|
||||
let l:x = s:rgb_number(a:r)
|
||||
let l:y = s:rgb_number(a:g)
|
||||
let l:z = s:rgb_number(a:b)
|
||||
|
||||
if l:gx == l:gy && l:gy == l:gz
|
||||
" there are two possibilities
|
||||
let l:dgr = s:grey_level(l:gx) - a:r
|
||||
let l:dgg = s:grey_level(l:gy) - a:g
|
||||
let l:dgb = s:grey_level(l:gz) - a:b
|
||||
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
||||
let l:dr = s:rgb_level(l:gx) - a:r
|
||||
let l:dg = s:rgb_level(l:gy) - a:g
|
||||
let l:db = s:rgb_level(l:gz) - a:b
|
||||
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
|
||||
if l:dgrey < l:drgb
|
||||
" use the grey
|
||||
return s:grey_color(l:gx)
|
||||
else
|
||||
" use the color
|
||||
return s:rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
else
|
||||
" only one possibility
|
||||
return s:rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the 'rrggbb' hex string
|
||||
fun! s:rgb(rgb)
|
||||
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
|
||||
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
|
||||
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
|
||||
return s:color(l:r, l:g, l:b)
|
||||
endfun
|
||||
|
||||
" sets the highlighting for the given group
|
||||
fun! s:X(group, fg, bg, attr, lcfg, lcbg)
|
||||
if s:low_color
|
||||
let l:fge = empty(a:lcfg)
|
||||
let l:bge = empty(a:lcbg)
|
||||
|
||||
if !l:fge && !l:bge
|
||||
exec "hi ".a:group." ctermfg=".a:lcfg." ctermbg=".a:lcbg
|
||||
elseif !l:fge && l:bge
|
||||
exec "hi ".a:group." ctermfg=".a:lcfg." ctermbg=NONE"
|
||||
elseif l:fge && !l:bge
|
||||
exec "hi ".a:group." ctermfg=NONE ctermbg=".a:lcbg
|
||||
endif
|
||||
else
|
||||
let l:fge = empty(a:fg)
|
||||
let l:bge = empty(a:bg)
|
||||
|
||||
if !l:fge && !l:bge
|
||||
exec "hi ".a:group." guifg=#".a:fg." guibg=#".a:bg." ctermfg=".s:rgb(a:fg)." ctermbg=".s:rgb(a:bg)
|
||||
elseif !l:fge && l:bge
|
||||
exec "hi ".a:group." guifg=#".a:fg." guibg=NONE ctermfg=".s:rgb(a:fg)." ctermbg=NONE"
|
||||
elseif l:fge && !l:bge
|
||||
exec "hi ".a:group." guifg=NONE guibg=#".a:bg." ctermfg=NONE ctermbg=".s:rgb(a:bg)
|
||||
endif
|
||||
endif
|
||||
|
||||
if a:attr == ""
|
||||
exec "hi ".a:group." gui=none cterm=none"
|
||||
else
|
||||
let l:noitalic = join(filter(split(a:attr, ","), "v:val !=? 'italic'"), ",")
|
||||
if empty(l:noitalic)
|
||||
let l:noitalic = "none"
|
||||
endif
|
||||
exec "hi ".a:group." gui=".a:attr." cterm=".l:noitalic
|
||||
endif
|
||||
endfun
|
||||
" }}}
|
||||
|
||||
if !exists("g:jellybeans_background_color")
|
||||
let g:jellybeans_background_color = "151515"
|
||||
end
|
||||
|
||||
call s:X("Normal","e8e8d3",g:jellybeans_background_color,"","White","")
|
||||
set background=dark
|
||||
|
||||
if !exists("g:jellybeans_use_lowcolor_black") || g:jellybeans_use_lowcolor_black
|
||||
let s:termBlack = "Black"
|
||||
else
|
||||
let s:termBlack = "Grey"
|
||||
endif
|
||||
|
||||
if version >= 700
|
||||
call s:X("CursorLine","","1c1c1c","","",s:termBlack)
|
||||
call s:X("CursorColumn","","1c1c1c","","",s:termBlack)
|
||||
call s:X("MatchParen","ffffff","556779","bold","","DarkCyan")
|
||||
|
||||
call s:X("TabLine","000000","b0b8c0","italic","",s:termBlack)
|
||||
call s:X("TabLineFill","9098a0","","","",s:termBlack)
|
||||
call s:X("TabLineSel","000000","f0f0f0","italic,bold",s:termBlack,"White")
|
||||
|
||||
" Auto-completion
|
||||
call s:X("Pmenu","ffffff","606060","","White",s:termBlack)
|
||||
call s:X("PmenuSel","101010","eeeeee","",s:termBlack,"White")
|
||||
endif
|
||||
|
||||
call s:X("Visual","","404040","","",s:termBlack)
|
||||
call s:X("Cursor",g:jellybeans_background_color,"b0d0f0","","","")
|
||||
|
||||
call s:X("LineNr","605958",g:jellybeans_background_color,"none",s:termBlack,"")
|
||||
call s:X("CursorLineNr","ccc5c4","","none","White","")
|
||||
call s:X("Comment","888888","","italic","Grey","")
|
||||
call s:X("Todo","c7c7c7","","bold","White",s:termBlack)
|
||||
|
||||
call s:X("StatusLine","000000","dddddd","italic","","White")
|
||||
call s:X("StatusLineNC","ffffff","403c41","italic","White","Black")
|
||||
call s:X("VertSplit","777777","403c41","",s:termBlack,s:termBlack)
|
||||
call s:X("WildMenu","f0a0c0","302028","","Magenta","")
|
||||
|
||||
call s:X("Folded","a0a8b0","384048","italic",s:termBlack,"")
|
||||
call s:X("FoldColumn","535D66","1f1f1f","","",s:termBlack)
|
||||
call s:X("SignColumn","777777","333333","","",s:termBlack)
|
||||
call s:X("ColorColumn","","000000","","",s:termBlack)
|
||||
|
||||
call s:X("Title","70b950","","bold","Green","")
|
||||
|
||||
call s:X("Constant","cf6a4c","","","Red","")
|
||||
call s:X("Special","799d6a","","","Green","")
|
||||
call s:X("Delimiter","668799","","","Grey","")
|
||||
|
||||
call s:X("String","99ad6a","","","Green","")
|
||||
call s:X("StringDelimiter","556633","","","DarkGreen","")
|
||||
|
||||
call s:X("Identifier","c6b6ee","","","LightCyan","")
|
||||
call s:X("Structure","8fbfdc","","","LightCyan","")
|
||||
call s:X("Function","fad07a","","","Yellow","")
|
||||
call s:X("Statement","8197bf","","","DarkBlue","")
|
||||
call s:X("PreProc","8fbfdc","","","LightBlue","")
|
||||
|
||||
hi! link Operator Structure
|
||||
|
||||
call s:X("Type","ffb964","","","Yellow","")
|
||||
call s:X("NonText","606060",g:jellybeans_background_color,"",s:termBlack,"")
|
||||
|
||||
call s:X("SpecialKey","444444","1c1c1c","",s:termBlack,"")
|
||||
|
||||
call s:X("Search","f0a0c0","302028","underline","Magenta","")
|
||||
|
||||
call s:X("Directory","dad085","","","Yellow","")
|
||||
call s:X("ErrorMsg","","902020","","","DarkRed")
|
||||
hi! link Error ErrorMsg
|
||||
hi! link MoreMsg Special
|
||||
call s:X("Question","65C254","","","Green","")
|
||||
|
||||
|
||||
" Spell Checking
|
||||
|
||||
call s:X("SpellBad","","902020","underline","","DarkRed")
|
||||
call s:X("SpellCap","","0000df","underline","","Blue")
|
||||
call s:X("SpellRare","","540063","underline","","DarkMagenta")
|
||||
call s:X("SpellLocal","","2D7067","underline","","Green")
|
||||
|
||||
" Diff
|
||||
|
||||
hi! link diffRemoved Constant
|
||||
hi! link diffAdded String
|
||||
|
||||
" VimDiff
|
||||
|
||||
call s:X("DiffAdd","D2EBBE","437019","","White","DarkGreen")
|
||||
call s:X("DiffDelete","40000A","700009","","DarkRed","DarkRed")
|
||||
call s:X("DiffChange","","2B5B77","","White","DarkBlue")
|
||||
call s:X("DiffText","8fbfdc","000000","reverse","Yellow","")
|
||||
|
||||
" PHP
|
||||
|
||||
hi! link phpFunctions Function
|
||||
call s:X("StorageClass","c59f6f","","","Red","")
|
||||
hi! link phpSuperglobal Identifier
|
||||
hi! link phpQuoteSingle StringDelimiter
|
||||
hi! link phpQuoteDouble StringDelimiter
|
||||
hi! link phpBoolean Constant
|
||||
hi! link phpNull Constant
|
||||
hi! link phpArrayPair Operator
|
||||
hi! link phpOperator Normal
|
||||
hi! link phpRelation Normal
|
||||
hi! link phpVarSelector Identifier
|
||||
|
||||
" Python
|
||||
|
||||
hi! link pythonOperator Statement
|
||||
|
||||
" Ruby
|
||||
|
||||
hi! link rubySharpBang Comment
|
||||
call s:X("rubyClass","447799","","","DarkBlue","")
|
||||
call s:X("rubyIdentifier","c6b6fe","","","Cyan","")
|
||||
hi! link rubyConstant Type
|
||||
hi! link rubyFunction Function
|
||||
|
||||
call s:X("rubyInstanceVariable","c6b6fe","","","Cyan","")
|
||||
call s:X("rubySymbol","7697d6","","","Blue","")
|
||||
hi! link rubyGlobalVariable rubyInstanceVariable
|
||||
hi! link rubyModule rubyClass
|
||||
call s:X("rubyControl","7597c6","","","Blue","")
|
||||
|
||||
hi! link rubyString String
|
||||
hi! link rubyStringDelimiter StringDelimiter
|
||||
hi! link rubyInterpolationDelimiter Identifier
|
||||
|
||||
call s:X("rubyRegexpDelimiter","540063","","","Magenta","")
|
||||
call s:X("rubyRegexp","dd0093","","","DarkMagenta","")
|
||||
call s:X("rubyRegexpSpecial","a40073","","","Magenta","")
|
||||
|
||||
call s:X("rubyPredefinedIdentifier","de5577","","","Red","")
|
||||
|
||||
" Erlang
|
||||
|
||||
hi! link erlangAtom rubySymbol
|
||||
hi! link erlangBIF rubyPredefinedIdentifier
|
||||
hi! link erlangFunction rubyPredefinedIdentifier
|
||||
hi! link erlangDirective Statement
|
||||
hi! link erlangNode Identifier
|
||||
|
||||
" JavaScript
|
||||
|
||||
hi! link javaScriptValue Constant
|
||||
hi! link javaScriptRegexpString rubyRegexp
|
||||
|
||||
" CoffeeScript
|
||||
|
||||
hi! link coffeeRegExp javaScriptRegexpString
|
||||
|
||||
" Lua
|
||||
|
||||
hi! link luaOperator Conditional
|
||||
|
||||
" C
|
||||
|
||||
hi! link cFormat Identifier
|
||||
hi! link cOperator Constant
|
||||
|
||||
" Objective-C/Cocoa
|
||||
|
||||
hi! link objcClass Type
|
||||
hi! link cocoaClass objcClass
|
||||
hi! link objcSubclass objcClass
|
||||
hi! link objcSuperclass objcClass
|
||||
hi! link objcDirective rubyClass
|
||||
hi! link objcStatement Constant
|
||||
hi! link cocoaFunction Function
|
||||
hi! link objcMethodName Identifier
|
||||
hi! link objcMethodArg Normal
|
||||
hi! link objcMessageName Identifier
|
||||
|
||||
" Vimscript
|
||||
|
||||
hi! link vimOper Normal
|
||||
|
||||
" HTML
|
||||
|
||||
hi! link htmlTag Statement
|
||||
hi! link htmlEndTag htmlTag
|
||||
hi! link htmlTagName htmlTag
|
||||
|
||||
" XML
|
||||
|
||||
hi! link xmlTag Statement
|
||||
hi! link xmlEndTag xmlTag
|
||||
hi! link xmlTagName xmlTag
|
||||
hi! link xmlEqual xmlTag
|
||||
hi! link xmlEntity Special
|
||||
hi! link xmlEntityPunct xmlEntity
|
||||
hi! link xmlDocTypeDecl PreProc
|
||||
hi! link xmlDocTypeKeyword PreProc
|
||||
hi! link xmlProcessingDelim xmlAttrib
|
||||
|
||||
" Debugger.vim
|
||||
|
||||
call s:X("DbgCurrent","DEEBFE","345FA8","","White","DarkBlue")
|
||||
call s:X("DbgBreakPt","","4F0037","","","DarkMagenta")
|
||||
|
||||
" vim-indent-guides
|
||||
|
||||
if !exists("g:indent_guides_auto_colors")
|
||||
let g:indent_guides_auto_colors = 0
|
||||
endif
|
||||
call s:X("IndentGuidesOdd","","232323","","","")
|
||||
call s:X("IndentGuidesEven","","1b1b1b","","","")
|
||||
|
||||
" Plugins, etc.
|
||||
|
||||
hi! link TagListFileName Directory
|
||||
call s:X("PreciseJumpTarget","B9ED67","405026","","White","Green")
|
||||
|
||||
if !exists("g:jellybeans_background_color_256")
|
||||
let g:jellybeans_background_color_256=233
|
||||
end
|
||||
" Manual overrides for 256-color terminals. Dark colors auto-map badly.
|
||||
if !s:low_color
|
||||
hi StatusLineNC ctermbg=235
|
||||
hi Folded ctermbg=236
|
||||
hi FoldColumn ctermbg=234
|
||||
hi SignColumn ctermbg=236
|
||||
hi CursorColumn ctermbg=234
|
||||
hi CursorLine ctermbg=234
|
||||
hi SpecialKey ctermbg=234
|
||||
exec "hi NonText ctermbg=".g:jellybeans_background_color_256
|
||||
exec "hi LineNr ctermbg=".g:jellybeans_background_color_256
|
||||
hi DiffText ctermfg=81
|
||||
exec "hi Normal ctermbg=".g:jellybeans_background_color_256
|
||||
hi DbgBreakPt ctermbg=53
|
||||
hi IndentGuidesOdd ctermbg=235
|
||||
hi IndentGuidesEven ctermbg=234
|
||||
endif
|
||||
|
||||
if exists("g:jellybeans_overrides")
|
||||
fun! s:load_colors(defs)
|
||||
for [l:group, l:v] in items(a:defs)
|
||||
call s:X(l:group, get(l:v, 'guifg', ''), get(l:v, 'guibg', ''),
|
||||
\ get(l:v, 'attr', ''),
|
||||
\ get(l:v, 'ctermfg', ''), get(l:v, 'ctermbg', ''))
|
||||
if !s:low_color
|
||||
for l:prop in ['ctermfg', 'ctermbg']
|
||||
let l:override_key = '256'.l:prop
|
||||
if has_key(l:v, l:override_key)
|
||||
exec "hi ".l:group." ".l:prop."=".l:v[l:override_key]
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
unlet l:group
|
||||
unlet l:v
|
||||
endfor
|
||||
endfun
|
||||
call s:load_colors(g:jellybeans_overrides)
|
||||
delf s:load_colors
|
||||
endif
|
||||
|
||||
" delete functions {{{
|
||||
delf s:X
|
||||
delf s:rgb
|
||||
delf s:color
|
||||
delf s:rgb_color
|
||||
delf s:rgb_level
|
||||
delf s:rgb_number
|
||||
delf s:grey_color
|
||||
delf s:grey_level
|
||||
delf s:grey_number
|
||||
" }}}
|
||||
353
roles/base/files/users/bzoicas/vim/pathogen.vim
Normal file
353
roles/base/files/users/bzoicas/vim/pathogen.vim
Normal file
@@ -0,0 +1,353 @@
|
||||
" pathogen.vim - path option manipulation
|
||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||
" Version: 2.4
|
||||
|
||||
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
|
||||
"
|
||||
" For management of individually installed plugins in ~/.vim/bundle (or
|
||||
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
|
||||
" .vimrc is the only other setup necessary.
|
||||
"
|
||||
" The API is documented inline below.
|
||||
|
||||
if exists("g:loaded_pathogen") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_pathogen = 1
|
||||
|
||||
" Point of entry for basic default usage. Give a relative path to invoke
|
||||
" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke
|
||||
" pathogen#surround(). Curly braces are expanded with pathogen#expand():
|
||||
" "bundle/{}" finds all subdirectories inside "bundle" inside all directories
|
||||
" in the runtime path.
|
||||
function! pathogen#infect(...) abort
|
||||
for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
|
||||
if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
|
||||
call pathogen#surround(path)
|
||||
elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'
|
||||
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
||||
call pathogen#surround(path . '/{}')
|
||||
elseif path =~# '[{}*]'
|
||||
call pathogen#interpose(path)
|
||||
else
|
||||
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
||||
call pathogen#interpose(path . '/{}')
|
||||
endif
|
||||
endfor
|
||||
call pathogen#cycle_filetype()
|
||||
if pathogen#is_disabled($MYVIMRC)
|
||||
return 'finish'
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Split a path into a list.
|
||||
function! pathogen#split(path) abort
|
||||
if type(a:path) == type([]) | return a:path | endif
|
||||
if empty(a:path) | return [] | endif
|
||||
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
|
||||
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
|
||||
endfunction
|
||||
|
||||
" Convert a list to a path.
|
||||
function! pathogen#join(...) abort
|
||||
if type(a:1) == type(1) && a:1
|
||||
let i = 1
|
||||
let space = ' '
|
||||
else
|
||||
let i = 0
|
||||
let space = ''
|
||||
endif
|
||||
let path = ""
|
||||
while i < a:0
|
||||
if type(a:000[i]) == type([])
|
||||
let list = a:000[i]
|
||||
let j = 0
|
||||
while j < len(list)
|
||||
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
|
||||
let path .= ',' . escaped
|
||||
let j += 1
|
||||
endwhile
|
||||
else
|
||||
let path .= "," . a:000[i]
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
return substitute(path,'^,','','')
|
||||
endfunction
|
||||
|
||||
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
|
||||
function! pathogen#legacyjoin(...) abort
|
||||
return call('pathogen#join',[1] + a:000)
|
||||
endfunction
|
||||
|
||||
" Turn filetype detection off and back on again if it was already enabled.
|
||||
function! pathogen#cycle_filetype() abort
|
||||
if exists('g:did_load_filetypes')
|
||||
filetype off
|
||||
filetype on
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Check if a bundle is disabled. A bundle is considered disabled if its
|
||||
" basename or full name is included in the list g:pathogen_blacklist or the
|
||||
" comma delimited environment variable $VIMBLACKLIST.
|
||||
function! pathogen#is_disabled(path) abort
|
||||
if a:path =~# '\~$'
|
||||
return 1
|
||||
endif
|
||||
let sep = pathogen#slash()
|
||||
let blacklist =
|
||||
\ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
|
||||
\ pathogen#split($VIMBLACKLIST)
|
||||
if !empty(blacklist)
|
||||
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
|
||||
endif
|
||||
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
|
||||
endfunction
|
||||
|
||||
" Prepend the given directory to the runtime path and append its corresponding
|
||||
" after directory. Curly braces are expanded with pathogen#expand().
|
||||
function! pathogen#surround(path) abort
|
||||
let sep = pathogen#slash()
|
||||
let rtp = pathogen#split(&rtp)
|
||||
let path = fnamemodify(a:path, ':s?[\\/]\=$??')
|
||||
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
|
||||
let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
|
||||
call filter(rtp, 'index(before + after, v:val) == -1')
|
||||
let &rtp = pathogen#join(before, rtp, after)
|
||||
return &rtp
|
||||
endfunction
|
||||
|
||||
" For each directory in the runtime path, add a second entry with the given
|
||||
" argument appended. Curly braces are expanded with pathogen#expand().
|
||||
function! pathogen#interpose(name) abort
|
||||
let sep = pathogen#slash()
|
||||
let name = a:name
|
||||
if has_key(s:done_bundles, name)
|
||||
return ""
|
||||
endif
|
||||
let s:done_bundles[name] = 1
|
||||
let list = []
|
||||
for dir in pathogen#split(&rtp)
|
||||
if dir =~# '\<after$'
|
||||
let list += reverse(filter(pathogen#expand(dir[0:-6].name, sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
|
||||
else
|
||||
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
|
||||
endif
|
||||
endfor
|
||||
let &rtp = pathogen#join(pathogen#uniq(list))
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
let s:done_bundles = {}
|
||||
|
||||
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
|
||||
function! pathogen#helptags() abort
|
||||
let sep = pathogen#slash()
|
||||
for glob in pathogen#split(&rtp)
|
||||
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
|
||||
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
|
||||
silent! execute 'helptags' pathogen#fnameescape(dir)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
command! -bar Helptags :call pathogen#helptags()
|
||||
|
||||
" Execute the given command. This is basically a backdoor for --remote-expr.
|
||||
function! pathogen#execute(...) abort
|
||||
for command in a:000
|
||||
execute command
|
||||
endfor
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Section: Unofficial
|
||||
|
||||
function! pathogen#is_absolute(path) abort
|
||||
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
|
||||
endfunction
|
||||
|
||||
" Given a string, returns all possible permutations of comma delimited braced
|
||||
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
|
||||
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
|
||||
" and globbed. Actual globs are preserved.
|
||||
function! pathogen#expand(pattern, ...) abort
|
||||
let after = a:0 ? a:1 : ''
|
||||
if a:pattern =~# '{[^{}]\+}'
|
||||
let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
|
||||
let found = map(split(pat, ',', 1), 'pre.v:val.post')
|
||||
let results = []
|
||||
for pattern in found
|
||||
call extend(results, pathogen#expand(pattern))
|
||||
endfor
|
||||
elseif a:pattern =~# '{}'
|
||||
let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)')
|
||||
let post = a:pattern[strlen(pat) : -1]
|
||||
let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
|
||||
else
|
||||
let results = [a:pattern]
|
||||
endif
|
||||
let vf = pathogen#slash() . 'vimfiles'
|
||||
call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
|
||||
return filter(results, '!empty(v:val)')
|
||||
endfunction
|
||||
|
||||
" \ on Windows unless shellslash is set, / everywhere else.
|
||||
function! pathogen#slash() abort
|
||||
return !exists("+shellslash") || &shellslash ? '/' : '\'
|
||||
endfunction
|
||||
|
||||
function! pathogen#separator() abort
|
||||
return pathogen#slash()
|
||||
endfunction
|
||||
|
||||
" Convenience wrapper around glob() which returns a list.
|
||||
function! pathogen#glob(pattern) abort
|
||||
let files = split(glob(a:pattern),"\n")
|
||||
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
|
||||
endfunction
|
||||
|
||||
" Like pathogen#glob(), only limit the results to directories.
|
||||
function! pathogen#glob_directories(pattern) abort
|
||||
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
||||
endfunction
|
||||
|
||||
" Remove duplicates from a list.
|
||||
function! pathogen#uniq(list) abort
|
||||
let i = 0
|
||||
let seen = {}
|
||||
while i < len(a:list)
|
||||
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
|
||||
call remove(a:list,i)
|
||||
elseif a:list[i] ==# ''
|
||||
let i += 1
|
||||
let empty = 1
|
||||
else
|
||||
let seen[a:list[i]] = 1
|
||||
let i += 1
|
||||
endif
|
||||
endwhile
|
||||
return a:list
|
||||
endfunction
|
||||
|
||||
" Backport of fnameescape().
|
||||
function! pathogen#fnameescape(string) abort
|
||||
if exists('*fnameescape')
|
||||
return fnameescape(a:string)
|
||||
elseif a:string ==# '-'
|
||||
return '\-'
|
||||
else
|
||||
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Like findfile(), but hardcoded to use the runtimepath.
|
||||
function! pathogen#runtime_findfile(file,count) abort
|
||||
let rtp = pathogen#join(1,pathogen#split(&rtp))
|
||||
let file = findfile(a:file,rtp,a:count)
|
||||
if file ==# ''
|
||||
return ''
|
||||
else
|
||||
return fnamemodify(file,':p')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Section: Deprecated
|
||||
|
||||
function! s:warn(msg) abort
|
||||
echohl WarningMsg
|
||||
echomsg a:msg
|
||||
echohl NONE
|
||||
endfunction
|
||||
|
||||
" Prepend all subdirectories of path to the rtp, and append all 'after'
|
||||
" directories in those subdirectories. Deprecated.
|
||||
function! pathogen#runtime_prepend_subdirectories(path) abort
|
||||
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
|
||||
return pathogen#surround(a:path . pathogen#slash() . '{}')
|
||||
endfunction
|
||||
|
||||
function! pathogen#incubate(...) abort
|
||||
let name = a:0 ? a:1 : 'bundle/{}'
|
||||
call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
|
||||
return pathogen#interpose(name)
|
||||
endfunction
|
||||
|
||||
" Deprecated alias for pathogen#interpose().
|
||||
function! pathogen#runtime_append_all_bundles(...) abort
|
||||
if a:0
|
||||
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
|
||||
else
|
||||
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
|
||||
endif
|
||||
return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
|
||||
endfunction
|
||||
|
||||
if exists(':Vedit')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:vopen_warning = 0
|
||||
|
||||
function! s:find(count,cmd,file,lcd)
|
||||
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
|
||||
let file = pathogen#runtime_findfile(a:file,a:count)
|
||||
if file ==# ''
|
||||
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
|
||||
endif
|
||||
if !s:vopen_warning
|
||||
let s:vopen_warning = 1
|
||||
let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
|
||||
else
|
||||
let warning = ''
|
||||
endif
|
||||
if a:lcd
|
||||
let path = file[0:-strlen(a:file)-2]
|
||||
execute 'lcd `=path`'
|
||||
return a:cmd.' '.pathogen#fnameescape(a:file) . warning
|
||||
else
|
||||
return a:cmd.' '.pathogen#fnameescape(file) . warning
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:Findcomplete(A,L,P)
|
||||
let sep = pathogen#slash()
|
||||
let cheats = {
|
||||
\'a': 'autoload',
|
||||
\'d': 'doc',
|
||||
\'f': 'ftplugin',
|
||||
\'i': 'indent',
|
||||
\'p': 'plugin',
|
||||
\'s': 'syntax'}
|
||||
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
|
||||
let request = cheats[a:A[0]].a:A[1:-1]
|
||||
else
|
||||
let request = a:A
|
||||
endif
|
||||
let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
|
||||
let found = {}
|
||||
for path in pathogen#split(&runtimepath)
|
||||
let path = expand(path, ':p')
|
||||
let matches = split(glob(path.sep.pattern),"\n")
|
||||
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
|
||||
call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
|
||||
for match in matches
|
||||
let found[match] = 1
|
||||
endfor
|
||||
endfor
|
||||
return sort(keys(found))
|
||||
endfunction
|
||||
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
|
||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
|
||||
|
||||
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':
|
||||
89
roles/base/files/users/bzoicas/vim/perl.vim
Normal file
89
roles/base/files/users/bzoicas/vim/perl.vim
Normal file
@@ -0,0 +1,89 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Perl
|
||||
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||
" Homepage: http://github.com/vim-perl/vim-perl
|
||||
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||
" Last Change: {{LAST_CHANGE}}
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
" Make sure the continuation lines below do not cause problems in
|
||||
" compatibility mode.
|
||||
let s:save_cpo = &cpo
|
||||
set cpo-=C
|
||||
|
||||
setlocal formatoptions-=t
|
||||
setlocal formatoptions+=crqol
|
||||
setlocal keywordprg=perldoc\ -f
|
||||
|
||||
setlocal comments=:#
|
||||
setlocal commentstring=#%s
|
||||
|
||||
" Change the browse dialog on Win32 to show mainly Perl-related files
|
||||
if has("gui_win32")
|
||||
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
|
||||
\ "Perl Modules (*.pm)\t*.pm\n" .
|
||||
\ "Perl Documentation Files (*.pod)\t*.pod\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
|
||||
" Provided by Ned Konz <ned at bike-nomad dot com>
|
||||
"---------------------------------------------
|
||||
setlocal include=\\<\\(use\\\|require\\)\\>
|
||||
setlocal includeexpr=substitute(substitute(substitute(v:fname,'::','/','g'),'->\*','',''),'$','.pm','')
|
||||
setlocal define=[^A-Za-z_]
|
||||
setlocal iskeyword+=:
|
||||
|
||||
" The following line changes a global variable but is necessary to make
|
||||
" gf and similar commands work. Thanks to Andrew Pimlott for pointing
|
||||
" out the problem. If this causes a problem for you, add an
|
||||
" after/ftplugin/perl.vim file that contains
|
||||
" set isfname-=:
|
||||
set isfname+=:
|
||||
|
||||
" Set this once, globally.
|
||||
if !exists("perlpath")
|
||||
if executable("perl")
|
||||
try
|
||||
if &shellxquote != '"'
|
||||
let perlpath = system('perl -e "print join(q/,/,@INC)"')
|
||||
else
|
||||
let perlpath = system("perl -e 'print join(q/,/,@INC)'")
|
||||
endif
|
||||
let perlpath = substitute(perlpath,',.$',',,','')
|
||||
catch /E145:/
|
||||
let perlpath = ".,,"
|
||||
endtry
|
||||
else
|
||||
" If we can't call perl to get its path, just default to using the
|
||||
" current directory and the directory of the current file.
|
||||
let perlpath = ".,,"
|
||||
endif
|
||||
endif
|
||||
|
||||
" Append perlpath to the existing path value, if it is set. Since we don't
|
||||
" use += to do it because of the commas in perlpath, we have to handle the
|
||||
" global / local settings, too.
|
||||
if &l:path == ""
|
||||
if &g:path == ""
|
||||
let &l:path=perlpath
|
||||
else
|
||||
let &l:path=&g:path.",".perlpath
|
||||
endif
|
||||
else
|
||||
let &l:path=&l:path.",".perlpath
|
||||
endif
|
||||
"---------------------------------------------
|
||||
|
||||
" Undo the stuff we changed.
|
||||
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk< isf< kp< path<" .
|
||||
\ " | unlet! b:browsefilter"
|
||||
|
||||
" proper matching for matchit plugin
|
||||
let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField'
|
||||
let b:match_words = '\<if\>:\<elsif\>:\<else\>'
|
||||
|
||||
" Restore the saved compatibility options.
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
9
roles/base/files/users/bzoicas/vim/python.vim
Normal file
9
roles/base/files/users/bzoicas/vim/python.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
setlocal tabstop=4
|
||||
setlocal softtabstop=4
|
||||
setlocal shiftwidth=4
|
||||
" setlocal textwidth=80
|
||||
setlocal smarttab
|
||||
setlocal expandtab
|
||||
|
||||
" Highlight long lines
|
||||
match ErrorMsg '\%>79v.\+'
|
||||
67
roles/base/files/users/bzoicas/vim/ruby.vim
Normal file
67
roles/base/files/users/bzoicas/vim/ruby.vim
Normal file
@@ -0,0 +1,67 @@
|
||||
" Vim indent file
|
||||
" Language: Ruby
|
||||
" Maintainer: Gavin Sinclair <gsinclair@soyabean.com.au>
|
||||
" Last Change: 2002/08/14
|
||||
" URL: www.soyabean.com.au/gavin/vim/index.html
|
||||
" Changes: (since vim 6.1)
|
||||
" - indentation after a line ending in comma, etc, (even in a comment) was
|
||||
" broken, now fixed (2002/08/14)
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetRubyIndent()
|
||||
setlocal nolisp
|
||||
setlocal nosmartindent
|
||||
setlocal autoindent
|
||||
setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetRubyIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function GetRubyIndent()
|
||||
" Find a non-blank line above the current line.
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
|
||||
" At the start of the file use zero indent.
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" If the line trailed with [*+,.(] - but not in a comment - trust the user
|
||||
if getline(lnum) =~ '\(\[^#\].*\)?\(\*\|\.\|+\|,\|(\)\(\s*#.*\)\=$'
|
||||
return -1
|
||||
endif
|
||||
|
||||
" Add a 'shiftwidth' after lines beginning with:
|
||||
" module, class, dev, if, for, while, until, else, elsif, case, when, {
|
||||
let ind = indent(lnum)
|
||||
let flag = 0
|
||||
if getline(lnum) =~ '^\s*\(module\>\|class\>\|def\>\|if\>\|for\>\|while\>\|until\>\|else\>\|elsif\>\|case\>\|when\>\|unless\|begin\|ensure\>\|rescue\>\)'
|
||||
\ || getline(lnum) =~ '{\s*$'
|
||||
\ || getline(lnum) =~ '\({\|\<do\>\).*|.*|\s*$'
|
||||
\ || getline(lnum) =~ '\<do\>\(\s*#.*\)\=$'
|
||||
let ind = ind + &sw
|
||||
let flag = 1
|
||||
endif
|
||||
|
||||
" Subtract a 'shiftwidth' after lines ending with
|
||||
" "end" when they begin with while, if, for, until
|
||||
if flag == 1 && getline(lnum) =~ '\<end\>\(\s*#.*\)\=$'
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
|
||||
" Subtract a 'shiftwidth' on end, else and, elsif, when and }
|
||||
if getline(v:lnum) =~ '^\s*\(end\>\|else\>\|elsif\>\|when\>\|ensure\>\|rescue\>\|}\)'
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
" vim:sw=2
|
||||
3
roles/base/files/users/bzoicas/vim/sql.vim
Normal file
3
roles/base/files/users/bzoicas/vim/sql.vim
Normal file
@@ -0,0 +1,3 @@
|
||||
let g:sql_type_default = 'mysql'
|
||||
setlocal omnifunc=sqlcomplete#Complete
|
||||
|
||||
180
roles/base/files/users/bzoicas/vim/vimrc
Normal file
180
roles/base/files/users/bzoicas/vim/vimrc
Normal file
@@ -0,0 +1,180 @@
|
||||
" Disable annoying beep sound
|
||||
set vb
|
||||
|
||||
" Set color scheme. Other good ones are bubblegum-256-dark, sorcerer, and zenburn
|
||||
colorscheme xoria256
|
||||
|
||||
" ansible-vim: set indent to 0 after two newlines in insert-mode
|
||||
let g:ansible_unindent_after_newline = 1
|
||||
|
||||
" ansible-vim settings
|
||||
let g:ansible_attribute_highlight = "od"
|
||||
let g:ansible_name_highlight = 'b'
|
||||
let g:ansible_extra_keywords_highlight = 1
|
||||
let g:ansible_normal_keywords_highlight = 'Constant'
|
||||
let g:ansible_with_keywords_highlight = 'Constant'
|
||||
|
||||
" CtrlP Shortcuts
|
||||
noremap <leader>b :CtrlPBuffer<CR>
|
||||
noremap <leader>p :CtrlP<CR>
|
||||
noremap <leader>P :CtrlPClearCache<CR>:CtrlP<CR>
|
||||
|
||||
noremap <c-b> :LeaderfBuffer<CR>
|
||||
noremap <c-f> :LeaderfFile<CR>
|
||||
|
||||
" NERDTree Shortcuts
|
||||
silent! map <F2> :NERDTreeToggle<CR>
|
||||
silent! map <F3> :NERDTreeFind<CR>
|
||||
|
||||
" Switch buffers using F4
|
||||
nnoremap <F4> :buffers<CR>:buffer<Space>
|
||||
|
||||
" Refresh vim config with F5
|
||||
noremap <silent> <F5> :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
|
||||
|
||||
" Switch buffers using ctrl+left or ctrl+right
|
||||
map <C-left> <ESC>:bp<CR>
|
||||
map <C-right> <ESC>:bn<CR>
|
||||
|
||||
" Set keyboard shortcut for paste toggle.
|
||||
set pastetoggle=<F10>
|
||||
|
||||
" Move between windows easily
|
||||
noremap <leader><up> :wincmd k<CR>
|
||||
noremap <leader><down> :wincmd j<CR>
|
||||
noremap <leader><left> :wincmd h<CR>
|
||||
noremap <leader><right> :wincmd l<CR>
|
||||
noremap <leader>k :wincmd k<CR>
|
||||
noremap <leader>j :wincmd j<CR>
|
||||
noremap <leader>h :wincmd h<CR>
|
||||
noremap <leader>l :wincmd l<CR>
|
||||
|
||||
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
|
||||
map <space> /
|
||||
map <c-space> ?
|
||||
|
||||
" Clear search highlight with c-l
|
||||
noremap <silent> <c-l> :nohls<cr><c-l>
|
||||
|
||||
" Fix tmux background color
|
||||
if &term =~ '256color'
|
||||
set t_ut=
|
||||
endif
|
||||
|
||||
" Show line numbers
|
||||
set number
|
||||
|
||||
" Enable filetype plugins
|
||||
filetype plugin indent on
|
||||
|
||||
" Enable syntax highlighting
|
||||
syntax on
|
||||
|
||||
" Turn backup off
|
||||
set nobackup
|
||||
set nowb
|
||||
set noswapfile
|
||||
|
||||
" this turns off physical line wrapping (ie: automatic insertion of newlines)
|
||||
set textwidth=0 wrapmargin=0
|
||||
|
||||
" Use spaces instead of tabs
|
||||
set expandtab
|
||||
|
||||
" Be smart when using tabs
|
||||
set smarttab
|
||||
|
||||
" 1 tab == 4 spaces
|
||||
set shiftwidth=4
|
||||
set tabstop=4
|
||||
|
||||
" Ignore case while searching
|
||||
set ignorecase
|
||||
|
||||
" Highlight search results
|
||||
set hlsearch
|
||||
|
||||
" Makes search act like search in modern browsers
|
||||
set incsearch
|
||||
|
||||
" Set utf8 as standard encoding and en_US as the standard language
|
||||
set encoding=utf8
|
||||
|
||||
" Use Unix as the standard file type
|
||||
set ffs=unix,dos,mac
|
||||
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
" Super useful! From an idea by Michael Naumann
|
||||
vnoremap <silent> * :call VisualSelection('f')<CR>
|
||||
vnoremap <silent> # :call VisualSelection('b')<CR>
|
||||
|
||||
" Return to the last edit position when opening files.
|
||||
augroup vimrcEx
|
||||
autocmd!
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal g`\"" |
|
||||
\ endif
|
||||
augroup END
|
||||
|
||||
" Ensure cursor is at the top of the file, if editing a git commit message:
|
||||
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
|
||||
|
||||
" Remember info about open buffers on close
|
||||
set viminfo^=%
|
||||
|
||||
" Returns true if paste mode is enabled
|
||||
function! HasPaste()
|
||||
if &paste
|
||||
return 'PASTE MODE '
|
||||
en
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Always show the status line
|
||||
set laststatus=2
|
||||
|
||||
" Format the status line
|
||||
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
|
||||
|
||||
" in case you forgot to sudo
|
||||
cnoremap w!! %!sudo tee > /dev/null %
|
||||
|
||||
" Set the cursorline
|
||||
set cursorline
|
||||
|
||||
"hi cursorline gui=none
|
||||
augroup CursorlineOnlyInActiveWindow
|
||||
autocmd!
|
||||
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
|
||||
autocmd WinLeave * setlocal nocursorline
|
||||
augroup END
|
||||
|
||||
" Highlight trailing whitespace in red
|
||||
match ErrorMsg /\s\+\%#\@<!$/
|
||||
|
||||
" Enable pathogen
|
||||
execute pathogen#infect()
|
||||
|
||||
" Syntastic
|
||||
let g:syntastic_python_checkers = ['flake8', 'pyflakes']
|
||||
" Disable E501(over 79 chars), W191(tabs instead of space), W391(blank line at
|
||||
" end of file
|
||||
let g:syntastic_python_flake8_args='--ignore=E501'
|
||||
|
||||
" Enable checking of perl files.
|
||||
let g:syntastic_perl_checkers = ['perl']
|
||||
let g:syntastic_enable_perl_checker = 1
|
||||
|
||||
let g:syntastic_check_on_open=1
|
||||
let g:syntastic_enable_signs=1
|
||||
let g:syntastic_enable_highlighting=1
|
||||
let g:syntastic_auto_loc_list=1
|
||||
let g:syntastic_loc_list_height=5
|
||||
|
||||
let g:syntastic_mode_map = { 'mode': 'active',
|
||||
\ 'active_filetypes': ['python', 'javascript', 'css', 'html'],
|
||||
\ 'passive_filetypes': ['make','cpp','c'] }
|
||||
|
||||
" Jedi stuff
|
||||
let g:jedi#use_tabs_not_buffers = 0
|
||||
2
roles/base/files/users/bzoicas/vim/xml.vim
Normal file
2
roles/base/files/users/bzoicas/vim/xml.vim
Normal file
@@ -0,0 +1,2 @@
|
||||
setlocal omnifunc=xmlcomplete#CompleteTags
|
||||
setlocal tabstop=4 softtabstop=4 shiftwidth=4
|
||||
142
roles/base/files/users/bzoicas/vim/xoria256.vim
Normal file
142
roles/base/files/users/bzoicas/vim/xoria256.vim
Normal file
@@ -0,0 +1,142 @@
|
||||
" Vim color file
|
||||
"
|
||||
" Name: xoria256.vim
|
||||
" Version: 1.5
|
||||
" Maintainer: Dmitriy Y. Zotikov (xio) <xio@ungrund.org>
|
||||
"
|
||||
" Should work in recent 256 color terminals. 88-color terms like urxvt are
|
||||
" NOT supported.
|
||||
"
|
||||
" Don't forget to install 'ncurses-term' and set TERM to xterm-256color or
|
||||
" similar value.
|
||||
"
|
||||
" Color numbers (0-255) see:
|
||||
" http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
|
||||
"
|
||||
" For a specific filetype highlighting rules issue :syntax list when a file of
|
||||
" that type is opened.
|
||||
|
||||
" Initialization {{{
|
||||
if &t_Co != 256 && ! has("gui_running")
|
||||
echomsg ""
|
||||
echomsg "err: please use GUI or a 256-color terminal (so that t_Co=256 could be set)"
|
||||
echomsg ""
|
||||
finish
|
||||
endif
|
||||
|
||||
set background=dark
|
||||
|
||||
hi clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let colors_name = "xoria256"
|
||||
"}}}
|
||||
" Colours {{{1
|
||||
"" General {{{2
|
||||
hi Normal ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none
|
||||
hi Cursor ctermbg=214 guibg=#ffaf00
|
||||
hi CursorColumn ctermbg=238 guibg=#444444
|
||||
hi CursorLine ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
hi Error ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
|
||||
hi ErrorMsg ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
|
||||
hi FoldColumn ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
|
||||
hi Folded ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
|
||||
hi IncSearch ctermfg=0 guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none
|
||||
hi LineNr ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
|
||||
hi MatchParen ctermfg=188 guifg=#dfdfdf ctermbg=68 guibg=#5f87df cterm=bold gui=bold
|
||||
" TODO
|
||||
" hi MoreMsg
|
||||
hi NonText ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 cterm=bold gui=bold
|
||||
hi Pmenu ctermfg=0 guifg=#000000 ctermbg=250 guibg=#bcbcbc
|
||||
hi PmenuSel ctermfg=255 guifg=#eeeeee ctermbg=243 guibg=#767676
|
||||
hi PmenuSbar ctermbg=252 guibg=#d0d0d0
|
||||
hi PmenuThumb ctermfg=243 guifg=#767676
|
||||
hi Search ctermfg=0 guifg=#000000 ctermbg=149 guibg=#afdf5f
|
||||
hi SignColumn ctermfg=248 guifg=#a8a8a8
|
||||
hi SpecialKey ctermfg=77 guifg=#5fdf5f
|
||||
hi SpellBad ctermfg=160 guifg=fg ctermbg=bg cterm=underline guisp=#df0000
|
||||
hi SpellCap ctermfg=189 guifg=#dfdfff ctermbg=bg guibg=bg cterm=underline gui=underline
|
||||
hi SpellRare ctermfg=168 guifg=#df5f87 ctermbg=bg guibg=bg cterm=underline gui=underline
|
||||
hi SpellLocal ctermfg=98 guifg=#875fdf ctermbg=bg guibg=bg cterm=underline gui=underline
|
||||
hi StatusLine ctermfg=15 guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold
|
||||
hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
hi TabLine ctermfg=fg guifg=fg ctermbg=242 guibg=#666666 cterm=none gui=none
|
||||
hi TabLineFill ctermfg=fg guifg=fg ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
" FIXME
|
||||
hi Title ctermfg=225 guifg=#ffdfff
|
||||
hi Todo ctermfg=0 guifg=#000000 ctermbg=184 guibg=#dfdf00
|
||||
hi Underlined ctermfg=39 guifg=#00afff cterm=underline gui=underline
|
||||
hi VertSplit ctermfg=237 guifg=#3a3a3a ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
" hi VIsualNOS ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff cterm=none gui=none
|
||||
" hi Visual ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff
|
||||
hi Visual ctermfg=255 guifg=#eeeeee ctermbg=96 guibg=#875f87
|
||||
" hi Visual ctermfg=255 guifg=#eeeeee ctermbg=24 guibg=#005f87
|
||||
hi VisualNOS ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
|
||||
hi WildMenu ctermfg=0 guifg=#000000 ctermbg=150 guibg=#afdf87 cterm=bold gui=bold
|
||||
|
||||
"" Syntax highlighting {{{2
|
||||
hi Comment ctermfg=244 guifg=#808080
|
||||
hi Constant ctermfg=229 guifg=#ffffaf
|
||||
hi Identifier ctermfg=182 guifg=#dfafdf cterm=none
|
||||
hi Ignore ctermfg=238 guifg=#444444
|
||||
hi Number ctermfg=180 guifg=#dfaf87
|
||||
hi PreProc ctermfg=150 guifg=#afdf87
|
||||
hi Special ctermfg=174 guifg=#df8787
|
||||
hi Statement ctermfg=110 guifg=#87afdf cterm=none gui=none
|
||||
hi Type ctermfg=146 guifg=#afafdf cterm=none gui=none
|
||||
|
||||
"" Special {{{2
|
||||
""" .diff {{{3
|
||||
hi diffAdded ctermfg=150 guifg=#afdf87
|
||||
hi diffRemoved ctermfg=174 guifg=#df8787
|
||||
""" vimdiff {{{3
|
||||
hi diffAdd ctermfg=bg guifg=bg ctermbg=151 guibg=#afdfaf
|
||||
"hi diffDelete ctermfg=bg guifg=bg ctermbg=186 guibg=#dfdf87 cterm=none gui=none
|
||||
hi diffDelete ctermfg=bg guifg=bg ctermbg=246 guibg=#949494 cterm=none gui=none
|
||||
hi diffChange ctermfg=bg guifg=bg ctermbg=181 guibg=#dfafaf
|
||||
hi diffText ctermfg=bg guifg=bg ctermbg=174 guibg=#df8787 cterm=none gui=none
|
||||
""" HTML {{{3
|
||||
" hi htmlTag ctermfg=146 guifg=#afafdf
|
||||
" hi htmlEndTag ctermfg=146 guifg=#afafdf
|
||||
hi htmlTag ctermfg=244
|
||||
hi htmlEndTag ctermfg=244
|
||||
hi htmlArg ctermfg=182 guifg=#dfafdf
|
||||
hi htmlValue ctermfg=187 guifg=#dfdfaf
|
||||
hi htmlTitle ctermfg=254 ctermbg=95
|
||||
" hi htmlArg ctermfg=146
|
||||
" hi htmlTagName ctermfg=146
|
||||
" hi htmlString ctermfg=187
|
||||
""" django {{{3
|
||||
hi djangoVarBlock ctermfg=180
|
||||
hi djangoTagBlock ctermfg=150
|
||||
hi djangoStatement ctermfg=146
|
||||
hi djangoFilter ctermfg=174
|
||||
""" python {{{3
|
||||
hi pythonExceptions ctermfg=174
|
||||
""" NERDTree {{{3
|
||||
hi Directory ctermfg=110 guifg=#87afdf
|
||||
hi treeCWD ctermfg=180 guifg=#dfaf87
|
||||
hi treeClosable ctermfg=174 guifg=#df8787
|
||||
hi treeOpenable ctermfg=150 guifg=#afdf87
|
||||
hi treePart ctermfg=244 guifg=#808080
|
||||
hi treeDirSlash ctermfg=244 guifg=#808080
|
||||
hi treeLink ctermfg=182 guifg=#dfafdf
|
||||
|
||||
""" VimDebug {{{3
|
||||
" FIXME
|
||||
" you may want to set SignColumn highlight in your .vimrc
|
||||
" :help sign
|
||||
" :help SignColumn
|
||||
|
||||
" hi currentLine term=reverse cterm=reverse gui=reverse
|
||||
" hi breakPoint term=NONE cterm=NONE gui=NONE
|
||||
" hi empty term=NONE cterm=NONE gui=NONE
|
||||
|
||||
" sign define currentLine linehl=currentLine
|
||||
" sign define breakPoint linehl=breakPoint text=>>
|
||||
" sign define both linehl=currentLine text=>>
|
||||
" sign define empty linehl=empty
|
||||
|
||||
467
roles/base/files/users/bzoicas/vim/zenburn.vim
Normal file
467
roles/base/files/users/bzoicas/vim/zenburn.vim
Normal file
@@ -0,0 +1,467 @@
|
||||
" Vim color file
|
||||
" Maintainer: Jani Nurminen <slinky@iki.fi>
|
||||
" URL: http://kippura.org/zenburnpage/
|
||||
" License: GNU GPL <http://www.gnu.org/licenses/gpl.html>
|
||||
"
|
||||
" Nothing too fancy, just some alien fruit salad to keep you in the zone.
|
||||
" This syntax file was designed to be used with dark environments and
|
||||
" low light situations. Of course, if it works during a daybright office, go
|
||||
" ahead :)
|
||||
"
|
||||
" Owes heavily to other Vim color files! With special mentions
|
||||
" to "BlackDust", "Camo" and "Desert".
|
||||
"
|
||||
" To install, copy to ~/.vim/colors directory.
|
||||
"
|
||||
" Alternatively, you can use Vimball installation:
|
||||
" vim zenburn.vba
|
||||
" :so %
|
||||
" :q
|
||||
"
|
||||
" For details, see :help vimball
|
||||
"
|
||||
" After installation, use it with :colorscheme zenburn.
|
||||
" See also :help syntax
|
||||
"
|
||||
" Credits:
|
||||
" - Jani Nurminen - original Zenburn, maintainer
|
||||
" - Steve Hall & Cream posse - higher-contrast Visual selection
|
||||
" - Kurt Maier - 256 color console coloring, low and high contrast toggle,
|
||||
" bug fixing
|
||||
" - Charlie - spotted too bright StatusLine in non-high contrast mode
|
||||
" - Pablo Castellazzi - CursorLine fix for 256 color mode
|
||||
" - Tim Smith - force dark background
|
||||
" - John Gabriele - spotted bad Ignore-group handling
|
||||
" - Zac Thompson - spotted invisible NonText in low contrast mode
|
||||
" - Christophe-Marie Duquesne - suggested making a Vimball,
|
||||
" suggested support for ctags_highlighting.vim
|
||||
" - Andrew Wagner - noted the CursorColumn bug (guifg was unintentionally set),
|
||||
" unify CursorColumn colour
|
||||
" - Martin Langasek - clarify the license, whitespace fixes
|
||||
" - Marcin Szamotulski - support autocomplete for Zenburn configuration
|
||||
" parameters
|
||||
" - Clayton Parker (claytron) - Convinced by Kurt Maier to use Zenburn. Point
|
||||
" out issues with LineNr, fix directory styles, and their usage in MacVim.
|
||||
" - Paweł Piekarski - Spotted bad FoldColumn and TabLine. Made better
|
||||
" FoldColumn colors, fixed TabLine colors.
|
||||
" - Jim - Fix for missing Include group for terminal
|
||||
" - Peter (Sakartu) - ColorColumn fixes
|
||||
" - Please see git log for the others not listed here
|
||||
"
|
||||
" CONFIGURABLE PARAMETERS:
|
||||
"
|
||||
" You can use the default (don't set any parameters), or you can
|
||||
" set some parameters to tweak the Zenburn colours.
|
||||
"
|
||||
" To use them, put them into your .vimrc file before loading the color scheme,
|
||||
" example:
|
||||
" let g:zenburn_high_Contrast=1
|
||||
" colors zenburn
|
||||
"
|
||||
" You can also do ":let g:zenburn" then hit Ctrl-d or Tab to scroll through the
|
||||
" list of configurable parameters.
|
||||
"
|
||||
" * You can now set a darker background for bright environments. To activate, use:
|
||||
" let g:zenburn_high_Contrast = 1
|
||||
"
|
||||
" * For transparent terminals set the background to black with:
|
||||
" let g:zenburn_transparent = 1
|
||||
"
|
||||
" * For example, Vim help files uses the Ignore-group for the pipes in tags
|
||||
" like "|somelink.txt|". By default, the pipes are not visible, as they
|
||||
" map to Ignore group. If you wish to enable coloring of the Ignore group,
|
||||
" set the following parameter to 1. Warning, it might make some syntax files
|
||||
" look strange.
|
||||
"
|
||||
" let g:zenburn_color_also_Ignore = 1
|
||||
"
|
||||
" * To get more contrast to the Visual selection, use
|
||||
"
|
||||
" let g:zenburn_alternate_Visual = 1
|
||||
"
|
||||
" Note: this is enabled only if the old-style Visual
|
||||
" if used, see g:zenburn_old_Visual
|
||||
"
|
||||
" * To use alternate colouring for Error message, use
|
||||
"
|
||||
" let g:zenburn_alternate_Error = 1
|
||||
"
|
||||
" * The new default for Include is a duller orange. To use the original
|
||||
" colouring for Include, use
|
||||
"
|
||||
" let g:zenburn_alternate_Include = 1
|
||||
"
|
||||
" * To disable underlining for Labels, use
|
||||
"
|
||||
" let g:zenburn_disable_Label_underline = 1
|
||||
"
|
||||
" * Work-around to a Vim bug, it seems to misinterpret ctermfg and 234 and 237
|
||||
" as light values, and sets background to light for some people. If you have
|
||||
" this problem, use:
|
||||
"
|
||||
" let g:zenburn_force_dark_Background = 1
|
||||
"
|
||||
" * By default the CursorColumn is of a lighter colour. I find it more readable
|
||||
" that way, but some people may want to align it with the darker CursorLine
|
||||
" color, for visual uniformity. To do so, use:
|
||||
"
|
||||
" let g:zenburn_unified_CursorColumn = 1
|
||||
"
|
||||
" Note: you can ignore this unless you use
|
||||
" ":set cursorline cursorcolumn", since otherwise the effect won't be
|
||||
" seen.
|
||||
"
|
||||
" * New (dark) Visual coloring has been introduced.
|
||||
" The dark Visual is more aligned with the rest of the colour scheme,
|
||||
" especially if you use line numbers. If you wish to use the
|
||||
" old Visual coloring, use
|
||||
"
|
||||
" let g:zenburn_old_Visual = 1
|
||||
"
|
||||
" Default is to use the new Visual.
|
||||
"
|
||||
" * EXPERIMENTAL FEATURE: Zenburn would like to support TagHighlight
|
||||
" (an evolved ctags-highlighter) by Al Budden (homepage:
|
||||
" http://www.cgtk.co.uk/vim-scripts/taghighlight).
|
||||
" Current support status is broken: there is no automatic detection of
|
||||
" TagHighlight, no specific language support; however there is some basic
|
||||
" support for Python. If you are a user of TagHighlight and want to help,
|
||||
" please enable:
|
||||
"
|
||||
" let g:zenburn_enable_TagHighlight=1
|
||||
"
|
||||
" and improve the corresponding block at the end of the file.
|
||||
"
|
||||
" NOTE:
|
||||
"
|
||||
" * To turn the parameter(s) back to defaults, use UNLET or set them to 0:
|
||||
"
|
||||
" unlet g:zenburn_alternate_Include
|
||||
" or
|
||||
" let g:zenburn_alternate_Include = 0
|
||||
"
|
||||
"
|
||||
" That's it, enjoy!
|
||||
"
|
||||
" TODO
|
||||
" - Visual alternate color is broken? Try GVim >= 7.0.66 if you have trouble
|
||||
" - IME colouring (CursorIM)
|
||||
|
||||
" Finish if we are in a term lacking 256 color support
|
||||
if ! has("gui_running") && &t_Co <= 255
|
||||
finish
|
||||
endif
|
||||
|
||||
" Set defaults, but keep any parameters already set by the user
|
||||
if ! exists("g:zenburn_high_Contrast")
|
||||
let g:zenburn_high_Contrast = 0
|
||||
endif
|
||||
|
||||
if ! exists("g:zenburn_transparent")
|
||||
let g:zenburn_transparent = 0
|
||||
endif
|
||||
|
||||
if ! exists("g:zenburn_color_also_Ignore")
|
||||
let g:zenburn_color_also_Ignore = 0
|
||||
endif
|
||||
|
||||
if ! exists("g:zenburn_alternate_Error")
|
||||
let g:zenburn_alternate_Error = 0
|
||||
endif
|
||||
|
||||
if ! exists("g:zenburn_force_dark_Background")
|
||||
let g:zenburn_force_dark_Background = 0
|
||||
endif
|
||||
|
||||
if ! exists("g:zenburn_alternate_Visual")
|
||||
let g:zenburn_alternate_Visual = 0
|
||||
endif
|
||||
|
||||
if ! exists("g:zenburn_alternate_Include")
|
||||
let g:zenburn_alternate_Include = 0
|
||||
endif
|
||||
|
||||
if ! exists("g:zenburn_disable_Label_underline")
|
||||
let g:zenburn_disable_Label_underline = 0
|
||||
endif
|
||||
|
||||
if ! exists("g:zenburn_unified_CursorColumn")
|
||||
let g:zenburn_unified_CursorColumn = 0
|
||||
endif
|
||||
|
||||
if ! exists("g:zenburn_old_Visual")
|
||||
let g:zenburn_old_Visual = 0
|
||||
endif
|
||||
|
||||
if ! exists("g:zenburn_enable_TagHighlight")
|
||||
let g:zenburn_enable_TagHighlight = 0
|
||||
endif
|
||||
|
||||
" -----------------------------------------------
|
||||
|
||||
set background=dark
|
||||
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
let g:colors_name="zenburn"
|
||||
|
||||
hi Boolean guifg=#dca3a3 ctermfg=181
|
||||
hi Character guifg=#dca3a3 gui=bold ctermfg=181 cterm=bold
|
||||
hi Comment guifg=#7f9f7f gui=italic ctermfg=108
|
||||
hi Conditional guifg=#f0dfaf gui=bold ctermfg=223 cterm=bold
|
||||
hi Constant guifg=#dca3a3 gui=bold ctermfg=181 cterm=bold
|
||||
hi Cursor guifg=#000d18 guibg=#8faf9f gui=bold ctermfg=233 ctermbg=109 cterm=bold
|
||||
hi Debug guifg=#bca3a3 gui=bold ctermfg=181 cterm=bold
|
||||
hi Define guifg=#ffcfaf gui=bold ctermfg=223 cterm=bold
|
||||
hi Delimiter guifg=#8f8f8f ctermfg=245
|
||||
hi DiffAdd guifg=#709080 guibg=#313c36 gui=bold ctermfg=66 ctermbg=237 cterm=bold
|
||||
hi DiffChange guibg=#333333 ctermbg=236
|
||||
hi DiffDelete guifg=#333333 guibg=#464646 ctermfg=236 ctermbg=238
|
||||
hi DiffText guifg=#ecbcbc guibg=#41363c gui=bold ctermfg=217 ctermbg=237 cterm=bold
|
||||
hi Directory guifg=#9fafaf gui=bold ctermfg=109 cterm=bold
|
||||
hi ErrorMsg guifg=#80d4aa guibg=#2f2f2f gui=bold ctermfg=115 ctermbg=236 cterm=bold
|
||||
hi Exception guifg=#c3bf9f gui=bold ctermfg=249 cterm=bold
|
||||
hi Float guifg=#c0bed1 ctermfg=251
|
||||
hi FoldColumn guifg=#93b3a3 guibg=#3f4040
|
||||
hi Folded guifg=#93b3a3 guibg=#3f4040
|
||||
hi Function guifg=#efef8f ctermfg=228
|
||||
hi Identifier guifg=#efdcbc ctermfg=223 cterm=none
|
||||
hi IncSearch guifg=#f8f893 guibg=#385f38 ctermfg=228 ctermbg=23
|
||||
hi Keyword guifg=#f0dfaf gui=bold ctermfg=223 cterm=bold
|
||||
hi Macro guifg=#ffcfaf gui=bold ctermfg=223 cterm=bold
|
||||
hi ModeMsg guifg=#ffcfaf gui=none ctermfg=223 cterm=none
|
||||
hi MoreMsg guifg=#ffffff gui=bold ctermfg=231 cterm=bold
|
||||
hi Number guifg=#8cd0d3 ctermfg=116
|
||||
hi Operator guifg=#f0efd0 ctermfg=230
|
||||
hi PmenuSbar guibg=#2e3330 guifg=#000000 ctermfg=16 ctermbg=236
|
||||
hi PmenuThumb guibg=#a0afa0 guifg=#040404 ctermfg=232 ctermbg=151
|
||||
hi PreCondit guifg=#dfaf8f gui=bold ctermfg=180 cterm=bold
|
||||
hi PreProc guifg=#ffcfaf gui=bold ctermfg=223 cterm=bold
|
||||
hi Question guifg=#ffffff gui=bold ctermfg=231 cterm=bold
|
||||
hi Repeat guifg=#ffd7a7 gui=bold ctermfg=223 cterm=bold
|
||||
hi Search guifg=#ffffe0 guibg=#284f28 ctermfg=230 ctermbg=22
|
||||
hi SignColumn guifg=#9fafaf gui=bold ctermfg=109 cterm=bold
|
||||
hi SpecialChar guifg=#dca3a3 gui=bold ctermfg=181 cterm=bold
|
||||
hi SpecialComment guifg=#82a282 gui=bold ctermfg=108 cterm=bold
|
||||
hi Special guifg=#cfbfaf ctermfg=181
|
||||
hi SpecialKey guifg=#9ece9e ctermfg=151
|
||||
hi Statement guifg=#e3ceab gui=none ctermfg=187 cterm=none
|
||||
hi StatusLine guifg=#313633 guibg=#ccdc90 ctermfg=236 ctermbg=186
|
||||
hi StatusLineNC guifg=#2e3330 guibg=#88b090 ctermfg=235 ctermbg=108
|
||||
hi StorageClass guifg=#c3bf9f gui=bold ctermfg=249 cterm=bold
|
||||
hi String guifg=#cc9393 ctermfg=174
|
||||
hi Structure guifg=#efefaf gui=bold ctermfg=229 cterm=bold
|
||||
hi Tag guifg=#e89393 gui=bold ctermfg=181 cterm=bold
|
||||
hi Title guifg=#efefef gui=bold ctermfg=255 ctermbg=NONE cterm=bold
|
||||
hi Todo guifg=#dfdfdf guibg=NONE gui=bold ctermfg=254 ctermbg=NONE cterm=bold
|
||||
hi Typedef guifg=#dfe4cf gui=bold ctermfg=253 cterm=bold
|
||||
hi Type guifg=#dfdfbf gui=bold ctermfg=187 cterm=bold
|
||||
hi Underlined guifg=#dcdccc gui=underline ctermfg=188 cterm=underline
|
||||
hi VertSplit guifg=#2e3330 guibg=#688060 ctermfg=236 ctermbg=65
|
||||
hi VisualNOS guifg=#333333 guibg=#f18c96 gui=bold,underline ctermfg=236 ctermbg=210 cterm=bold
|
||||
hi WarningMsg guifg=#ffffff guibg=#333333 gui=bold ctermfg=231 ctermbg=236 cterm=bold
|
||||
hi WildMenu guifg=#cbecd0 guibg=#2c302d gui=underline ctermfg=194 ctermbg=236 cterm=underline
|
||||
|
||||
" spellchecking, always "bright" term background
|
||||
hi SpellBad guisp=#bc6c4c guifg=#dc8c6c ctermfg=209 ctermbg=237
|
||||
hi SpellCap guisp=#6c6c9c guifg=#8c8cbc ctermfg=103 ctermbg=237
|
||||
hi SpellRare guisp=#bc6c9c guifg=#bc8cbc ctermfg=139 ctermbg=237
|
||||
hi SpellLocal guisp=#7cac7c guifg=#9ccc9c ctermfg=151 ctermbg=237
|
||||
|
||||
if exists("g:zenburn_high_Contrast") && g:zenburn_high_Contrast
|
||||
" use new darker background
|
||||
hi Normal guifg=#dcdccc guibg=#1f1f1f ctermfg=188 ctermbg=234
|
||||
hi ColorColumn guibg=#33332f ctermbg=235
|
||||
hi CursorLine guibg=#121212 gui=bold ctermbg=233 cterm=none
|
||||
hi CursorLineNr guifg=#f2f3bb guibg=#161616 ctermfg=229 ctermbg=233
|
||||
if exists("g:zenburn_unified_CursorColumn") && g:zenburn_unified_CursorColumn
|
||||
hi CursorColumn guibg=#121212 gui=bold ctermbg=233 cterm=none
|
||||
else
|
||||
hi CursorColumn guibg=#2b2b2b ctermbg=235 cterm=none
|
||||
endif
|
||||
hi FoldColumn guibg=#161616 ctermbg=233 ctermfg=109
|
||||
hi Folded guibg=#161616 ctermbg=233 ctermfg=109
|
||||
hi LineNr guifg=#9fafaf guibg=#161616 ctermfg=248 ctermbg=233
|
||||
hi NonText guifg=#404040 gui=bold ctermfg=238
|
||||
hi Pmenu guibg=#242424 guifg=#ccccbc ctermfg=251 ctermbg=235
|
||||
hi PmenuSel guibg=#353a37 guifg=#ccdc90 gui=bold ctermfg=187 ctermbg=236 cterm=bold
|
||||
hi MatchParen guifg=#f0f0c0 guibg=#383838 gui=bold ctermfg=229 ctermbg=237 cterm=bold
|
||||
hi SignColumn guibg=#181818 ctermbg=233
|
||||
hi SpecialKey guibg=#242424
|
||||
hi TabLine guifg=#88b090 guibg=#313633 gui=none ctermbg=236 ctermfg=108 cterm=none
|
||||
hi TabLineSel guifg=#ccd990 guibg=#222222 ctermbg=235 ctermfg=186 cterm=bold
|
||||
hi TabLineFill guifg=#88b090 guibg=#313633 gui=none ctermbg=236 ctermfg=108 cterm=none
|
||||
else
|
||||
" Original, lighter background
|
||||
hi Normal guifg=#dcdccc guibg=#3f3f3f ctermfg=188 ctermbg=237
|
||||
hi ColorColumn guibg=#484848 ctermbg=238
|
||||
hi CursorLine guibg=#434443 ctermbg=238 cterm=none
|
||||
hi CursorLineNr guifg=#d2d39b guibg=#262626 ctermfg=230 ctermbg=235
|
||||
if exists("g:zenburn_unified_CursorColumn") && g:zenburn_unified_CursorColumn
|
||||
hi CursorColumn guibg=#434343 ctermbg=238 cterm=none
|
||||
else
|
||||
hi CursorColumn guibg=#4f4f4f ctermbg=239 cterm=none
|
||||
endif
|
||||
hi FoldColumn guibg=#333333 ctermbg=236 ctermfg=109
|
||||
hi Folded guibg=#333333 ctermbg=236 ctermfg=109
|
||||
hi LineNr guifg=#9fafaf guibg=#262626 ctermfg=248 ctermbg=235
|
||||
hi NonText guifg=#5b605e gui=bold ctermfg=240
|
||||
hi Pmenu guibg=#2c2e2e guifg=#9f9f9f ctermfg=248 ctermbg=235
|
||||
hi PmenuSel guibg=#242424 guifg=#d0d0a0 gui=bold ctermfg=187 ctermbg=235 cterm=bold
|
||||
hi MatchParen guifg=#b2b2a0 guibg=#2e2e2e gui=bold ctermfg=145 ctermbg=236 cterm=bold
|
||||
hi SignColumn guibg=#343434 ctermbg=236
|
||||
hi SpecialKey guibg=#444444
|
||||
hi TabLine guifg=#d0d0b8 guibg=#222222 gui=none ctermbg=235 ctermfg=187 cterm=none
|
||||
hi TabLineSel guifg=#f0f0b0 guibg=#333333 gui=bold ctermbg=236 ctermfg=229 cterm=bold
|
||||
hi TabLineFill guifg=#dccdcc guibg=#101010 gui=none ctermbg=233 ctermfg=188 cterm=none
|
||||
|
||||
hi StatusLine ctermbg=144
|
||||
endif
|
||||
|
||||
if exists("g:zenburn_force_dark_Background") && g:zenburn_force_dark_Background
|
||||
" Force dark background, because of a bug in VIM: VIM sets background
|
||||
" automatically during "hi Normal ctermfg=X"; it misinterprets the high
|
||||
" value (234 or 237 above) as a light color, and wrongly sets background to
|
||||
" light. See ":help highlight" for details.
|
||||
set background=dark
|
||||
endif
|
||||
|
||||
if exists("g:zenburn_transparent") && g:zenburn_transparent
|
||||
hi Normal ctermbg=0 guibg=#000000
|
||||
hi Statement ctermbg=NONE
|
||||
hi Title ctermbg=NONE
|
||||
hi Todo ctermbg=NONE
|
||||
hi Underlined ctermbg=NONE
|
||||
hi DiffAdd ctermbg=NONE
|
||||
hi DiffText ctermbg=NONE
|
||||
hi ErrorMsg ctermbg=NONE
|
||||
hi LineNr ctermbg=NONE
|
||||
endif
|
||||
|
||||
if exists("g:zenburn_old_Visual") && g:zenburn_old_Visual
|
||||
if exists("g:zenburn_alternate_Visual") && g:zenburn_alternate_Visual
|
||||
" Visual with more contrast, thanks to Steve Hall & Cream posse
|
||||
" gui=none fixes weird highlight problem in at least GVim 7.0.66, thanks to Kurt Maier
|
||||
hi Visual guifg=#000000 guibg=#71d3b4 gui=none ctermfg=16 ctermbg=79 cterm=none
|
||||
hi VisualNOS guifg=#000000 guibg=#71d3b4 gui=none ctermfg=16 ctermbg=79 cterm=none
|
||||
else
|
||||
" use default visual
|
||||
hi Visual guifg=#233323 guibg=#71d3b4 gui=none ctermfg=235 ctermbg=79 cterm=none
|
||||
hi VisualNOS guifg=#233323 guibg=#71d3b4 gui=none ctermfg=235 ctermbg=79 cterm=none
|
||||
endif
|
||||
else
|
||||
" new Visual style
|
||||
if exists("g:zenburn_high_Contrast") && g:zenburn_high_Contrast
|
||||
" high contrast
|
||||
"hi Visual guibg=#304a3d
|
||||
"hi VisualNos guibg=#304a3d
|
||||
"TODO no nice greenish in console, 65 is closest. use full black instead,
|
||||
"although i like the green..!
|
||||
hi Visual guibg=#0f0f0f ctermbg=232
|
||||
hi VisualNOS guibg=#0f0f0f ctermbg=232
|
||||
if exists("g:zenburn_transparent") && g:zenburn_transparent
|
||||
hi Visual ctermbg=235
|
||||
endif
|
||||
else
|
||||
" low contrast
|
||||
hi Visual guibg=#2f2f2f ctermbg=235
|
||||
hi VisualNOS guibg=#2f2f2f ctermbg=235
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists("g:zenburn_alternate_Error") && g:zenburn_alternate_Error
|
||||
" use more jumpy Error
|
||||
hi Error guifg=#e37170 guibg=#664040 gui=bold ctermfg=210 ctermbg=52 cterm=bold
|
||||
else
|
||||
" default is something more zenburn-compatible
|
||||
hi Error guifg=#e37170 guibg=#3d3535 gui=bold ctermfg=167 ctermbg=236 cterm=bold
|
||||
endif
|
||||
|
||||
if exists("g:zenburn_alternate_Include") && g:zenburn_alternate_Include
|
||||
" original setting
|
||||
hi Include guifg=#ffcfaf gui=bold ctermfg=223 cterm=bold
|
||||
else
|
||||
" new, less contrasted one
|
||||
hi Include guifg=#dfaf8f gui=bold ctermfg=180 cterm=bold
|
||||
endif
|
||||
|
||||
if exists("g:zenburn_disable_Label_underline") && g:zenburn_disable_Label_underline
|
||||
hi Label guifg=#dfcfaf ctermfg=187
|
||||
else
|
||||
hi Label guifg=#dfcfaf gui=underline ctermfg=187 cterm=underline
|
||||
endif
|
||||
|
||||
if exists("g:zenburn_color_also_Ignore") && g:zenburn_color_also_Ignore
|
||||
" color the Ignore groups
|
||||
" note: if you get strange coloring for your files, turn this off (unlet)
|
||||
if exists("g:zenburn_high_Contrast") && g:zenburn_high_Contrast
|
||||
hi Ignore ctermfg=238
|
||||
else
|
||||
hi Ignore guifg=#545a4f ctermfg=240
|
||||
endif
|
||||
endif
|
||||
|
||||
" EXPERIMENTAL TagHighlight support
|
||||
" link/set sensible defaults here;
|
||||
"
|
||||
" For now I mostly link to subset of Zenburn colors, the linkage is based
|
||||
" on appearance, not semantics. In later versions I might define more new colours.
|
||||
"
|
||||
" HELP NEEDED to make this work properly.
|
||||
|
||||
if exists("g:zenburn_enable_TagHighlight") && g:zenburn_enable_TagHighlight
|
||||
" CTag support may vary, but the first step is to start using it so
|
||||
" we can fix it!
|
||||
"
|
||||
" Consult /plugin/TagHighlight/data/kinds.txt for info on your
|
||||
" language and what's been defined.
|
||||
"
|
||||
" There is potential for language indepedent features here. (Acutally,
|
||||
" seems it may be required for this to be useful...) This way we can
|
||||
" implement features depending on how well CTags are currently implemented
|
||||
" for the language. ie. Global problem for python is annoying. Special
|
||||
" colors are defined for special language features, etc..
|
||||
"
|
||||
" For now all I care about is python supported features:
|
||||
" c:CTagsClass
|
||||
" f:CTagsFunction
|
||||
" i:CTagsImport
|
||||
" m:CTagsMember
|
||||
" v:CTagsGlobalVariable
|
||||
"
|
||||
" Note: TagHighlight defaults to setting new tags to Keyword
|
||||
" highlighting.
|
||||
|
||||
" TODO conditionally run each section
|
||||
" BEGIN Python Section
|
||||
hi link Class Function
|
||||
hi link Import PythonInclude
|
||||
hi link Member Function
|
||||
"Note: Function is already defined
|
||||
|
||||
" Highlighter seems to think a lot of things are global variables even
|
||||
" though they're not. Example: python method-local variable is
|
||||
" coloured as a global variable. They should not be global, since
|
||||
" they're not visible outside the method.
|
||||
" If this is some very bright colour group then things look bad.
|
||||
" hi link GlobalVariable Identifier
|
||||
|
||||
" Because of this problem I am disabling the feature by setting it to
|
||||
" Normal instead
|
||||
hi link GlobalVariable Normal
|
||||
" END Python Section
|
||||
|
||||
" Starting point for other languages.
|
||||
hi link GlobalConstant Constant
|
||||
hi link EnumerationValue Float
|
||||
hi link EnumerationName Identifier
|
||||
hi link DefinedName WarningMsg
|
||||
hi link LocalVariable WarningMsg
|
||||
hi link Structure WarningMsg
|
||||
hi link Union WarningMsg
|
||||
endif
|
||||
|
||||
" TODO check for more obscure syntax groups that they're ok
|
||||
|
||||
75
roles/base/files/users/bzoicas/zsh/aliases.zsh
Normal file
75
roles/base/files/users/bzoicas/zsh/aliases.zsh
Normal file
@@ -0,0 +1,75 @@
|
||||
# Command aliases
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../../../'
|
||||
alias ....='cd ../../../../'
|
||||
alias back='cd $OLDPWD'
|
||||
alias c='clear'
|
||||
alias cd..='cd ..'
|
||||
alias cp='cp -iv'
|
||||
alias chmod="chmod -c"
|
||||
alias chown="chown -c"
|
||||
alias df='df -h -x squashfs -x tmpfs -x devtmpfs'
|
||||
alias e="vim -O "
|
||||
alias E="vim -o "
|
||||
alias egrep='egrep --colour=auto'
|
||||
alias extip='curl icanhazip.com'
|
||||
alias grep='grep --color=auto'
|
||||
alias l.='ls -lhFa --time-style=long-iso --color=auto'
|
||||
alias ll='ls'
|
||||
alias ln='ln -iv'
|
||||
alias ls=' ls -lhF --color=auto --human-readable --time-style=long-iso --classify'
|
||||
alias lsmount='mount |column -t'
|
||||
alias mkdir='mkdir -pv'
|
||||
alias mv='mv -iv'
|
||||
alias ports='netstat -tulanp'
|
||||
alias h='history -i 1'
|
||||
alias history='history 1'
|
||||
alias j='jobs -l'
|
||||
alias rm='rm -iv'
|
||||
alias rmdir='rmdir -v'
|
||||
alias speedtest='curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -'
|
||||
alias ssha='eval $(ssh-agent) && ssh-add'
|
||||
alias svim='sudo vim'
|
||||
alias tn='tmux new -s'
|
||||
alias watch='watch -d'
|
||||
alias weather='curl wttr.in'
|
||||
alias wget='wget -c'
|
||||
|
||||
if command -v colordiff > /dev/null 2>&1; then
|
||||
alias diff="colordiff -Nuar"
|
||||
else
|
||||
alias diff="diff -Nuar"
|
||||
fi
|
||||
|
||||
## get top process eating memory
|
||||
alias mem5='ps auxf | sort -nr -k 4 | head -5'
|
||||
alias mem10='ps auxf | sort -nr -k 4 | head -10'
|
||||
|
||||
## get top process eating cpu ##
|
||||
alias cpu5='ps auxf | sort -nr -k 3 | head -5'
|
||||
alias cpu10='ps auxf | sort -nr -k 3 | head -10'
|
||||
|
||||
## list largest directories (aka "ducks")
|
||||
alias dir5='du -cksh * | sort -hr | head -n 5'
|
||||
alias dir10='du -cksh * | sort -hr | head -n 10'
|
||||
|
||||
# Safetynets
|
||||
# do not delete / or prompt if deleting more than 3 files at a time #
|
||||
alias rm='rm -I --preserve-root'
|
||||
|
||||
# Parenting changing perms on / #
|
||||
alias chown='chown --preserve-root'
|
||||
alias chmod='chmod --preserve-root'
|
||||
alias chgrp='chgrp --preserve-root'
|
||||
|
||||
# Package management
|
||||
if [ -f /usr/bin/apt ]; then
|
||||
alias update='sudo apt update'
|
||||
alias upgrade='sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt clean'
|
||||
alias install='sudo apt install'
|
||||
fi
|
||||
if [ -f /usr/bin/pacman ]; then
|
||||
alias update='sudo pacman -Syyy'
|
||||
alias upgrade='sudo pacman -Syu'
|
||||
alias install='sudo pacman -S'
|
||||
fi
|
||||
33
roles/base/files/users/bzoicas/zsh/bindkey.zsh
Normal file
33
roles/base/files/users/bzoicas/zsh/bindkey.zsh
Normal file
@@ -0,0 +1,33 @@
|
||||
# Set bindkey to emacs mode
|
||||
bindkey -e
|
||||
|
||||
# Restore history searching with ^r
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
|
||||
# Use alt and arrow keys for moving directories
|
||||
cdUndoKey() {
|
||||
popd > /dev/null
|
||||
zle reset-prompt
|
||||
echo
|
||||
ls
|
||||
echo
|
||||
}
|
||||
|
||||
cdParentKey() {
|
||||
pushd .. > /dev/null
|
||||
zle reset-prompt
|
||||
echo
|
||||
ls
|
||||
echo
|
||||
}
|
||||
|
||||
zle -N cdParentKey
|
||||
zle -N cdUndoKey
|
||||
bindkey '^[[1;3A' cdParentKey
|
||||
bindkey '^[[1;3D' cdUndoKey
|
||||
|
||||
|
||||
# Control-x-e to open current line in $EDITOR, awesome when writting functions or editing multiline commands.
|
||||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '^x^e' edit-command-line
|
||||
54
roles/base/files/users/bzoicas/zsh/completion.zsh
Normal file
54
roles/base/files/users/bzoicas/zsh/completion.zsh
Normal file
@@ -0,0 +1,54 @@
|
||||
autoload -U compinit && compinit
|
||||
zmodload -i zsh/complist
|
||||
|
||||
# man zshcontrib
|
||||
zstyle ':vcs_info:*' actionformats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
|
||||
zstyle ':vcs_info:*' formats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
|
||||
zstyle ':vcs_info:*' enable git #svn cvs
|
||||
|
||||
# Enable completion caching, use rehash to clear
|
||||
zstyle ':completion::complete:*' use-cache on
|
||||
zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST
|
||||
|
||||
# Make directories blue when autocompleting
|
||||
zstyle ':completion:*' list-colors 'di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
|
||||
|
||||
# Make the list prompt friendly
|
||||
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
|
||||
|
||||
# Make the selection prompt friendly when there are a lot of choices
|
||||
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
|
||||
|
||||
# Add simple colors to kill
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
|
||||
# list of completers to use
|
||||
zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
|
||||
|
||||
# Use menu, also llows you to use arrow keys
|
||||
zstyle ':completion:*' menu select=2 _complete _ignored _approximate
|
||||
|
||||
# insert all expansions for expand completer
|
||||
zstyle ':completion:*:expand:*' tag-order all-expansions
|
||||
|
||||
# match uppercase from lowercase
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
||||
|
||||
# offer indexes before parameters in subscripts
|
||||
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
|
||||
|
||||
# formatting and messages
|
||||
zstyle ':completion:*' verbose yes
|
||||
zstyle ':completion:*:descriptions' format '%B%d%b'
|
||||
zstyle ':completion:*:messages' format '%d'
|
||||
zstyle ':completion:*:warnings' format 'No matches for: %d'
|
||||
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
|
||||
zstyle ':completion:*' group-name ''
|
||||
|
||||
# ignore completion functions (until the _ignored completer)
|
||||
zstyle ':completion:*:functions' ignored-patterns '_*'
|
||||
zstyle ':completion:*:scp:*' tag-order files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
|
||||
zstyle ':completion:*:scp:*' group-order files all-files users hosts-domain hosts-host hosts-ipaddr
|
||||
zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
|
||||
zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr
|
||||
zstyle '*' single-ignored show
|
||||
8
roles/base/files/users/bzoicas/zsh/exports.zsh
Normal file
8
roles/base/files/users/bzoicas/zsh/exports.zsh
Normal file
@@ -0,0 +1,8 @@
|
||||
export TERM=xterm-256color
|
||||
export EDITOR="/usr/bin/vim"
|
||||
export GREP_COLOR='3;33'
|
||||
|
||||
# Not all servers have terminfo for rxvt-256color. :<
|
||||
#if [ "${TERM}" = 'rxvt-256color' ] && ! [ -f '/usr/share/terminfo/r/rxvt-256color' ] && ! [ -f '/lib/terminfo/r/rxvt-256color' ] && ! [ -f "${HOME}/.terminfo/r/rxvt-256color" ]; #then
|
||||
# export TERM='rxvt-unicode'
|
||||
#fi
|
||||
157
roles/base/files/users/bzoicas/zsh/functions.zsh
Normal file
157
roles/base/files/users/bzoicas/zsh/functions.zsh
Normal file
@@ -0,0 +1,157 @@
|
||||
# Easily extract archives
|
||||
extract () {
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjvf $1 ;;
|
||||
*.tar.gz) tar xzvf $1 ;;
|
||||
*.tar.xz) tar xvf $1 ;;
|
||||
*.bz2) bzip2 -d $1 ;;
|
||||
*.rar) unrar2dir $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip2dir $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*.ace) unace x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
run_under_tmux() {
|
||||
# Run $1 under session or attach if such session already exist.
|
||||
# $2 is optional path, if no specified, will use $1 from $PATH.
|
||||
# If you need to pass extra variables, use $2 for it as in example below..
|
||||
# Example usage:
|
||||
# torrent() { run_under_tmux 'rtorrent' '/usr/local/rtorrent-git/bin/rtorrent'; }
|
||||
# mutt() { run_under_tmux 'mutt'; }
|
||||
# irc() { run_under_tmux 'irssi' "TERM='screen' command irssi"; }
|
||||
|
||||
|
||||
# There is a bug in linux's libevent...
|
||||
# export EVENT_NOEPOLL=1
|
||||
|
||||
command -v tmux >/dev/null 2>&1 || return 1
|
||||
|
||||
if [ -z "$1" ]; then return 1; fi
|
||||
local name="$1"
|
||||
if [ -n "$2" ]; then
|
||||
local execute="$2"
|
||||
else
|
||||
local execute="command ${name}"
|
||||
fi
|
||||
|
||||
if tmux has-session -t "${name}" 2>/dev/null; then
|
||||
tmux attach -d -t "${name}"
|
||||
else
|
||||
tmux new-session -s "${name}" "${execute}" \; set-option status \; set set-titles-string "${name} (tmux@${HOST})"
|
||||
fi
|
||||
}
|
||||
|
||||
reload () {
|
||||
exec "${SHELL}" "$@"
|
||||
}
|
||||
|
||||
confirm() {
|
||||
local answer
|
||||
echo -ne "zsh: sure you want to run '${YELLOW}$*${NC}' [yN]? "
|
||||
read -q answer
|
||||
echo
|
||||
if [[ "${answer}" =~ ^[Yy]$ ]]; then
|
||||
command "${@}"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
confirm_wrapper() {
|
||||
if [ "$1" = '--root' ]; then
|
||||
local as_root='true'
|
||||
shift
|
||||
fi
|
||||
|
||||
local prefix=''
|
||||
|
||||
if [ "${as_root}" = 'true' ] && [ "${USER}" != 'root' ]; then
|
||||
prefix="sudo"
|
||||
fi
|
||||
confirm ${prefix} "$@"
|
||||
}
|
||||
|
||||
poweroff() { confirm_wrapper --root $0 "$@"; }
|
||||
reboot() { confirm_wrapper --root $0 "$@"; }
|
||||
hibernate() { confirm_wrapper --root $0 "$@"; }
|
||||
|
||||
startx() {
|
||||
exec =startx
|
||||
}
|
||||
|
||||
begin_with() {
|
||||
local string="${1}"
|
||||
shift
|
||||
local element=''
|
||||
for element in "$@"; do
|
||||
if [[ "${string}" =~ "^${element}" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
|
||||
}
|
||||
|
||||
termtitle() {
|
||||
case "$TERM" in
|
||||
rxvt*|xterm*|nxterm|gnome|screen|screen-*)
|
||||
local prompt_host="${(%):-%m}"
|
||||
local prompt_user="${(%):-%n}"
|
||||
local prompt_char="${(%):-%~}"
|
||||
case "$1" in
|
||||
precmd)
|
||||
printf '\e]0;%s@%s: %s\a' "${prompt_user}" "${prompt_host}" "${prompt_char}"
|
||||
;;
|
||||
preexec)
|
||||
printf '\e]0;%s [%s@%s: %s]\a' "$2" "${prompt_user}" "${prompt_host}" "${prompt_char}"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
dot_progress() {
|
||||
# Fancy progress function from Landley's Aboriginal Linux.
|
||||
# Useful for long rm, tar and such.
|
||||
# Usage:
|
||||
# rm -rfv /foo | dot_progress
|
||||
local i='0'
|
||||
local line=''
|
||||
|
||||
while read line; do
|
||||
i="$((i+1))"
|
||||
if [ "${i}" = '25' ]; then
|
||||
printf '.'
|
||||
i='0'
|
||||
fi
|
||||
done
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
# Fix backgrounding of GUI apps
|
||||
precmd_disown() {
|
||||
emulate -L zsh
|
||||
setopt extendedglob
|
||||
local job match mbegin mend
|
||||
|
||||
jobs | while read job; do
|
||||
if [[ $job = \[(#b)([[:digit:]]##)\]*running* ]]; then
|
||||
disown %$match[1]
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook precmd precmd_disown
|
||||
38
roles/base/files/users/bzoicas/zsh/history.zsh
Normal file
38
roles/base/files/users/bzoicas/zsh/history.zsh
Normal file
@@ -0,0 +1,38 @@
|
||||
# Set history file
|
||||
HISTFILE=~/.zhistory
|
||||
|
||||
# Set history size
|
||||
HISTSIZE=1000
|
||||
|
||||
# Set the number of lines in $HISTFILE
|
||||
SAVEHIST="${HISTSIZE}"
|
||||
|
||||
# Enable history search with up and down arrows
|
||||
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
|
||||
[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search
|
||||
[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search
|
||||
|
||||
# All terminal sessions append to the history file immediately as commands are entered
|
||||
setopt inc_append_history
|
||||
|
||||
# save timestamp of command and duration
|
||||
setopt extended_history
|
||||
|
||||
# when trimming history, lose oldest duplicates first
|
||||
setopt hist_expire_dups_first
|
||||
|
||||
# When a duplicate command is entered, remove the oldest duplicate
|
||||
setopt hist_ignore_all_dups
|
||||
|
||||
# remove command line from history list when first character on the line is a space
|
||||
setopt hist_ignore_space
|
||||
|
||||
# Remove extra blanks from each command line being added to history
|
||||
setopt hist_reduce_blanks
|
||||
|
||||
# Reads the history file every time history is called
|
||||
# This means that the history command will show recent entries, even between terminal sessions
|
||||
setopt share_history
|
||||
1
roles/base/files/users/bzoicas/zsh/path.zsh
Normal file
1
roles/base/files/users/bzoicas/zsh/path.zsh
Normal file
@@ -0,0 +1 @@
|
||||
path+=/home/bzoicas/.local/bin
|
||||
2
roles/base/files/users/bzoicas/zsh/plugins.zsh
Normal file
2
roles/base/files/users/bzoicas/zsh/plugins.zsh
Normal file
@@ -0,0 +1,2 @@
|
||||
# Load plugins
|
||||
plugins=(git)
|
||||
3
roles/base/files/users/bzoicas/zsh/prompt.zsh
Normal file
3
roles/base/files/users/bzoicas/zsh/prompt.zsh
Normal file
@@ -0,0 +1,3 @@
|
||||
# Set the prompt
|
||||
newline=$'\n'
|
||||
prompt='%F{35}%* [%j]${git_prompt} [%m:%F{75}%f%F{69}%c%f%F{35}] %#%f ${newline}🦄 '
|
||||
38
roles/base/files/users/bzoicas/zsh/setopt.zsh
Normal file
38
roles/base/files/users/bzoicas/zsh/setopt.zsh
Normal file
@@ -0,0 +1,38 @@
|
||||
# Don't beep on error
|
||||
setopt no_beep
|
||||
|
||||
# Allow comments even in interactive shells (especially for Muness)
|
||||
setopt interactive_comments
|
||||
|
||||
# If you type foo, and it isn't a command, and it is a directory in your cdpath, go there
|
||||
setopt auto_cd
|
||||
|
||||
# don't push multiple copies of the same directory onto the directory stack
|
||||
setopt pushd_ignore_dups
|
||||
|
||||
# When completing from the middle of a word, move the cursor to the end of the word
|
||||
setopt always_to_end
|
||||
|
||||
# show completion menu on successive tab press. needs unsetop menu_complete to work
|
||||
setopt auto_menu
|
||||
|
||||
# any parameter that is set to the absolute name of a directory immediately becomes a name for that directory
|
||||
setopt auto_name_dirs
|
||||
|
||||
# Allow completion from within a word/phrase
|
||||
setopt complete_in_word
|
||||
|
||||
# do not autoselect the first completion entry
|
||||
unsetopt menu_complete
|
||||
|
||||
# spelling correction for commands
|
||||
setopt correct
|
||||
|
||||
# Stop annoying error when using asterisk in shell commands (i.e. scp server:*.txt .)
|
||||
setopt nonomatch
|
||||
|
||||
# extended globbing, awesome!
|
||||
setopt extendedGlob
|
||||
|
||||
# Turn on command substitution in the prompt (and parameter expansion and arithmetic expansion).
|
||||
setopt promptsubst
|
||||
14
roles/base/files/users/bzoicas/zsh/theming.zsh
Normal file
14
roles/base/files/users/bzoicas/zsh/theming.zsh
Normal file
@@ -0,0 +1,14 @@
|
||||
# Colors.
|
||||
red='\e[0;31m'
|
||||
RED='\e[1;31m'
|
||||
green='\e[0;32m'
|
||||
GREEN='\e[1;32m'
|
||||
yellow='\e[0;33m'
|
||||
YELLOW='\e[1;33m'
|
||||
blue='\e[0;34m'
|
||||
BLUE='\e[1;34m'
|
||||
purple='\e[0;35m'
|
||||
PURPLE='\e[1;35m'
|
||||
cyan='\e[0;36m'
|
||||
CYAN='\e[1;36m'
|
||||
NC='\e[0m'
|
||||
11
roles/base/files/users/bzoicas/zsh/zshrc
Normal file
11
roles/base/files/users/bzoicas/zsh/zshrc
Normal file
@@ -0,0 +1,11 @@
|
||||
source ~/.zsh/aliases.zsh
|
||||
source ~/.zsh/bindkey.zsh
|
||||
source ~/.zsh/completion.zsh
|
||||
source ~/.zsh/exports.zsh
|
||||
source ~/.zsh/functions.zsh
|
||||
source ~/.zsh/history.zsh
|
||||
source ~/.zsh/path.zsh
|
||||
source ~/.zsh/plugins.zsh
|
||||
source ~/.zsh/prompt.zsh
|
||||
source ~/.zsh/setopt.zsh
|
||||
source ~/.zsh/theming.zsh
|
||||
3
roles/base/files/users/root/bash/bash_profile
Normal file
3
roles/base/files/users/root/bash/bash_profile
Normal file
@@ -0,0 +1,3 @@
|
||||
if [ -f ~/.bashrc ]; then
|
||||
source ~/.bashrc
|
||||
fi
|
||||
108
roles/base/files/users/root/bash/bashrc
Normal file
108
roles/base/files/users/root/bash/bashrc
Normal file
@@ -0,0 +1,108 @@
|
||||
# Current PS1:
|
||||
tty -s && export PS1="[\[$(tput sgr0)\]\[\033[38;5;1m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\h:\W]\\$ \[$(tput sgr0)\]"
|
||||
|
||||
# Env
|
||||
export TERM=xterm-256color
|
||||
export EDITOR=vim
|
||||
|
||||
# Don't add duplicate lines or lines beginning with a space to the history
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# Set history format to include timestamps
|
||||
HISTTIMEFORMAT="%Y-%m-%d %T "
|
||||
|
||||
# Command aliases
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../../../'
|
||||
alias ....='cd ../../../../'
|
||||
alias back='cd $OLDPWD'
|
||||
alias c='clear'
|
||||
alias cd..='cd ..'
|
||||
alias diff='colordiff'
|
||||
alias e="vim -O "
|
||||
alias E="vim -o "
|
||||
alias extip='curl icanhazip.com'
|
||||
alias grep='grep --color=auto'
|
||||
alias l.='ls -lhFa --time-style=long-iso --color=auto'
|
||||
alias ll='ls'
|
||||
alias ls='ls -lhF --time-style=long-iso --color=auto'
|
||||
alias lsmount='mount |column -t'
|
||||
alias mkdir='mkdir -pv'
|
||||
alias ports='netstat -tulanp'
|
||||
alias h='history'
|
||||
alias j='jobs -l'
|
||||
alias speedtest='curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -'
|
||||
alias ssha='eval $(ssh-agent) && ssh-add'
|
||||
alias svim='sudo vim'
|
||||
alias tn='tmux new -s'
|
||||
alias wget='wget -c'
|
||||
|
||||
## get top process eating memory
|
||||
alias psmem='ps auxf | sort -nr -k 4'
|
||||
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
|
||||
|
||||
## get top process eating cpu ##
|
||||
alias pscpu='ps auxf | sort -nr -k 3'
|
||||
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
|
||||
|
||||
# Safetynets
|
||||
# do not delete / or prompt if deleting more than 3 files at a time #
|
||||
alias rm='rm -I --preserve-root'
|
||||
|
||||
# confirmation #
|
||||
alias mv='mv -i'
|
||||
alias cp='cp -i'
|
||||
alias ln='ln -i'
|
||||
|
||||
# Parenting changing perms on / #
|
||||
alias chown='chown --preserve-root'
|
||||
alias chmod='chmod --preserve-root'
|
||||
alias chgrp='chgrp --preserve-root'
|
||||
|
||||
# reload bash config
|
||||
alias reload="source ~/.bashrc"
|
||||
|
||||
# package management
|
||||
alias update='sudo apt-get update'
|
||||
alias upgrade='sudo apt-get update && sudo apt-get dist-upgrade'
|
||||
alias install='sudo apt-get install'
|
||||
|
||||
## Functions
|
||||
|
||||
# Make a directory, then go there
|
||||
md() {
|
||||
test -n "$1" || return
|
||||
mkdir -p "$1" && cd "$1"
|
||||
}
|
||||
|
||||
# "path" shows current path, one element per line.
|
||||
# If an argument is supplied, grep for it.
|
||||
path() {
|
||||
test -n "$1" && {
|
||||
echo $PATH | perl -p -e "s/:/\n/g;" | grep -i "$1"
|
||||
} || {
|
||||
echo $PATH | perl -p -e "s/:/\n/g;"
|
||||
}
|
||||
}
|
||||
|
||||
extract () {
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjvf $1 ;;
|
||||
*.tar.gz) tar xzvf $1 ;;
|
||||
*.bz2) bzip2 -d $1 ;;
|
||||
*.rar) unrar2dir $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip2dir $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*.ace) unace x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
3
roles/base/files/users/root/bash/profile
Normal file
3
roles/base/files/users/root/bash/profile
Normal file
@@ -0,0 +1,3 @@
|
||||
if [ -f ~/.bashrc ]; then
|
||||
source ~/.bashrc
|
||||
fi
|
||||
113
roles/base/files/users/root/tmux/tmux.conf
Normal file
113
roles/base/files/users/root/tmux/tmux.conf
Normal file
@@ -0,0 +1,113 @@
|
||||
# Initial setup
|
||||
set -g default-terminal xterm-256color
|
||||
set -g status-keys vi
|
||||
|
||||
|
||||
# Set fish as the default shell
|
||||
#set-option -g default-shell "/usr/bin/fish"
|
||||
|
||||
|
||||
# use C-j and C-f for the prefix.
|
||||
set-option -g prefix C-j
|
||||
set-option -g prefix2 C-f
|
||||
unbind-key C-j
|
||||
bind-key C-j send-prefix
|
||||
set -g base-index 1
|
||||
|
||||
|
||||
# Easy config reload
|
||||
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
|
||||
|
||||
|
||||
# Easy clear history
|
||||
bind-key L clear-history
|
||||
|
||||
|
||||
# Double press <prefix> to move to last window
|
||||
bind-key C-f last-window
|
||||
bind-key C-j last-window
|
||||
|
||||
|
||||
# Lengthen the amount of time status messages are displayed
|
||||
set-option -g display-time 2000
|
||||
set-option -g display-panes-time 3000
|
||||
|
||||
|
||||
# Set the base-index to 1 rather than 0
|
||||
set -g base-index 1
|
||||
set-window-option -g pane-base-index 1
|
||||
|
||||
|
||||
# Automatically set window title
|
||||
set-window-option -g automatic-rename on
|
||||
set-option -g set-titles on
|
||||
|
||||
|
||||
# Key bindings for copy-paste
|
||||
setw -g mode-keys vi
|
||||
unbind p
|
||||
bind p paste-buffer
|
||||
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
||||
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
|
||||
|
||||
|
||||
|
||||
# Window activity monitor
|
||||
setw -g monitor-activity on
|
||||
set -g visual-activity on
|
||||
|
||||
|
||||
# Set easier window split keys
|
||||
bind-key v split-window -h
|
||||
bind-key h split-window -v
|
||||
|
||||
|
||||
# Use Alt-arrow keys without prefix key to switch panes
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
|
||||
|
||||
# Allow the arrow key to be used immediately after changing windows.
|
||||
set-option -g repeat-time 0
|
||||
|
||||
|
||||
# Shift arrow to switch windows
|
||||
bind -n S-Left previous-window
|
||||
bind -n S-Right next-window
|
||||
|
||||
|
||||
# Synchronize panes
|
||||
bind-key y set-window-option synchronize-panes
|
||||
|
||||
|
||||
# No delay for escape key press
|
||||
set -sg escape-time 0
|
||||
|
||||
|
||||
# Window activity monitor
|
||||
setw -g monitor-activity on
|
||||
set -g visual-activity on
|
||||
|
||||
|
||||
# Mouse Mode
|
||||
set -g mouse on
|
||||
|
||||
|
||||
# Theme
|
||||
set -g window-status-current-style bold,bg=colour247,fg=colour237
|
||||
set -g window-status-activity-style bg=blue,fg=black
|
||||
set-option -g message-style bg=colour237,fg=colour231
|
||||
set-option -g pane-border-style fg=colour247
|
||||
set-option -g pane-active-border-style fg=colour247
|
||||
|
||||
|
||||
# Status Bar
|
||||
set -g status-justify centre
|
||||
set -g status-bg black
|
||||
set -g status-fg white
|
||||
set -g status-interval 60
|
||||
set -g status-left-length 30
|
||||
set -g status-left '#[fg=colour237]#[bg=colour247,bold] #H #[bg=colour237] #[fg=colour247,nobold][#S] '
|
||||
set -g status-right '#[bg=colour237]#[fg=colour247] #(cut -d " " -f 1-3 /proc/loadavg)#[default]#[bg=colour237] #[bg=colour247]#[fg=colour237,bold] %H:%M '
|
||||
163
roles/base/files/users/root/vim/vimrc
Normal file
163
roles/base/files/users/root/vim/vimrc
Normal file
@@ -0,0 +1,163 @@
|
||||
" Set color scheme. Other good ones are bubblegum-256-dark, sorcerer, and zenburn
|
||||
colorscheme xoria256
|
||||
|
||||
" keyboard shortcuts
|
||||
let mapleader = ','
|
||||
noremap <leader>b :CtrlPBuffer<CR>
|
||||
nnoremap <leader>d :NERDTreeToggle<CR>
|
||||
nnoremap <leader>f :NERDTreeFind<CR>
|
||||
noremap <leader>p :CtrlP<CR>
|
||||
noremap <leader>P :CtrlPClearCache<CR>:CtrlP<CR>
|
||||
noremap <silent> <leader>r :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
|
||||
|
||||
" Switch buffers using ctrl+left or ctrl+right
|
||||
map <C-left> <ESC>:bp<CR>
|
||||
map <C-right> <ESC>:bn<CR>
|
||||
|
||||
" Move between windows easily
|
||||
noremap <leader><up> :wincmd k<CR>
|
||||
noremap <leader><down> :wincmd j<CR>
|
||||
noremap <leader><left> :wincmd h<CR>
|
||||
noremap <leader><right> :wincmd l<CR>
|
||||
noremap <leader>k :wincmd k<CR>
|
||||
noremap <leader>j :wincmd j<CR>
|
||||
noremap <leader>h :wincmd h<CR>
|
||||
noremap <leader>l :wincmd l<CR>
|
||||
|
||||
" Switch buffers using F5
|
||||
nnoremap <F5> :buffers<CR>:buffer<Space>
|
||||
|
||||
" Set keyboard shortcut for paste toggle.
|
||||
set pastetoggle=<F10>
|
||||
|
||||
map <F12> :call TrimWhiteSpace()<CR>
|
||||
" Removes trailing spaces
|
||||
func! TrimWhiteSpace()
|
||||
%s/\s*$//
|
||||
''
|
||||
:endfunction
|
||||
|
||||
" Airline
|
||||
"let g:airline_powerline_fonts=1
|
||||
"let g:airline#extensions#tabline#enabled = 1
|
||||
"let g:airline_theme='laederon'
|
||||
|
||||
" Clear search highlight with c-l
|
||||
noremap <silent> <c-l> :nohls<cr><c-l>
|
||||
|
||||
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
|
||||
map <space> /
|
||||
map <c-space> ?
|
||||
|
||||
let c_space_errors = 1
|
||||
|
||||
" Fix tmux background color
|
||||
if &term =~ '256color'
|
||||
set t_ut=
|
||||
endif
|
||||
|
||||
" Show line numbers
|
||||
set number
|
||||
|
||||
" Enable filetype plugins
|
||||
filetype plugin indent on
|
||||
|
||||
" Enable syntax highlighting
|
||||
syntax on
|
||||
|
||||
" Turn backup off
|
||||
set nobackup
|
||||
set nowb
|
||||
set noswapfile
|
||||
|
||||
" this turns off physical line wrapping (ie: automatic insertion of newlines)
|
||||
set textwidth=0 wrapmargin=0
|
||||
|
||||
" Enable auto-indent
|
||||
set ai
|
||||
|
||||
" Use spaces instead of tabs
|
||||
set expandtab
|
||||
|
||||
" Be smart when using tabs
|
||||
set smarttab
|
||||
|
||||
" 1 tab == 4 spaces
|
||||
set shiftwidth=4
|
||||
set tabstop=4
|
||||
|
||||
set ai "Auto indent
|
||||
set si "Smart indent
|
||||
|
||||
" Ignore case while searching
|
||||
set ignorecase
|
||||
|
||||
" Highlight search results
|
||||
set hlsearch
|
||||
|
||||
" Makes search act like search in modern browsers
|
||||
set incsearch
|
||||
|
||||
" Set utf8 as standard encoding and en_US as the standard language
|
||||
set encoding=utf8
|
||||
|
||||
" Use Unix as the standard file type
|
||||
set ffs=unix,dos,mac
|
||||
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
" Super useful! From an idea by Michael Naumann
|
||||
vnoremap <silent> * :call VisualSelection('f')<CR>
|
||||
vnoremap <silent> # :call VisualSelection('b')<CR>
|
||||
|
||||
" Return to the last edit position when opening files.
|
||||
augroup vimrcEx
|
||||
autocmd!
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal g`\"" |
|
||||
\ endif
|
||||
augroup END
|
||||
|
||||
" Ensure cursor is at the top of the file, if editing a git commit message:
|
||||
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
|
||||
|
||||
" Remember info about open buffers on close
|
||||
set viminfo^=%
|
||||
|
||||
" Returns true if paste mode is enabled
|
||||
function! HasPaste()
|
||||
if &paste
|
||||
return 'PASTE MODE '
|
||||
en
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Always show the status line
|
||||
set laststatus=2
|
||||
|
||||
" Format the status line
|
||||
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
|
||||
|
||||
" Delete trailing white space on save, useful for (Python)
|
||||
func! DeleteTrailingWS()
|
||||
exe "normal mz"
|
||||
%s/\s\+$//ge
|
||||
exe "normal `z"
|
||||
endfunc
|
||||
autocmd BufWrite *.py :call DeleteTrailingWS()
|
||||
|
||||
" in case you forgot to sudo
|
||||
cnoremap w!! %!sudo tee > /dev/null %
|
||||
|
||||
" Set the cursorline
|
||||
set cursorline
|
||||
|
||||
"hi cursorline gui=none
|
||||
augroup CursorlineOnlyInActiveWindow
|
||||
autocmd!
|
||||
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
|
||||
autocmd WinLeave * setlocal nocursorline
|
||||
augroup END
|
||||
|
||||
" Enhanced vim tweaks
|
||||
silent! source ~/.vimrc-extra
|
||||
142
roles/base/files/users/root/vim/xoria256.vim
Normal file
142
roles/base/files/users/root/vim/xoria256.vim
Normal file
@@ -0,0 +1,142 @@
|
||||
" Vim color file
|
||||
"
|
||||
" Name: xoria256.vim
|
||||
" Version: 1.5
|
||||
" Maintainer: Dmitriy Y. Zotikov (xio) <xio@ungrund.org>
|
||||
"
|
||||
" Should work in recent 256 color terminals. 88-color terms like urxvt are
|
||||
" NOT supported.
|
||||
"
|
||||
" Don't forget to install 'ncurses-term' and set TERM to xterm-256color or
|
||||
" similar value.
|
||||
"
|
||||
" Color numbers (0-255) see:
|
||||
" http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
|
||||
"
|
||||
" For a specific filetype highlighting rules issue :syntax list when a file of
|
||||
" that type is opened.
|
||||
|
||||
" Initialization {{{
|
||||
if &t_Co != 256 && ! has("gui_running")
|
||||
echomsg ""
|
||||
echomsg "err: please use GUI or a 256-color terminal (so that t_Co=256 could be set)"
|
||||
echomsg ""
|
||||
finish
|
||||
endif
|
||||
|
||||
set background=dark
|
||||
|
||||
hi clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let colors_name = "xoria256"
|
||||
"}}}
|
||||
" Colours {{{1
|
||||
"" General {{{2
|
||||
hi Normal ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none
|
||||
hi Cursor ctermbg=214 guibg=#ffaf00
|
||||
hi CursorColumn ctermbg=238 guibg=#444444
|
||||
hi CursorLine ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
hi Error ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
|
||||
hi ErrorMsg ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
|
||||
hi FoldColumn ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
|
||||
hi Folded ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
|
||||
hi IncSearch ctermfg=0 guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none
|
||||
hi LineNr ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
|
||||
hi MatchParen ctermfg=188 guifg=#dfdfdf ctermbg=68 guibg=#5f87df cterm=bold gui=bold
|
||||
" TODO
|
||||
" hi MoreMsg
|
||||
hi NonText ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 cterm=bold gui=bold
|
||||
hi Pmenu ctermfg=0 guifg=#000000 ctermbg=250 guibg=#bcbcbc
|
||||
hi PmenuSel ctermfg=255 guifg=#eeeeee ctermbg=243 guibg=#767676
|
||||
hi PmenuSbar ctermbg=252 guibg=#d0d0d0
|
||||
hi PmenuThumb ctermfg=243 guifg=#767676
|
||||
hi Search ctermfg=0 guifg=#000000 ctermbg=149 guibg=#afdf5f
|
||||
hi SignColumn ctermfg=248 guifg=#a8a8a8
|
||||
hi SpecialKey ctermfg=77 guifg=#5fdf5f
|
||||
hi SpellBad ctermfg=160 guifg=fg ctermbg=bg cterm=underline guisp=#df0000
|
||||
hi SpellCap ctermfg=189 guifg=#dfdfff ctermbg=bg guibg=bg cterm=underline gui=underline
|
||||
hi SpellRare ctermfg=168 guifg=#df5f87 ctermbg=bg guibg=bg cterm=underline gui=underline
|
||||
hi SpellLocal ctermfg=98 guifg=#875fdf ctermbg=bg guibg=bg cterm=underline gui=underline
|
||||
hi StatusLine ctermfg=15 guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold
|
||||
hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
hi TabLine ctermfg=fg guifg=fg ctermbg=242 guibg=#666666 cterm=none gui=none
|
||||
hi TabLineFill ctermfg=fg guifg=fg ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
" FIXME
|
||||
hi Title ctermfg=225 guifg=#ffdfff
|
||||
hi Todo ctermfg=0 guifg=#000000 ctermbg=184 guibg=#dfdf00
|
||||
hi Underlined ctermfg=39 guifg=#00afff cterm=underline gui=underline
|
||||
hi VertSplit ctermfg=237 guifg=#3a3a3a ctermbg=237 guibg=#3a3a3a cterm=none gui=none
|
||||
" hi VIsualNOS ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff cterm=none gui=none
|
||||
" hi Visual ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff
|
||||
hi Visual ctermfg=255 guifg=#eeeeee ctermbg=96 guibg=#875f87
|
||||
" hi Visual ctermfg=255 guifg=#eeeeee ctermbg=24 guibg=#005f87
|
||||
hi VisualNOS ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
|
||||
hi WildMenu ctermfg=0 guifg=#000000 ctermbg=150 guibg=#afdf87 cterm=bold gui=bold
|
||||
|
||||
"" Syntax highlighting {{{2
|
||||
hi Comment ctermfg=244 guifg=#808080
|
||||
hi Constant ctermfg=229 guifg=#ffffaf
|
||||
hi Identifier ctermfg=182 guifg=#dfafdf cterm=none
|
||||
hi Ignore ctermfg=238 guifg=#444444
|
||||
hi Number ctermfg=180 guifg=#dfaf87
|
||||
hi PreProc ctermfg=150 guifg=#afdf87
|
||||
hi Special ctermfg=174 guifg=#df8787
|
||||
hi Statement ctermfg=110 guifg=#87afdf cterm=none gui=none
|
||||
hi Type ctermfg=146 guifg=#afafdf cterm=none gui=none
|
||||
|
||||
"" Special {{{2
|
||||
""" .diff {{{3
|
||||
hi diffAdded ctermfg=150 guifg=#afdf87
|
||||
hi diffRemoved ctermfg=174 guifg=#df8787
|
||||
""" vimdiff {{{3
|
||||
hi diffAdd ctermfg=bg guifg=bg ctermbg=151 guibg=#afdfaf
|
||||
"hi diffDelete ctermfg=bg guifg=bg ctermbg=186 guibg=#dfdf87 cterm=none gui=none
|
||||
hi diffDelete ctermfg=bg guifg=bg ctermbg=246 guibg=#949494 cterm=none gui=none
|
||||
hi diffChange ctermfg=bg guifg=bg ctermbg=181 guibg=#dfafaf
|
||||
hi diffText ctermfg=bg guifg=bg ctermbg=174 guibg=#df8787 cterm=none gui=none
|
||||
""" HTML {{{3
|
||||
" hi htmlTag ctermfg=146 guifg=#afafdf
|
||||
" hi htmlEndTag ctermfg=146 guifg=#afafdf
|
||||
hi htmlTag ctermfg=244
|
||||
hi htmlEndTag ctermfg=244
|
||||
hi htmlArg ctermfg=182 guifg=#dfafdf
|
||||
hi htmlValue ctermfg=187 guifg=#dfdfaf
|
||||
hi htmlTitle ctermfg=254 ctermbg=95
|
||||
" hi htmlArg ctermfg=146
|
||||
" hi htmlTagName ctermfg=146
|
||||
" hi htmlString ctermfg=187
|
||||
""" django {{{3
|
||||
hi djangoVarBlock ctermfg=180
|
||||
hi djangoTagBlock ctermfg=150
|
||||
hi djangoStatement ctermfg=146
|
||||
hi djangoFilter ctermfg=174
|
||||
""" python {{{3
|
||||
hi pythonExceptions ctermfg=174
|
||||
""" NERDTree {{{3
|
||||
hi Directory ctermfg=110 guifg=#87afdf
|
||||
hi treeCWD ctermfg=180 guifg=#dfaf87
|
||||
hi treeClosable ctermfg=174 guifg=#df8787
|
||||
hi treeOpenable ctermfg=150 guifg=#afdf87
|
||||
hi treePart ctermfg=244 guifg=#808080
|
||||
hi treeDirSlash ctermfg=244 guifg=#808080
|
||||
hi treeLink ctermfg=182 guifg=#dfafdf
|
||||
|
||||
""" VimDebug {{{3
|
||||
" FIXME
|
||||
" you may want to set SignColumn highlight in your .vimrc
|
||||
" :help sign
|
||||
" :help SignColumn
|
||||
|
||||
" hi currentLine term=reverse cterm=reverse gui=reverse
|
||||
" hi breakPoint term=NONE cterm=NONE gui=NONE
|
||||
" hi empty term=NONE cterm=NONE gui=NONE
|
||||
|
||||
" sign define currentLine linehl=currentLine
|
||||
" sign define breakPoint linehl=breakPoint text=>>
|
||||
" sign define both linehl=currentLine text=>>
|
||||
" sign define empty linehl=empty
|
||||
|
||||
147
roles/base/files/users/root/zsh/zshrc
Normal file
147
roles/base/files/users/root/zsh/zshrc
Normal file
@@ -0,0 +1,147 @@
|
||||
###### Prompt
|
||||
prompt='%F{35}%* [%j] [%m:%F{75}%f%F{69}%c%f%F{35}] %F{black}%K{red}%#%f%k '
|
||||
|
||||
##### History
|
||||
|
||||
# Set history file
|
||||
HISTFILE=~/.zhistory
|
||||
|
||||
# Set history size
|
||||
HISTSIZE=10000
|
||||
|
||||
# Set the number of lines in $HISTFILE
|
||||
SAVEHIST="${HISTSIZE}"
|
||||
|
||||
# Enable history search with up and down arrows
|
||||
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
|
||||
[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search
|
||||
[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search
|
||||
|
||||
|
||||
##### Aliases
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../../../'
|
||||
alias ....='cd ../../../../'
|
||||
alias back='cd $OLDPWD'
|
||||
alias c='clear'
|
||||
alias cd..='cd ..'
|
||||
alias cp='cp -iv'
|
||||
alias chmod="chmod -c"
|
||||
alias chown="chown -c"
|
||||
alias e="vim -O "
|
||||
alias E="vim -o "
|
||||
alias egrep='egrep --colour=auto'
|
||||
alias extip='curl icanhazip.com'
|
||||
alias grep='grep --color=auto'
|
||||
alias l.='ls -lhFa --time-style=long-iso --color=auto'
|
||||
alias ll='ls'
|
||||
alias ln='ln -iv'
|
||||
alias ls='ls -lhF --color=auto --human-readable --time-style=long-iso --classify'
|
||||
alias lsmount='mount |column -t'
|
||||
alias mkdir='mkdir -pv'
|
||||
alias mv='mv -iv'
|
||||
alias ports='netstat -tulanp'
|
||||
alias h='history -i'
|
||||
alias history='history -i'
|
||||
alias j='jobs -l'
|
||||
alias rm='rm -iv'
|
||||
alias rmdir='rmdir -v'
|
||||
alias speedtest='curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -'
|
||||
alias ssha='eval $(ssh-agent) && ssh-add'
|
||||
alias svim='sudo vim'
|
||||
alias tn=' tmux new -s'
|
||||
alias wget='wget -c'
|
||||
|
||||
if command -v colordiff > /dev/null 2>&1; then
|
||||
alias diff="colordiff -Nuar"
|
||||
else
|
||||
alias diff="diff -Nuar"
|
||||
fi
|
||||
|
||||
## get top process eating memory
|
||||
alias psmem='ps auxf | sort -nr -k 4'
|
||||
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
|
||||
|
||||
## get top process eating cpu ##
|
||||
alias pscpu='ps auxf | sort -nr -k 3'
|
||||
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
|
||||
|
||||
# Safetynets
|
||||
# do not delete / or prompt if deleting more than 3 files at a time #
|
||||
alias rm='rm -I --preserve-root'
|
||||
|
||||
# Parenting changing perms on / #
|
||||
alias chown='chown --preserve-root'
|
||||
alias chmod='chmod --preserve-root'
|
||||
alias chgrp='chgrp --preserve-root'
|
||||
|
||||
# package management
|
||||
alias update='sudo apt-get update'
|
||||
alias upgrade='sudo apt-get update && sudo apt-get dist-upgrade'
|
||||
alias install='sudo apt-get install'
|
||||
|
||||
##### Functions
|
||||
|
||||
# Easily extract archives
|
||||
extract () {
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjvf $1 ;;
|
||||
*.tar.gz) tar xzvf $1 ;;
|
||||
*.bz2) bzip2 -d $1 ;;
|
||||
*.rar) unrar2dir $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip2dir $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*.ace) unace x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
reload () {
|
||||
exec "${SHELL}" "$@"
|
||||
}
|
||||
|
||||
|
||||
##### shopt
|
||||
|
||||
# save timestamp of command and duration
|
||||
setopt extended_history
|
||||
|
||||
# Add commands as they are typed, don't wait until shell exit
|
||||
setopt inc_append_history
|
||||
|
||||
# when trimming history, lose oldest duplicates first
|
||||
setopt hist_expire_dups_first
|
||||
|
||||
# Do not write events to history that are duplicates of previous events
|
||||
setopt hist_ignore_dups
|
||||
|
||||
# remove command line from history list when first character on the line is a space
|
||||
setopt hist_ignore_space
|
||||
|
||||
# When searching history don't display results already cycled through twice
|
||||
setopt hist_find_no_dups
|
||||
|
||||
# don't execute, just expand history
|
||||
setopt hist_verify
|
||||
|
||||
# Stop annoying error when using asterisk in shell commands (i.e. scp server:*.txt .)
|
||||
setopt nonomatch
|
||||
|
||||
# extended globbing, awesome!
|
||||
setopt extendedGlob
|
||||
|
||||
# Turn on command substitution in the prompt (and parameter expansion and arithmetic expansion).
|
||||
setopt promptsubst
|
||||
1
roles/base/files/users/sudoers_bzoicas
Normal file
1
roles/base/files/users/sudoers_bzoicas
Normal file
@@ -0,0 +1 @@
|
||||
bzoicas ALL=(ALL) NOPASSWD: ALL
|
||||
22
roles/base/handlers/main.yml
Normal file
22
roles/base/handlers/main.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
- name: apt_update
|
||||
apt: update_cache=yes
|
||||
|
||||
- name: restart_sshd
|
||||
service:
|
||||
name: "{{ openssh_service }}"
|
||||
state: restarted
|
||||
|
||||
- name: update_tmux_plugin_perms
|
||||
file:
|
||||
path: /home/bzoicas/.tmux/plugins
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
recurse: true
|
||||
|
||||
- name: update_vim_bundle_perms
|
||||
file:
|
||||
path: /home/bzoicas/.vim/bundle
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
recurse: true
|
||||
53
roles/base/tasks/ansible_setup.yml
Normal file
53
roles/base/tasks/ansible_setup.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
- name: ansible setup | ensure ansible is the latest version
|
||||
tags: ansible,ansible-setup
|
||||
package:
|
||||
name: ansible
|
||||
state: latest
|
||||
|
||||
- name: ansible setup | install required packages
|
||||
tags: ansible,ansible-setup,packages
|
||||
package:
|
||||
name:
|
||||
- "{{ dconf_package }}"
|
||||
- "{{ python_psutil_package }}"
|
||||
|
||||
# Note: For Arch, the requirement is met by a dependency of systemd, only necessary on Debian-based
|
||||
- name: ansible setup | install acl package
|
||||
tags: ansible,ansible-setup,packages
|
||||
package:
|
||||
name: acl
|
||||
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
|
||||
|
||||
- name: ansible setup | create ansible log file
|
||||
tags: ansible,ansible-setup
|
||||
file:
|
||||
path: /var/log/ansible.log
|
||||
owner: bzoicas
|
||||
group: root
|
||||
mode: 0664
|
||||
state: touch
|
||||
changed_when: False
|
||||
|
||||
- name: ansible setup | add logrotate config for ansible log file
|
||||
tags: ansible-setup
|
||||
copy:
|
||||
src: files/ansible_setup/logrotate
|
||||
dest: /etc/logrotate.d/ansible
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: ansible setup | remove default ansible directory (/etc/ansible) from host
|
||||
tags: ansible,ansible-setup
|
||||
file:
|
||||
path: /etc/ansible
|
||||
state: absent
|
||||
|
||||
- name: ansible setup | generate provision script from template
|
||||
tags: ansible,ansible-setup,scripts
|
||||
template:
|
||||
src: provision.sh.j2
|
||||
dest: /usr/local/bin/provision
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
30
roles/base/tasks/main.yml
Normal file
30
roles/base/tasks/main.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
# Load distro-specific variables
|
||||
- include_vars: "{{ ansible_distribution }}.yml"
|
||||
tags: always
|
||||
|
||||
- block:
|
||||
# Make sure users exist on the system
|
||||
- import_tasks: users/bzoicas.yml
|
||||
- import_tasks: users/root.yml
|
||||
|
||||
# Set up the ansible environment
|
||||
- import_tasks: ansible_setup.yml
|
||||
|
||||
# install software
|
||||
- import_tasks: software/repositories.yml
|
||||
- import_tasks: software/packages_development.yml
|
||||
- import_tasks: software/packages_cleanup.yml
|
||||
- import_tasks: software/packages_utilities.yml
|
||||
- import_tasks: software/packages_pip.yml
|
||||
|
||||
# Perform remaining tasks:
|
||||
- import_tasks: system_setup/clock.yml
|
||||
- import_tasks: system_setup/locale.yml
|
||||
- import_tasks: system_setup/logging.yml
|
||||
- import_tasks: system_setup/memory.yml
|
||||
- import_tasks: system_setup/microcode.yml
|
||||
- import_tasks: system_setup/openssh.yml
|
||||
- import_tasks: system_setup/scripts.yml
|
||||
|
||||
rescue:
|
||||
- set_fact: task_failed=true
|
||||
10
roles/base/tasks/software/packages_cleanup.yml
Normal file
10
roles/base/tasks/software/packages_cleanup.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- name: system setup | package cleanup | remove unneeded packages (debian, ubuntu, etc)
|
||||
tags: cleanup,packages,system,settings
|
||||
package:
|
||||
state: absent
|
||||
name:
|
||||
- cowsay
|
||||
- exim4
|
||||
- exim4-base
|
||||
- exim4-config
|
||||
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
|
||||
16
roles/base/tasks/software/packages_development.yml
Normal file
16
roles/base/tasks/software/packages_development.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
- name: system setup | development packages | install packages
|
||||
tags: dev,development,packages,python,ruby
|
||||
package:
|
||||
name:
|
||||
- git
|
||||
- perl
|
||||
- "{{ python_flake8_package }}"
|
||||
- "{{ python_package }}"
|
||||
- "{{ python_pip_package }}"
|
||||
- "{{ python_pyflakes_package }}"
|
||||
- python-setuptools
|
||||
- "{{ python_virtualenv_package }}"
|
||||
- ruby
|
||||
- "{{ ruby_rake_package }}"
|
||||
- tig
|
||||
state: latest
|
||||
7
roles/base/tasks/software/packages_pip.yml
Normal file
7
roles/base/tasks/software/packages_pip.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
# - name: system setup | pip packages | install bpytop
|
||||
# tags: bpytop,packages,pip,python
|
||||
# become_user: bzoicas
|
||||
# pip:
|
||||
# executable: /usr/bin/pip3
|
||||
# state: latest
|
||||
# name: bpytop
|
||||
53
roles/base/tasks/software/packages_utilities.yml
Normal file
53
roles/base/tasks/software/packages_utilities.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
- name: system setup | utilities | install utility packages
|
||||
tags: packages,system,settings
|
||||
package:
|
||||
state: latest
|
||||
name:
|
||||
- at
|
||||
- colordiff
|
||||
- curl
|
||||
#- "{{ dns_utils_package}}"
|
||||
- htop
|
||||
- iotop
|
||||
- "{{ lm_sensors_package }}"
|
||||
- lsof
|
||||
- mc
|
||||
- ncdu
|
||||
- neofetch
|
||||
- net-tools
|
||||
- "{{ nfs_client_package }}"
|
||||
- nmap
|
||||
- "{{ rename_package }}"
|
||||
- rsync
|
||||
- screen
|
||||
- sshfs
|
||||
- tmux
|
||||
- terminator
|
||||
- traceroute
|
||||
- "{{ vim_package }}"
|
||||
- wget
|
||||
- whois
|
||||
- zsh
|
||||
- clusterssh
|
||||
- conky
|
||||
#- conky-manager
|
||||
- redshift
|
||||
- ansible
|
||||
- lutris
|
||||
- gftp
|
||||
#- vlc
|
||||
- fedora-workstation-repositories
|
||||
- epel-release
|
||||
- nextcloud-client
|
||||
- dia
|
||||
- docker-ce
|
||||
|
||||
|
||||
- name: system setup | utilities | install man-pages (arch)
|
||||
tags: packages,system,settings
|
||||
pacman:
|
||||
state: latest
|
||||
name:
|
||||
- man-db
|
||||
- man-pages
|
||||
when: ansible_distribution == "Archlinux"
|
||||
33
roles/base/tasks/software/repositories.yml
Normal file
33
roles/base/tasks/software/repositories.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
- name: system setup | repositories | add ignored packages for archlinux hosts
|
||||
tags: packages,repositories
|
||||
lineinfile:
|
||||
dest: /etc/pacman.conf
|
||||
regexp: "^#?IgnorePkg"
|
||||
line: "IgnorePkg = ansible linux linux-headers linux-lts linux-lts-headers"
|
||||
when: ansible_distribution == "Archlinux"
|
||||
|
||||
- name: system setup | repositories | add sources.list for debian hosts
|
||||
tags: non-free,repositories
|
||||
copy:
|
||||
src: distribution_packages/debian_sources.list
|
||||
dest: /etc/apt/sources.list
|
||||
backup: yes
|
||||
notify: apt_update
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
- name: system setup | repositories | add debian-backports
|
||||
tags: backports,repositories
|
||||
apt_repository:
|
||||
repo: deb http://deb.debian.org/debian buster-backports main
|
||||
filename: debian-backports
|
||||
notify: apt_update
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
- name: system setup | repositories | install package management tools (debian-based)
|
||||
tags: packages,system,settings
|
||||
package:
|
||||
name:
|
||||
- aptitude
|
||||
- software-properties-common
|
||||
state: latest
|
||||
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
|
||||
27
roles/base/tasks/system_setup/clock.yml
Normal file
27
roles/base/tasks/system_setup/clock.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
- name: system setup | clock | install systemd-timesyncd (ubuntu)
|
||||
tags: ntp,system setup
|
||||
package:
|
||||
name: systemd-timesyncd
|
||||
state: latest
|
||||
when: ansible_distribution in ["Pop!_OS", "Ubuntu"]
|
||||
|
||||
# Currently systemd-timesyncd for debian is available only in buster-backports
|
||||
- name: system setup | clock | install systemd-timesyncd (debian)
|
||||
tags: ntp,system setup
|
||||
apt:
|
||||
name: systemd-timesyncd
|
||||
default_release: buster-backports
|
||||
state: latest
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
- name: system setup | clock | start and enable systemd-timesyncd
|
||||
tags: ntp,system settiings
|
||||
service:
|
||||
name: systemd-timesyncd
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: system setup | clock | set time zone
|
||||
tags: ntp,timezone,system setup
|
||||
timezone:
|
||||
name: "America/Detroit"
|
||||
24
roles/base/tasks/system_setup/locale.yml
Normal file
24
roles/base/tasks/system_setup/locale.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
# - name: system setup | locale | add en_US
|
||||
# tags: locale,system,setup
|
||||
# locale_gen:
|
||||
# name: en_US.UTF-8
|
||||
# state: present
|
||||
|
||||
# - name: system setup | locale | set locale to en_US
|
||||
# tags: locale,system,setup
|
||||
# locale_gen:
|
||||
# name: en_US.UTF-8
|
||||
# state: present
|
||||
# register: locale
|
||||
|
||||
# - name: system setup | locale | set en_US as default locale
|
||||
# tags: locale,system,setup
|
||||
# command: localectl set-locale LANG=en_US.UTF-8
|
||||
# when: locale.changed
|
||||
|
||||
# - name: system setup | locale | remove en_GB
|
||||
# tags: locale,system,setup
|
||||
# locale_gen:
|
||||
# name: en_GB.UTF-8
|
||||
# state: absent
|
||||
# when: locale.changed
|
||||
13
roles/base/tasks/system_setup/logging.yml
Normal file
13
roles/base/tasks/system_setup/logging.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
- name: system setup | logging | adjust retention period
|
||||
tags: systemd,journal,journald,sysctl,system setup
|
||||
lineinfile:
|
||||
dest: "/etc/systemd/journald.conf"
|
||||
regexp: "^#MaxFileSec="
|
||||
line: "MaxFileSec=5day"
|
||||
register: journald_config
|
||||
|
||||
- name: system setup | logging | restart journald (config changed)
|
||||
service:
|
||||
name: systemd-journald
|
||||
state: restarted
|
||||
when: journald_config.changed
|
||||
26
roles/base/tasks/system_setup/memory.yml
Normal file
26
roles/base/tasks/system_setup/memory.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
- name: system setup | memory | adjust current swappiness
|
||||
tags: swappiness,sysctl,system,setup
|
||||
lineinfile:
|
||||
dest: "/etc/sysctl.conf"
|
||||
create: yes
|
||||
regexp: "swappiness ="
|
||||
line: "vm.swappiness = 5"
|
||||
register: swappiness
|
||||
|
||||
- name: system setup | memory | apply swappiness
|
||||
tags: swappiness,sysctl,system,setup
|
||||
command: sysctl vm.swappiness={{ swappiness_value }}
|
||||
when: swappiness.changed
|
||||
|
||||
- name: system setup | memory | install earlyoom package
|
||||
tags: earlyoom,packages,system,setup
|
||||
package:
|
||||
name: earlyoom
|
||||
state: latest
|
||||
|
||||
- name: system setup | memory | enable and start earlyoom
|
||||
tags: earlyoom,packages,system,setup
|
||||
service:
|
||||
name: earlyoom
|
||||
enabled: yes
|
||||
state: started
|
||||
17
roles/base/tasks/system_setup/microcode.yml
Normal file
17
roles/base/tasks/system_setup/microcode.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
- name: system setup | microcode | install package for amd
|
||||
tags: amd,cpu,microcode,system setup
|
||||
package:
|
||||
name: "{{ amd_microcode_package }}"
|
||||
state: latest
|
||||
when:
|
||||
- microcode_amd_install is defined
|
||||
- microcode_amd_install == true
|
||||
|
||||
- name: system setup | microcode | install package for intel
|
||||
tags: cpu,intel,microcode,system setup
|
||||
package:
|
||||
name: "{{ intel_microcode_package }}"
|
||||
state: latest
|
||||
when:
|
||||
- microcode_intel_install is defined
|
||||
- microcode_intel_install == true
|
||||
32
roles/base/tasks/system_setup/openssh.yml
Normal file
32
roles/base/tasks/system_setup/openssh.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
- name: system setup | openssh | install or update daemon package
|
||||
tags: openssh,ssh,system,settings
|
||||
package:
|
||||
name: "{{ openssh_package }}"
|
||||
state: latest
|
||||
notify: restart_sshd
|
||||
|
||||
- name: system setup | openssh | enable daemon
|
||||
tags: openssh,ssh,system,settings
|
||||
service:
|
||||
name: "{{ openssh_service }}"
|
||||
enabled: yes
|
||||
state: started
|
||||
|
||||
- name: system setup | openssh | generate sshd_config file from template
|
||||
tags: openssh,ssh,system,settings
|
||||
template:
|
||||
src: sshd_config.j2
|
||||
dest: /etc/ssh/sshd_config
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart_sshd
|
||||
|
||||
- name: system setup | openssh | copy issue.net
|
||||
tags: openssh,ssh,system,settings
|
||||
copy:
|
||||
src: system_setup/openssh_issue.net
|
||||
dest: /etc/issue.net
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
18
roles/base/tasks/system_setup/scripts.yml
Normal file
18
roles/base/tasks/system_setup/scripts.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
- name: system setup | scripts | copy image_prep.sh script
|
||||
tags: scripts
|
||||
copy:
|
||||
src: system_setup/image_prep.sh
|
||||
dest: /usr/local/bin/image_prep.sh
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
|
||||
- name: system setup | scripts | copy pi_cpu_temp.py script
|
||||
tags: scripts
|
||||
copy:
|
||||
src: system_setup/pi_cpu_temp.py
|
||||
dest: /usr/local/bin/cpu_temp
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
when: ansible_architecture == "aarch64"
|
||||
223
roles/base/tasks/users/bzoicas.yml
Normal file
223
roles/base/tasks/users/bzoicas.yml
Normal file
@@ -0,0 +1,223 @@
|
||||
- name: users | bzoicas | install git
|
||||
tags: dev,development,packages,python,ruby
|
||||
package:
|
||||
name:
|
||||
- git
|
||||
state: latest
|
||||
|
||||
- name: users | bzoicas | create group
|
||||
tags: groups,bzoicas,users
|
||||
group:
|
||||
name: bzoicas
|
||||
state: present
|
||||
|
||||
- name: users | bzoicas | create user
|
||||
tags: bzoicas,sudo,users
|
||||
user:
|
||||
name: bzoicas
|
||||
group: bzoicas
|
||||
groups: vboxsf,adm,{{ sudo_group }}
|
||||
state: present
|
||||
comment: "BZo"
|
||||
password: "{{ bzoicas_passwd }}"
|
||||
shell: /bin/bash
|
||||
|
||||
- name: users | bzoicas | bzoicas | add sudoers file
|
||||
tags: bzoicas,settings,sudo,system,users
|
||||
copy:
|
||||
src: users/sudoers_bzoicas
|
||||
dest: /etc/sudoers.d/bzoicas
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0440
|
||||
|
||||
- name: users | bzoicas | create .ssh directory
|
||||
tags: dotfiles,bzoicas,ssh,users
|
||||
file:
|
||||
path: "{{ item.dir }}"
|
||||
state: directory
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
mode: 0700
|
||||
with_items:
|
||||
- { dir: '/home/bzoicas/.ssh' }
|
||||
|
||||
- name: users | bzoicas | add public key
|
||||
tags: dotfiles,bzoicas,ssh,ssh-keys,users
|
||||
authorized_key:
|
||||
user: bzoicas
|
||||
key: "{{ item }}"
|
||||
with_file:
|
||||
- users/bzoicas/ssh/bzoicas_id_rsa.pub
|
||||
|
||||
- name: users | bzoicas | create config directories
|
||||
tags: dotfiles,bzoicas,tmux,users,vim,zsh
|
||||
file:
|
||||
path: /home/bzoicas/{{ item.dir }}
|
||||
state: directory
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
mode: 0700
|
||||
with_items:
|
||||
- { dir: '.bash' }
|
||||
- { dir: '.config' }
|
||||
- { dir: '.config/htop' }
|
||||
- { dir: '.config/mc' }
|
||||
- { dir: '.tmux' }
|
||||
- { dir: '.tmux/config' }
|
||||
- { dir: '.tmux/plugins' }
|
||||
- { dir: '.vim' }
|
||||
- { dir: '.vim/autoload' }
|
||||
- { dir: '.vim/bundle' }
|
||||
- { dir: '.vim/colors' }
|
||||
- { dir: '.vim/ftplugin' }
|
||||
- { dir: '.zsh' }
|
||||
|
||||
- name: users | bzoicas | copy tmux config (server version)
|
||||
tags: dotfiles,users,bzoicas,tmux,users,vim,zsh
|
||||
copy:
|
||||
src: users/bzoicas/tmux/tmux.conf.server
|
||||
dest: /home/bzoicas/.tmux.conf
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
mode: 0600
|
||||
when: "'server' not in group_names"
|
||||
|
||||
- name: users | bzoicas | copy tmux config (workstation version)
|
||||
tags: dotfiles,users,bzoicas,tmux,users,vim,zsh
|
||||
copy:
|
||||
src: users/bzoicas/tmux/tmux.conf.workstation
|
||||
dest: /home/bzoicas/.tmux.conf
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
mode: 0600
|
||||
when: "'server' in group_names"
|
||||
|
||||
- name: users | bzoicas | copy dotfiles
|
||||
tags: dotfiles,users,bzoicas,tmux,users,vim,zsh
|
||||
copy:
|
||||
src: users/bzoicas/{{ item.src }}
|
||||
dest: /home/bzoicas/{{ item.dest }}
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
mode: 0600
|
||||
with_items:
|
||||
- { src: 'bash/bash_aliases', dest: '.bash/bash_aliases' }
|
||||
- { src: 'bash/bash_profile', dest: '.bash_profile' }
|
||||
- { src: 'bash/bash_prompt', dest: '.bash/bash_prompt' }
|
||||
- { src: 'bash/bash_functions', dest: '.bash/bash_functions' }
|
||||
- { src: 'bash/bashrc', dest: '.bashrc' }
|
||||
- { src: 'bash/profile', dest: '.profile' }
|
||||
- { src: 'git/gitconfig', dest: '.gitconfig' }
|
||||
- { src: 'htop/htoprc', dest: '.config/htop/htoprc' }
|
||||
- { src: 'inputrc', dest: '.inputrc' }
|
||||
- { src: 'mc/mc.ini', dest: '.config/mc/ini' }
|
||||
- { src: 'vim/vimrc', dest: '.vimrc' }
|
||||
- { src: 'zsh/zshrc', dest: '.zshrc' }
|
||||
|
||||
# - name: users | bzoicas | clone tmux-completion plugin repository
|
||||
# tags: dotfiles,bzoicas,users,tmux
|
||||
# git:
|
||||
# repo: https://github.com/srsudar/tmux-completion.git
|
||||
# dest: /home/bzoicas/.tmux/plugins/completion
|
||||
# force: yes
|
||||
# notify: update_tmux_plugin_perms
|
||||
|
||||
# - name: users | bzoicas | clone tmux-continuum plugin repository
|
||||
# tags: dotfiles,bzoicas,users,tmux
|
||||
# git:
|
||||
# repo: https://github.com/tmux-plugins/tmux-continuum
|
||||
# dest: /home/bzoicas/.tmux/plugins/continuum
|
||||
# force: yes
|
||||
# notify: update_tmux_plugin_perms
|
||||
|
||||
# - name: users | bzoicas | clone tmux-resurrect plugin repository
|
||||
# tags: dotfiles,bzoicas,users,tmux
|
||||
# git:
|
||||
# repo: https://github.com/tmux-plugins/tmux-resurrect
|
||||
# dest: /home/bzoicas/.tmux/plugins/resurrect
|
||||
# force: yes
|
||||
# notify: update_tmux_plugin_perms
|
||||
|
||||
- name: users | bzoicas | copy individual zsh config files
|
||||
tags: dotfiles,bzoicas,users,zsh
|
||||
copy:
|
||||
src: users/bzoicas/zsh/{{ item.src }}
|
||||
dest: /home/bzoicas/.zsh/{{ item.src }}
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
mode: 0600
|
||||
with_items:
|
||||
- { src: 'aliases.zsh' }
|
||||
- { src: 'bindkey.zsh' }
|
||||
- { src: 'completion.zsh' }
|
||||
- { src: 'exports.zsh' }
|
||||
- { src: 'functions.zsh' }
|
||||
- { src: 'history.zsh' }
|
||||
- { src: 'path.zsh' }
|
||||
- { src: 'plugins.zsh' }
|
||||
- { src: 'prompt.zsh' }
|
||||
- { src: 'setopt.zsh' }
|
||||
- { src: 'theming.zsh' }
|
||||
|
||||
- name: users | bzoicas | copy vim ftype files
|
||||
tags: dotfiles,bzoicas,users,vim
|
||||
copy:
|
||||
src: users/bzoicas/vim/{{ item.src }}
|
||||
dest: /home/bzoicas/.vim/ftplugin/{{ item.src }}
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
mode: 0600
|
||||
with_items:
|
||||
- { src: 'cmake.vim' }
|
||||
- { src: 'cpp.vim' }
|
||||
- { src: 'html.vim' }
|
||||
- { src: 'perl.vim' }
|
||||
- { src: 'python.vim' }
|
||||
- { src: 'ruby.vim' }
|
||||
- { src: 'sql.vim' }
|
||||
- { src: 'xml.vim' }
|
||||
|
||||
- name: users | bzoicas | copy vim color files
|
||||
tags: dotfiles,bzoicas,users,vim
|
||||
copy:
|
||||
src: users/bzoicas/vim/{{ item.src }}
|
||||
dest: /home/bzoicas/.vim/colors/{{ item.src }}
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
mode: 0600
|
||||
with_items:
|
||||
- { src: 'bubblegum-256-dark.vim' }
|
||||
- { src: 'darktango.vim' }
|
||||
- { src: 'jellybeans.vim' }
|
||||
- { src: 'xoria256.vim' }
|
||||
- { src: 'zenburn.vim' }
|
||||
|
||||
- name: users | bzoicas | install pathogen
|
||||
tags: dotfiles,bzoicas,users,vim
|
||||
copy:
|
||||
src: users/bzoicas/vim/{{ item.src }}
|
||||
dest: "{{ item.dest }}"
|
||||
owner: bzoicas
|
||||
group: bzoicas
|
||||
mode: 0700
|
||||
with_items:
|
||||
- { src: 'pathogen.vim', dest: '/home/bzoicas/.vim/autoload/pathogen.vim' }
|
||||
|
||||
- name: users | bzoicas | checkout git repositories
|
||||
tags: git,users,bzoicas
|
||||
become: yes
|
||||
git:
|
||||
repo: "{{ item.repo }}"
|
||||
dest: "{{ item.dest }}"
|
||||
force: yes
|
||||
with_items:
|
||||
- { repo: 'https://github.com/ctrlpvim/ctrlp.vim.git', dest: '/home/bzoicas/.vim/bundle/ctrlp.vim' }
|
||||
- { repo: 'https://github.com/davidhalter/jedi-vim.git', dest: '/home/bzoicas/.vim/bundle/jedi-vim' }
|
||||
- { repo: 'https://github.com/pearofducks/ansible-vim', dest: '/home/bzoicas/.vim/bundle/ansible-vim' }
|
||||
- { repo: 'https://github.com/rhysd/vim-grammarous.git', dest: '/home/bzoicas/.vim/bundle/vim-grammarous' }
|
||||
- { repo: 'https://github.com/ron89/thesaurus_query.vim', dest: '/home/bzoicas/.vim/bundle/thesaurus_query' }
|
||||
- { repo: 'https://github.com/scrooloose/nerdtree.git', dest: '/home/bzoicas/.vim/bundle/nerdtree' }
|
||||
- { repo: 'https://github.com/tpope/vim-obsession.git', dest: '/home/bzoicas/.vim/bundle/vim-obsession' }
|
||||
- { repo: 'https://github.com/vim-syntastic/syntastic.git', dest: '/home/bzoicas/.vim/bundle/syntastic' }
|
||||
notify: update_vim_bundle_perms
|
||||
33
roles/base/tasks/users/root.yml
Normal file
33
roles/base/tasks/users/root.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
- name: users | root | ensure account is locked
|
||||
user:
|
||||
name: root
|
||||
password_lock: yes
|
||||
|
||||
- name: users | root | create config directories
|
||||
file:
|
||||
path: /root/{{ item.dir }}
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0700
|
||||
with_items:
|
||||
- { dir: '.vim' }
|
||||
- { dir: '.vim/colors' }
|
||||
tags: dotfiles
|
||||
|
||||
- name: users | root | copy dotfiles
|
||||
copy:
|
||||
src: users/root/{{ item.src }}
|
||||
dest: /root/{{ item.dest}}
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
with_items:
|
||||
- { src: 'bash/bashrc', dest: '.bashrc' }
|
||||
- { src: 'bash/bash_profile', dest: '.bash_profile' }
|
||||
- { src: 'bash/profile', dest: '.profile' }
|
||||
- { src: 'tmux/tmux.conf', dest: '.tmux.conf' }
|
||||
- { src: 'vim/vimrc', dest: '.vimrc' }
|
||||
- { src: 'vim/xoria256.vim', dest: '.vim/colors/xoria256.vim' }
|
||||
- { src: 'zsh/zshrc', dest: '.zshrc' }
|
||||
tags: dotfiles
|
||||
22
roles/base/templates/provision.sh.j2
Normal file
22
roles/base/templates/provision.sh.j2
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# options
|
||||
ANSIBLEUSER="<ansible-user-name>"
|
||||
BRANCH="{{ branch | default('master') }}"
|
||||
LOGFILE="/var/log/ansible.log"
|
||||
REPO="<https://url-to-git-server/ansible.git>"
|
||||
VAULT_KEY="</path/to/ansible_vault_key">
|
||||
PRECMD="sudo systemd-inhibit --who='ansible-pull' --why='provisioning'"
|
||||
|
||||
# check if ansible-pull is already running, and if not, run it
|
||||
if pgrep -f ansible-pull; then
|
||||
printf "\n$(date +"%Y-%m-%d %H:%M:%S") A running ansible-pull process was found.\nExiting.\n"\
|
||||
|tee -a $LOGFILE
|
||||
exit 1
|
||||
else
|
||||
if [ ! $1 == "" ]; then
|
||||
$PRECMD sudo -iH -u $ANSIBLEUSER ansible-pull --vault-password-file=$VAULT_KEY -U $REPO -C $BRANCH --tags $1 2>&1
|
||||
else
|
||||
$PRECMD sudo -iH -u $ANSIBLEUSER ansible-pull --vault-password-file=$VAULT_KEY -o -U $REPO -C $BRANCH 2>&1
|
||||
fi
|
||||
fi
|
||||
33
roles/base/templates/sshd_config.j2
Normal file
33
roles/base/templates/sshd_config.j2
Normal file
@@ -0,0 +1,33 @@
|
||||
Banner /etc/issue.net
|
||||
PrintMOTD no
|
||||
|
||||
Port {{ ssh_port |default(22) }}
|
||||
Protocol 2
|
||||
|
||||
# Authentication:
|
||||
AllowUsers {{ ssh_users | default("bzoicas") }}
|
||||
ChallengeResponseAuthentication no
|
||||
HostbasedAuthentication no
|
||||
LoginGraceTime 120
|
||||
PasswordAuthentication {{ passwd_auth | default("no") }}
|
||||
PermitEmptyPasswords no
|
||||
PermitRootLogin no
|
||||
PubkeyAuthentication yes
|
||||
StrictModes yes
|
||||
UsePAM yes
|
||||
|
||||
# Security
|
||||
HostKey /etc/ssh/ssh_host_dsa_key
|
||||
HostKey /etc/ssh/ssh_host_ecdsa_key
|
||||
HostKey /etc/ssh/ssh_host_ed25519_key
|
||||
HostKey /etc/ssh/ssh_host_rsa_key
|
||||
IgnoreRhosts yes
|
||||
|
||||
# Misc. options
|
||||
AcceptEnv LANG LC_*
|
||||
TCPKeepAlive yes
|
||||
Subsystem sftp {{ sftp_path }}
|
||||
|
||||
# Logging
|
||||
SyslogFacility AUTH
|
||||
LogLevel INFO
|
||||
20
roles/base/vars/Archlinux.yml
Normal file
20
roles/base/vars/Archlinux.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
amd_microcode_package: amd-ucode
|
||||
cron_package: cronie
|
||||
dconf_package: dconf
|
||||
dns_utils_package: bind-tools
|
||||
intel_microcode_package: intel-ucode
|
||||
lm_sensors_package: lm_sensors
|
||||
nfs_client_package: nfs-utils
|
||||
openssh_package: openssh
|
||||
openssh_service: sshd
|
||||
python_flake8_package: python-pyflakes
|
||||
python_package: python
|
||||
python_pip_package: python-pip
|
||||
python_psutil_package: python-psutil
|
||||
python_pyflakes_package: python-pyflakes
|
||||
python_virtualenv_package: python-virtualenv
|
||||
rename_package: perl-rename
|
||||
ruby_rake_package: ruby-rake
|
||||
sftp_path: /usr/lib/ssh/sftp-server
|
||||
sudo_group: wheel
|
||||
vim_package: gvim
|
||||
20
roles/base/vars/Debian.yml
Normal file
20
roles/base/vars/Debian.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
amd_microcode_package: amd64-microcode
|
||||
cron_package: cron
|
||||
dconf_package: dconf-cli
|
||||
dns_utils_package: dnsutils
|
||||
intel_microcode_package: intel-microcode
|
||||
lm_sensors_package: lm-sensors
|
||||
nfs_client_package: nfs-common
|
||||
openssh_package: openssh-server
|
||||
openssh_service: ssh
|
||||
python_flake8_package: python3-flake8
|
||||
python_package: python3
|
||||
python_pip_package: python3-pip
|
||||
python_psutil_package: python-psutil
|
||||
python_pyflakes_package: python3-pyflakes
|
||||
python_virtualenv_package: python3-virtualenv
|
||||
rename_package: rename
|
||||
ruby_rake_package: rake
|
||||
sftp_path: /usr/lib/openssh/sftp-server
|
||||
sudo_group: sudo
|
||||
vim_package: vim-nox
|
||||
20
roles/base/vars/Fedora.yml
Normal file
20
roles/base/vars/Fedora.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
amd_microcode_package: amd-ucode
|
||||
cron_package: cronie
|
||||
dconf_package: dconf
|
||||
dns_utils_package: bind-tools
|
||||
intel_microcode_package: intel-ucode
|
||||
lm_sensors_package: lm_sensors
|
||||
nfs_client_package: nfs-utils
|
||||
openssh_package: openssh
|
||||
openssh_service: sshd
|
||||
python_flake8_package: python3-pyflakes
|
||||
python_package: python
|
||||
python_pip_package: python3-pip
|
||||
python_psutil_package: python3-psutil
|
||||
python_pyflakes_package: python3-pyflakes
|
||||
python_virtualenv_package: python3-virtualenv
|
||||
rename_package: prename
|
||||
ruby_rake_package: rubygem-rake
|
||||
sftp_path: /usr/lib/ssh/sftp-server
|
||||
sudo_group: wheel
|
||||
vim_package: vim
|
||||
1
roles/base/vars/Pop!_OS.yml
Symbolic link
1
roles/base/vars/Pop!_OS.yml
Symbolic link
@@ -0,0 +1 @@
|
||||
Ubuntu.yml
|
||||
20
roles/base/vars/Ubuntu.yml
Normal file
20
roles/base/vars/Ubuntu.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
amd_microcode_package: amd64-microcode
|
||||
cron_package: cron
|
||||
dconf_package: dconf-cli
|
||||
dns_utils_package: dnsutils
|
||||
intel_microcode_package: intel-microcode
|
||||
lm_sensors_package: lm-sensors
|
||||
nfs_client_package: nfs-common
|
||||
openssh_package: openssh-server
|
||||
openssh_service: ssh
|
||||
python_flake8_package: python3-flake8
|
||||
python_package: python3
|
||||
python_pip_package: python3-pip
|
||||
python_psutil_package: python3-psutil
|
||||
python_pyflakes_package: python3-pyflakes
|
||||
python_virtualenv_package: python3-virtualenv
|
||||
rename_package: rename
|
||||
ruby_rake_package: rake
|
||||
sftp_path: /usr/lib/openssh/sftp-server
|
||||
sudo_group: sudo
|
||||
vim_package: vim-nox
|
||||
1
roles/base/vars/elementary OS.yml
Symbolic link
1
roles/base/vars/elementary OS.yml
Symbolic link
@@ -0,0 +1 @@
|
||||
Ubuntu.yml
|
||||
2
roles/base/vars/main.yml
Normal file
2
roles/base/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bzoicas_passwd:
|
||||
swappiness_value: 5
|
||||
115
roles/server/files/nrpe/check_hddtemp
Normal file
115
roles/server/files/nrpe/check_hddtemp
Normal file
@@ -0,0 +1,115 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# USAGE:
|
||||
# ./check_hddtemp.sh <device> <warn> <crit>
|
||||
# Nagios script to get the temperatue of HDD from hddtemp
|
||||
#
|
||||
# You may have to let nagios run this script as root
|
||||
# This is how the sudoers file looks in my debian system:
|
||||
# nagios ALL=(root) NOPASSWD:/usr/lib/nagios/plugins/check_hddtemp
|
||||
#
|
||||
# Version 1.0
|
||||
# Another note: install the hddtemp package as well
|
||||
|
||||
|
||||
OK=0
|
||||
WARNING=1
|
||||
CRITICAL=2
|
||||
UNKNOWN=3
|
||||
|
||||
function usage()
|
||||
{
|
||||
echo "Usage: ./check_hddtemp <device> <warn> <crit>"
|
||||
}
|
||||
|
||||
function check_root()
|
||||
{
|
||||
# make sure script is running as root
|
||||
if [ `whoami` != root ]; then
|
||||
echo "UNKNOWN: please make sure script is running as root"
|
||||
exit $UNKNOWN
|
||||
fi
|
||||
}
|
||||
function check_arg()
|
||||
{
|
||||
# make sure you supplied all 3 arguments
|
||||
if [ $# -ne 3 ]; then
|
||||
usage
|
||||
exit $OK
|
||||
fi
|
||||
}
|
||||
function check_device()
|
||||
{
|
||||
# make sure device is a special block
|
||||
if [ ! -b $DEVICE ];then
|
||||
echo "UNKNOWN: $DEVICE is not a block special file"
|
||||
exit $UNKNOWN
|
||||
fi
|
||||
}
|
||||
function check_warn_vs_crit()
|
||||
{
|
||||
# make sure CRIT is larger than WARN
|
||||
if [ $WARN -ge $CRIT ];then
|
||||
echo "UNKNOWN: WARN value may not be greater than or equal the CRIT value"
|
||||
exit $UNKNOWN
|
||||
fi
|
||||
}
|
||||
|
||||
function init()
|
||||
{
|
||||
check_root
|
||||
check_arg $*
|
||||
check_device
|
||||
check_warn_vs_crit
|
||||
}
|
||||
|
||||
function get_hddtemp()
|
||||
{
|
||||
# gets temperature and stores it in $HEAT
|
||||
# and make sure we get a numeric output
|
||||
if [ -x $HDDTEMP ];then
|
||||
HEAT=`$HDDTEMP $DEVICE -n`
|
||||
case "$HEAT" in
|
||||
[0-9]* )
|
||||
echo "do nothing" > /dev/null
|
||||
;;
|
||||
* )
|
||||
echo "UNKNOWN: Could not get temperature from: $DEVICE"
|
||||
exit $UNKNOWN
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "UNKNOWN: cannot execute $HDDTEMP"
|
||||
exit $UNKNOWN
|
||||
fi
|
||||
}
|
||||
function check_heat()
|
||||
{
|
||||
# checks temperature and replies according to $CRIT and $WARN
|
||||
if [ $HEAT -lt $WARN ];then
|
||||
echo "OK: Temperature is below warn treshold ($DEVICE is $HEAT)"
|
||||
exit $OK
|
||||
elif [ $HEAT -lt $CRIT ];then
|
||||
echo "WARNING: Temperature is above warn treshold ($DEVICE is $HEAT)"
|
||||
exit $WARNING
|
||||
elif [ $HEAT -ge $CRIT ];then
|
||||
echo "CRITICAL: Temperature is above crit treshold ($DEVICE is $HEAT)"
|
||||
exit $CRITICAL
|
||||
else
|
||||
echo "UNKNOWN: This error message should never occur, if it does happen anyway, get a new cup of coffee and fix the code :)"
|
||||
exit $UNKNOWN
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# -- Main -- #
|
||||
|
||||
HDDTEMP=/usr/sbin/hddtemp
|
||||
DEVICE=$1
|
||||
WARN=$2
|
||||
CRIT=$3
|
||||
|
||||
|
||||
init $*
|
||||
get_hddtemp
|
||||
check_heat
|
||||
36
roles/server/files/nrpe/check_md_raid
Normal file
36
roles/server/files/nrpe/check_md_raid
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Created by Sebastian Grewe, Jammicron Technology
|
||||
#
|
||||
|
||||
# Get count of raid arrays
|
||||
RAID_DEVICES=`grep ^md -c /proc/mdstat`
|
||||
|
||||
# Get count of degraded arrays
|
||||
RAID_STATUS=`grep "\[.*_.*\]" /proc/mdstat -c`
|
||||
|
||||
# Is an array currently recovering, get percentage of recovery
|
||||
RAID_RECOVER=`grep recovery /proc/mdstat | awk '{print $4}'`
|
||||
RAID_RESYNC=`grep resync /proc/mdstat | awk '{print $4}'`
|
||||
|
||||
# Check raid status
|
||||
# RAID recovers --> Warning
|
||||
if [[ $RAID_RECOVER ]]; then
|
||||
STATUS="WARNING - Checked $RAID_DEVICES arrays, recovering : $RAID_RECOVER"
|
||||
EXIT=1
|
||||
elif [[ $RAID_RESYNC ]]; then
|
||||
STATUS="WARNING - Checked $RAID_DEVICES arrays, resync : $RAID_RESYNC"
|
||||
EXIT=1
|
||||
# RAID ok
|
||||
elif [[ $RAID_STATUS == "0" ]]; then
|
||||
STATUS="OK - Checked $RAID_DEVICES arrays."
|
||||
EXIT=0
|
||||
# All else critical, better save than sorry
|
||||
else
|
||||
STATUS="CRITICAL - Checked $RAID_DEVICES arrays, $RAID_STATUS have FAILED"
|
||||
EXIT=2
|
||||
fi
|
||||
|
||||
# Status and quit
|
||||
echo $STATUS
|
||||
exit $EXIT
|
||||
116
roles/server/files/nrpe/check_mem
Normal file
116
roles/server/files/nrpe/check_mem
Normal file
@@ -0,0 +1,116 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Plugin to check system memory
|
||||
# by hugme (nagios@hugme.org)
|
||||
# You can find my checks here: https://github.com/hugme/Nag_checks
|
||||
# Nagios script to check memory usage on linux server
|
||||
# version 1.2.0
|
||||
#
|
||||
##########################################################
|
||||
|
||||
MEMINFO="/proc/meminfo"
|
||||
|
||||
##########################################################
|
||||
# We call them functions because they're fun
|
||||
##########################################################
|
||||
|
||||
print_help() {
|
||||
cat << EOF
|
||||
Linux Memory Plugin for Nagios
|
||||
Copyright (c) hugme (nagios@hugme.org)
|
||||
Version: 1.2.0
|
||||
Last Modified: 10-07-2014
|
||||
License: This software can be used for free unless I meet you, then you owe me lunch.
|
||||
|
||||
Usage: check_linux_memory -w [warning %] -c [critical %]
|
||||
|
||||
Options:
|
||||
-w [0-99] = Your warning %. 20 means 20% of your memory can remain before a warning alarm. Do not use the % sign.
|
||||
-c [0-99] = Your critical %. 10 means 10% of your memory can remain before a critical alarm. Do not use the % sign.
|
||||
-d [K,M,G,T] = divider K=kilobytes, M=megabytes, G=gigabytes, T=terabytes
|
||||
-f = Include cached memory as free memory when calculating your percentage free
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
invalid_type() {
|
||||
echo "\nInvalid $1\n"
|
||||
print_help
|
||||
exit 3
|
||||
}
|
||||
|
||||
##############################################
|
||||
## Suck in the user input
|
||||
##############################################
|
||||
|
||||
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
--help) print_help ; exit 0 ;;
|
||||
-h) print_help ; exit 0 ;;
|
||||
-w) WARN="$2"; shift ;;
|
||||
-c) CRIT="$2"; shift ;;
|
||||
-d) DIV="$2"; shift ;;
|
||||
-f) FC=1 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
##############################################
|
||||
## Set the defaults if needed
|
||||
##############################################
|
||||
|
||||
[ -z "$WARN" ] && WARN=20
|
||||
[ -z "$CRIT" ] && CRIT=10
|
||||
[ -z "$DIV" ] && DIV=M
|
||||
[ -z "$FC" ] && FC=0
|
||||
|
||||
##############################################
|
||||
## Check user input
|
||||
##############################################
|
||||
|
||||
[ ! -z `echo $WARN | tr -d [:digit:]` ] && invalid_type "Warning: Warning value can only contain numbers"
|
||||
[ ! -z `echo $CRIT | tr -d [:digit:]` ] && invalid_type "Critical: Critical value can only contain numbers"
|
||||
[ "${WARN%.*}" -ge 100 ] && invalid_type "Warning: Warning must be smaller than 100%"
|
||||
[ "${CRIT%.*}" -ge 100 ] && invalid_type "Critical: Critical must be smaller than 100%"
|
||||
[ "${CRIT%.*}" -gt "${WARN%.*}" ] && invalid_type "Critical: Your Warning must be Higher than your Critical"
|
||||
|
||||
case $DIV in
|
||||
k|K) DIVNUM=1;;
|
||||
m|M) DIVNUM=1024;;
|
||||
g|G) DIVNUM=1048576;;
|
||||
t|T) DIVNUM=1073741824;;
|
||||
*) invalid_type;;
|
||||
esac
|
||||
|
||||
[ ! -f "$MEMINFO" ] && {
|
||||
echo "Your Memory info file seems to be missing"
|
||||
exit 1
|
||||
}
|
||||
|
||||
##############################################
|
||||
## Do the work
|
||||
## Pull the memory file into awk
|
||||
## grab the lines we need
|
||||
## Print the information
|
||||
##############################################
|
||||
|
||||
RESULT=$(awk -v warn=$WARN -v crit=$CRIT -v div=$DIV -v divnum=$DIVNUM -v fc=$FC '/^MemTotal:/ { total=$2 }
|
||||
/^MemTotal:/ { tot=$2 }
|
||||
/^MemFree:/ { free=$2 }
|
||||
/^Buffers:/ { buff=$2 }
|
||||
/^Cached:/ { cache=$2 }
|
||||
/^Active:/ { active=$2 }
|
||||
/^Inactive:/ { inactive=$2 }
|
||||
END { if ( fc == 1 ) { free=free+cache+buff }
|
||||
{ freeperct=free/tot*100 }
|
||||
if ( freeperct > warn ) { result="OK" ; xit="0"}
|
||||
if ( freeperct <= warn ) {
|
||||
if ( freeperct > crit ) { result="WARNING" ; xit="1" }
|
||||
else if ( freeperct <= crit ) { result="CRITICAL" ; xit="2" }
|
||||
}
|
||||
{print xit" MEMORY "result" - "freeperct"% Free - Total:"tot/divnum div" Active:"active/divnum div" Inactive:"inactive/divnum div" Buffers:"buff/divnum div" Cached:"cache/divnum div" |Free="freeperct";"warn";"crit";0 Active="active";0;0;0 Inactive="inactive";0;0;0 Buffers="buff";0;0;0 Cached="cache";0;0;0" }
|
||||
}' /proc/meminfo)
|
||||
|
||||
echo ${RESULT#* }
|
||||
exit ${RESULT%% *}
|
||||
48
roles/server/files/nrpe/check_nfs
Normal file
48
roles/server/files/nrpe/check_nfs
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
## FILE: check_nfs.sh
|
||||
##
|
||||
## DESCRIPTION: This is a nagios compatible script to checks NFS mounts against what
|
||||
## should be mounted in /etc/fstab and if there is a stale mount.
|
||||
##
|
||||
## AUTHOR: Dennis Ruzeski (denniruz@gmail.com)
|
||||
##
|
||||
## Creation Date: 1/23/2013
|
||||
##
|
||||
## Last Modified: 1/25/2013
|
||||
##
|
||||
## VERSION: 1.0
|
||||
##
|
||||
## USAGE: ./check_nfs.sh
|
||||
## This version takes no arguments
|
||||
##
|
||||
## TODO: Improve the check for stale mounts, add command line arguments to provide the ability to
|
||||
## check mount statut, stale mounts, and latency separately.
|
||||
#
|
||||
declare -a nfs_mounts=( $(grep -v ^\# /etc/fstab |grep nfs |awk '{print $2}') )
|
||||
declare -a MNT_STATUS
|
||||
declare -a SFH_STATUS
|
||||
for mount_type in ${nfs_mounts[@]} ; do
|
||||
if [ $(stat -f -c '%T' ${mount_type}) = nfs ]; then
|
||||
read -t3 < <(stat -t ${mount_type})
|
||||
if [ $? -ne 0 ]; then
|
||||
SFH_STATUS=("${SFH_STATUS[@]}" "ERROR: ${mount_type} might be stale.")
|
||||
else
|
||||
MNT_STATUS=("${MNT_STATUS[@]}" "OK: ${mount_type} is ok.")
|
||||
fi
|
||||
else
|
||||
MNT_STATUS=("${MNT_STATUS[@]}" "ERROR: ${mount_type} is not properly mounted.")
|
||||
fi
|
||||
done
|
||||
echo ${MNT_STATUS[@]} ${SFH_STATUS[@]} |grep -q ERROR
|
||||
if [ $? -eq 0 ]; then
|
||||
RETVAL=2
|
||||
echo "CRITICAL - NFS mounts may be stale or unavailable"
|
||||
else
|
||||
RETVAL=0
|
||||
echo "OK - NFS mounts are not reporting any errors"
|
||||
fi
|
||||
unset -v MNT_STATUS
|
||||
unset -v SFH_STATUS
|
||||
exit ${RETVAL}
|
||||
|
||||
7
roles/server/files/nrpe/logrotate
Normal file
7
roles/server/files/nrpe/logrotate
Normal file
@@ -0,0 +1,7 @@
|
||||
/var/log/nrpe.log {
|
||||
rotate 3
|
||||
daily
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
}
|
||||
4
roles/server/files/unattended-upgrades/20auto-upgrades
Normal file
4
roles/server/files/unattended-upgrades/20auto-upgrades
Normal file
@@ -0,0 +1,4 @@
|
||||
APT::Periodic::Update-Package-Lists "1";
|
||||
APT::Periodic::Download-Upgradeable-Packages "1";
|
||||
APT::Periodic::AutocleanInterval "7";
|
||||
APT::Periodic::Unattended-Upgrade "1";
|
||||
@@ -0,0 +1,102 @@
|
||||
// Unattended-Upgrade::Origins-Pattern controls which packages are
|
||||
// upgraded.
|
||||
//
|
||||
// Lines below have the format format is "keyword=value,...". A
|
||||
// package will be upgraded only if the values in its metadata match
|
||||
// all the supplied keywords in a line. (In other words, omitted
|
||||
// keywords are wild cards.) The keywords originate from the Release
|
||||
// file, but several aliases are accepted. The accepted keywords are:
|
||||
// a,archive,suite (eg, "stable")
|
||||
// c,component (eg, "main", "contrib", "non-free")
|
||||
// l,label (eg, "Debian", "Debian-Security")
|
||||
// o,origin (eg, "Debian", "Unofficial Multimedia Packages")
|
||||
// n,codename (eg, "jessie", "jessie-updates")
|
||||
// site (eg, "http.debian.net")
|
||||
// The available values on the system are printed by the command
|
||||
// "apt-cache policy", and can be debugged by running
|
||||
// "unattended-upgrades -d" and looking at the log file.
|
||||
//
|
||||
// Within lines unattended-upgrades allows 2 macros whose values are
|
||||
// derived from /etc/debian_version:
|
||||
// ${distro_id} Installed origin.
|
||||
// ${distro_codename} Installed codename (eg, "jessie")
|
||||
Unattended-Upgrade::Origins-Pattern {
|
||||
// Codename based matching:
|
||||
// This will follow the migration of a release through different
|
||||
// archives (e.g. from testing to stable and later oldstable).
|
||||
// "o=Debian,n=jessie";
|
||||
// "o=Debian,n=jessie-updates";
|
||||
// "o=Debian,n=jessie-proposed-updates";
|
||||
// "o=Debian,n=jessie,l=Debian-Security";
|
||||
|
||||
// Archive or Suite based matching:
|
||||
// Note that this will silently match a different release after
|
||||
// migration to the specified archive (e.g. testing becomes the
|
||||
// new stable).
|
||||
"o=Debian,a=stable";
|
||||
"o=Debian,a=stable-updates";
|
||||
// "o=Debian,a=proposed-updates";
|
||||
"origin=Debian,codename=${distro_codename},label=Debian-Security";
|
||||
};
|
||||
|
||||
// List of packages to not update (regexp are supported)
|
||||
Unattended-Upgrade::Package-Blacklist {
|
||||
// "vim";
|
||||
// "libc6";
|
||||
// "libc6-dev";
|
||||
// "libc6-i686";
|
||||
};
|
||||
|
||||
// This option allows you to control if on a unclean dpkg exit
|
||||
// unattended-upgrades will automatically run
|
||||
// dpkg --force-confold --configure -a
|
||||
// The default is true, to ensure updates keep getting installed
|
||||
//Unattended-Upgrade::AutoFixInterruptedDpkg "false";
|
||||
|
||||
// Split the upgrade into the smallest possible chunks so that
|
||||
// they can be interrupted with SIGUSR1. This makes the upgrade
|
||||
// a bit slower but it has the benefit that shutdown while a upgrade
|
||||
// is running is possible (with a small delay)
|
||||
//Unattended-Upgrade::MinimalSteps "true";
|
||||
|
||||
// Install all unattended-upgrades when the machine is shuting down
|
||||
// instead of doing it in the background while the machine is running
|
||||
// This will (obviously) make shutdown slower
|
||||
//Unattended-Upgrade::InstallOnShutdown "true";
|
||||
|
||||
// Send email to this address for problems or packages upgrades
|
||||
// If empty or unset then no email is sent, make sure that you
|
||||
// have a working mail setup on your system. A package that provides
|
||||
// 'mailx' must be installed. E.g. "user@example.com"
|
||||
Unattended-Upgrade::Mail "bzoicas@learnlinux.tv";
|
||||
|
||||
// Set this value to "true" to get emails only on errors. Default
|
||||
// is to always send a mail if Unattended-Upgrade::Mail is set
|
||||
//Unattended-Upgrade::MailOnlyOnError "true";
|
||||
|
||||
// Do automatic removal of new unused dependencies after the upgrade
|
||||
// (equivalent to apt-get autoremove)
|
||||
Unattended-Upgrade::Remove-Unused-Dependencies "yes";
|
||||
|
||||
// Automatically reboot *WITHOUT CONFIRMATION* if
|
||||
// the file /var/run/reboot-required is found after the upgrade
|
||||
//Unattended-Upgrade::Automatic-Reboot "false";
|
||||
|
||||
// Automatically reboot even if there are users currently logged in.
|
||||
//Unattended-Upgrade::Automatic-Reboot-WithUsers "true";
|
||||
|
||||
// If automatic reboot is enabled and needed, reboot at the specific
|
||||
// time instead of immediately
|
||||
// Default: "now"
|
||||
//Unattended-Upgrade::Automatic-Reboot-Time "02:00";
|
||||
|
||||
// Use apt bandwidth limit feature, this example limits the download
|
||||
// speed to 70kb/sec
|
||||
//Acquire::http::Dl-Limit "70";
|
||||
|
||||
// Enable logging to syslog. Default is False
|
||||
// Unattended-Upgrade::SyslogEnable "false";
|
||||
|
||||
// Specify syslog facility. Default is daemon
|
||||
// Unattended-Upgrade::SyslogFacility "daemon";
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
// Automatically upgrade packages from these (origin:archive) pairs
|
||||
//
|
||||
// Note that in Ubuntu security updates may pull in new dependencies
|
||||
// from non-security sources (e.g. chromium). By allowing the release
|
||||
// pocket these get automatically pulled in.
|
||||
Unattended-Upgrade::Allowed-Origins {
|
||||
"${distro_id}:${distro_codename}";
|
||||
"${distro_id}:${distro_codename}-security";
|
||||
// Extended Security Maintenance; doesn't necessarily exist for
|
||||
// every release and this system may not have it installed, but if
|
||||
// available, the policy for updates is such that unattended-upgrades
|
||||
// should also install from here by default.
|
||||
"${distro_id}ESMApps:${distro_codename}-apps-security";
|
||||
"${distro_id}ESM:${distro_codename}-infra-security";
|
||||
"${distro_id}:${distro_codename}-updates";
|
||||
// "${distro_id}:${distro_codename}-proposed";
|
||||
// "${distro_id}:${distro_codename}-backports";
|
||||
};
|
||||
|
||||
// Python regular expressions, matching packages to exclude from upgrading
|
||||
Unattended-Upgrade::Package-Blacklist {
|
||||
// The following matches all packages starting with linux-
|
||||
// "linux-";
|
||||
|
||||
// Use $ to explicitely define the end of a package name. Without
|
||||
// the $, "libc6" would match all of them.
|
||||
// "libc6$";
|
||||
// "libc6-dev$";
|
||||
// "libc6-i686$";
|
||||
|
||||
// Special characters need escaping
|
||||
// "libstdc\+\+6$";
|
||||
|
||||
// The following matches packages like xen-system-amd64, xen-utils-4.1,
|
||||
// xenstore-utils and libxenstore3.0
|
||||
// "(lib)?xen(store)?";
|
||||
|
||||
// For more information about Python regular expressions, see
|
||||
// https://docs.python.org/3/howto/regex.html
|
||||
};
|
||||
|
||||
// This option controls whether the development release of Ubuntu will be
|
||||
// upgraded automatically. Valid values are "true", "false", and "auto".
|
||||
Unattended-Upgrade::DevRelease "auto";
|
||||
|
||||
// This option allows you to control if on a unclean dpkg exit
|
||||
// unattended-upgrades will automatically run
|
||||
// dpkg --force-confold --configure -a
|
||||
// The default is true, to ensure updates keep getting installed
|
||||
//Unattended-Upgrade::AutoFixInterruptedDpkg "true";
|
||||
|
||||
// Split the upgrade into the smallest possible chunks so that
|
||||
// they can be interrupted with SIGTERM. This makes the upgrade
|
||||
// a bit slower but it has the benefit that shutdown while a upgrade
|
||||
// is running is possible (with a small delay)
|
||||
//Unattended-Upgrade::MinimalSteps "true";
|
||||
|
||||
// Install all updates when the machine is shutting down
|
||||
// instead of doing it in the background while the machine is running.
|
||||
// This will (obviously) make shutdown slower.
|
||||
// Unattended-upgrades increases logind's InhibitDelayMaxSec to 30s.
|
||||
// This allows more time for unattended-upgrades to shut down gracefully
|
||||
// or even install a few packages in InstallOnShutdown mode, but is still a
|
||||
// big step back from the 30 minutes allowed for InstallOnShutdown previously.
|
||||
// Users enabling InstallOnShutdown mode are advised to increase
|
||||
// InhibitDelayMaxSec even further, possibly to 30 minutes.
|
||||
//Unattended-Upgrade::InstallOnShutdown "false";
|
||||
|
||||
// Send email to this address for problems or packages upgrades
|
||||
// If empty or unset then no email is sent, make sure that you
|
||||
// have a working mail setup on your system. A package that provides
|
||||
// 'mailx' must be installed. E.g. "user@example.com"
|
||||
Unattended-Upgrade::Mail "bzoicas@learnlinux.tv";
|
||||
|
||||
// Set this value to one of:
|
||||
// "always", "only-on-error" or "on-change"
|
||||
// If this is not set, then any legacy MailOnlyOnError (boolean) value
|
||||
// is used to chose between "only-on-error" and "on-change"
|
||||
Unattended-Upgrade::MailReport "on-change";
|
||||
|
||||
// Remove unused automatically installed kernel-related packages
|
||||
// (kernel images, kernel headers and kernel version locked tools).
|
||||
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
|
||||
|
||||
// Do automatic removal of newly unused dependencies after the upgrade
|
||||
Unattended-Upgrade::Remove-New-Unused-Dependencies "true";
|
||||
|
||||
// Do automatic removal of unused packages after the upgrade
|
||||
// (equivalent to apt-get autoremove)
|
||||
Unattended-Upgrade::Remove-Unused-Dependencies "false";
|
||||
|
||||
// Automatically reboot *WITHOUT CONFIRMATION* if
|
||||
// the file /var/run/reboot-required is found after the upgrade
|
||||
//Unattended-Upgrade::Automatic-Reboot "false";
|
||||
|
||||
// Automatically reboot even if there are users currently logged in
|
||||
// when Unattended-Upgrade::Automatic-Reboot is set to true
|
||||
//Unattended-Upgrade::Automatic-Reboot-WithUsers "true";
|
||||
|
||||
// If automatic reboot is enabled and needed, reboot at the specific
|
||||
// time instead of immediately
|
||||
// Default: "now"
|
||||
//Unattended-Upgrade::Automatic-Reboot-Time "02:00";
|
||||
|
||||
// Use apt bandwidth limit feature, this example limits the download
|
||||
// speed to 70kb/sec
|
||||
//Acquire::http::Dl-Limit "70";
|
||||
|
||||
// Enable logging to syslog. Default is False
|
||||
// Unattended-Upgrade::SyslogEnable "false";
|
||||
|
||||
// Specify syslog facility. Default is daemon
|
||||
// Unattended-Upgrade::SyslogFacility "daemon";
|
||||
|
||||
// Download and install upgrades only on AC power
|
||||
// (i.e. skip or gracefully stop updates on battery)
|
||||
// Unattended-Upgrade::OnlyOnACPower "true";
|
||||
|
||||
// Download and install upgrades only on non-metered connection
|
||||
// (i.e. skip or gracefully stop updates on a metered connection)
|
||||
// Unattended-Upgrade::Skip-Updates-On-Metered-Connections "true";
|
||||
|
||||
// Verbose logging
|
||||
// Unattended-Upgrade::Verbose "false";
|
||||
|
||||
// Print debugging information both in unattended-upgrades and
|
||||
// in unattended-upgrade-shutdown
|
||||
// Unattended-Upgrade::Debug "false";
|
||||
|
||||
// Allow package downgrade if Pin-Priority exceeds 1000
|
||||
// Unattended-Upgrade::Allow-downgrade "false";
|
||||
18
roles/server/handlers/main.yml
Normal file
18
roles/server/handlers/main.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: restart_nrpe
|
||||
tags: nagios,nrpe
|
||||
service:
|
||||
name: "{{ nrpe_service }}"
|
||||
state: restarted
|
||||
|
||||
- name: restart_qemu_agent
|
||||
tags: qemu,qemu-agent
|
||||
service:
|
||||
name: "{{ qemu_agent_service }}"
|
||||
state: restarted
|
||||
|
||||
- name: restart_ufw
|
||||
tags: ufw
|
||||
service:
|
||||
name: ufw
|
||||
state: restarted
|
||||
17
roles/server/tasks/main.yml
Normal file
17
roles/server/tasks/main.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
# Load distro-specific variables
|
||||
- include_vars: "{{ ansible_distribution }}.yml"
|
||||
tags: always
|
||||
|
||||
- block:
|
||||
- import_tasks: nrpe.yml
|
||||
- import_tasks: ufw.yml
|
||||
- import_tasks: qemu-agent.yml
|
||||
|
||||
- include_tasks: unattended_upgrades.yml
|
||||
when:
|
||||
- ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
|
||||
- unattended_upgrades is defined
|
||||
- unattended_upgrades == true
|
||||
|
||||
rescue:
|
||||
- set_fact: task_failed=true
|
||||
69
roles/server/tasks/nrpe.yml
Normal file
69
roles/server/tasks/nrpe.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
- name: nrpe | install nrpe package and plugins
|
||||
tags: nagios,nrpe
|
||||
package:
|
||||
state: latest
|
||||
name:
|
||||
- "{{ monitoring_plugins_package }}"
|
||||
- "{{ nrpe_package }}"
|
||||
notify:
|
||||
- restart_nrpe
|
||||
|
||||
- name: nrpe | generate nrpe.cfg file from template
|
||||
tags: openssh,ssh,system,settings
|
||||
template:
|
||||
src: nrpe.cfg.j2
|
||||
dest: "{{ nrpe_config_file_dest }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart_nrpe
|
||||
|
||||
- name: nrpe | enable and start nrpe service
|
||||
tags: nagios,nrpe
|
||||
service:
|
||||
name: "{{ nrpe_service }}"
|
||||
enabled: yes
|
||||
state: started
|
||||
|
||||
- name: nrpe | copy additional plugins
|
||||
tags: nagios,nrpe
|
||||
copy:
|
||||
src: nrpe/{{ item }}
|
||||
dest: "{{ monitoring_plugins_path }}/{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
with_items:
|
||||
- check_hddtemp
|
||||
- check_md_raid
|
||||
- check_mem
|
||||
- check_nfs
|
||||
|
||||
- name: nrpe | create log file
|
||||
tags: ansible,ansible-setup
|
||||
file:
|
||||
path: /var/log/nrpe.log
|
||||
owner: "{{ nrpe_user }}"
|
||||
group: "{{ nrpe_group }}"
|
||||
mode: 0664
|
||||
state: touch
|
||||
changed_when: False
|
||||
|
||||
- name: nrpe | add logrotate config for nrpe log file
|
||||
tags: nrpe,server
|
||||
copy:
|
||||
src: nrpe/logrotate
|
||||
dest: /etc/logrotate.d/nrpe
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: nrpe | clean up unneeded files (debian, etc)
|
||||
tags: nrpe,server
|
||||
file:
|
||||
path: /etc/nagios/{{ item }}
|
||||
state: absent
|
||||
with_items:
|
||||
- nrpe_local.cfg
|
||||
- nrpe.d
|
||||
when: ansible_distribution in ["Debian", "Pop!_OS", "Ubuntu"]
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user