Port over Vim configuration

This commit is contained in:
Salt 2021-01-19 01:19:52 -06:00
parent 829dadbac2
commit 5e55222650
17 changed files with 287 additions and 0 deletions

36
.gitmodules vendored Normal file
View File

@ -0,0 +1,36 @@
[submodule "vim/.vim/pathogen"]
path = vim/.vim/pathogen
url = https://github.com/tpope/vim-pathogen
[submodule "vim/.vim/bundle/vim-closetag"]
path = vim/.vim/bundle/vim-closetag
url = https://github.com/alvan/vim-closetag.git
[submodule "vim/.vim/bundle/gruvbox"]
path = vim/.vim/bundle/gruvbox
url = https://github.com/morhetz/gruvbox
[submodule "vim/.vim/bundle/SimpylFold"]
path = vim/.vim/bundle/SimpylFold
url = https://github.com/tmhedberg/SimpylFold.git
[submodule "vim/.vim/bundle/vim-template"]
path = vim/.vim/bundle/vim-template
url = https://github.com/aperezdc/vim-template.git
[submodule "vim/.vim/bundle/incsearch.vim"]
path = vim/.vim/bundle/incsearch.vim
url = https://github.com/haya14busa/incsearch.vim.git
[submodule "vim/.vim/bundle/lightline.vim"]
path = vim/.vim/bundle/lightline.vim
url = https://github.com/itchyny/lightline.vim
[submodule "vim/.vim/bundle/ale"]
path = vim/.vim/bundle/ale
url = https://github.com/w0rp/ale
[submodule "vim/.vim/bundle/lightline-gruvbox.vim"]
path = vim/.vim/bundle/lightline-gruvbox.vim
url = https://github.com/shinchu/lightline-gruvbox.vim
[submodule "vim/.vim/bundle/vim-css-color"]
path = vim/.vim/bundle/vim-css-color
url = https://github.com/ap/vim-css-color
[submodule "vim/.vim/bundle/vim-javascript"]
path = vim/.vim/bundle/vim-javascript
url = https://github.com/pangloss/vim-javascript
[submodule "vim/.vim/bundle/vim-ansible-yaml"]
path = vim/.vim/bundle/vim-ansible-yaml
url = https://github.com/chase/vim-ansible-yaml

View File

@ -0,0 +1 @@
../pathogen/autoload/pathogen.vim

@ -0,0 +1 @@
Subproject commit 0459df8a0bbfc8ef1bfd88db889e881626f65914

1
vim/.vim/bundle/ale Submodule

@ -0,0 +1 @@
Subproject commit 9387ccfbc57f34f9fdc6af85cd0dbddf5ee8c5ae

@ -0,0 +1 @@
Subproject commit bf2885a95efdad7bd5e4794dd0213917770d79b7

@ -0,0 +1 @@
Subproject commit 25e2547fb0566460f5999024f7a0de7b3775201f

@ -0,0 +1 @@
Subproject commit 21659af1fc980ebe7de0f475e57c3fda9a82c2d3

@ -0,0 +1 @@
Subproject commit 8e013f32f524157bf14ccaa87d97be3d3a7201e2

@ -0,0 +1 @@
Subproject commit a6f92d17ff01b2e63d6c9fdbb7f7e13c7fd41d14

@ -0,0 +1 @@
Subproject commit bd6bbc33c7e178673aa1dd17a5d249bbd4e3a6a6

@ -0,0 +1 @@
Subproject commit 4694c6ea03a065a3f6ddbebce56797a21e8241ef

@ -0,0 +1 @@
Subproject commit 3c90d0cc37bb8b78422f647e62587f498a5dd7bd

@ -0,0 +1 @@
Subproject commit 618d3f2713ab300b9d8e755fd9fbc43d4f394d7e

1
vim/.vim/pathogen Submodule

@ -0,0 +1 @@
Subproject commit e0a3efbda5ea8e5b181b2b232ef6453c05d07732

View File

@ -0,0 +1,148 @@
#! /bin/bash
#
# %FILE%
# Copyright (C) %YEAR% %USER% <%MAIL%>
#
# Distributed under terms of the %LICENSE% license.
#
set -e
# Read-only set-once variables
declare -r _name="$(basename -- "$0")"
# Options
declare -a _config=(
[foo]="bar"
[baz]="bop"
)
declare _optconfigfile="${XDG_CONFIG_HOME:-$HOME/.config}/${_name}.conf"
declare -i _opthelp
declare -i _optverbose
# Working variables
declare -a _args
declare _return
# Helper functions
log() {
# Print a line to the terminal if _optverbose is greater than $2
# $2 defaults to 0
# loglevel 0: Daily-use messages
# loglevel 1: Detailed but not quite debugging
# loglevel 2: Definitely debugging
[ -z "$1" ] && return 1
if (( _optverbose >= ${2:-0} )); then
printf "%s\\n" "$1"
fi
}
warn() {
# Print a yellow line to the terminal, respecting _optverbose
[ -z "$1" ] && return 1
if (( _optverbose >= ${2:-0} )); then
if [ -t 1 ]; then
printf "\\e[33m%s\\e[0m\\n" "$1"
else
printf "WARN: %s\\n" "$1"
fi
fi
}
error() {
# Print a red line to the terminal, exit if $2 is specified
[ -z "$1" ] && return 1
if [ -t 2 ]; then
printf "\\e[31m%s\\e[0m\\n" "$1" 1>&2
else
printf "ERROR: %s\\n" "$1" 1>&2
fi
[ -z "$2" ] && return
exit "${2:-1}"
}
has() {
# Parse out all arguments and try to find them in path
# If an argument cannot be found, set _return and fail
for prog in "$@"; do
if ! command -v "$prog" > /dev/null 2>&1; then
_return="$prog"
return 1
fi
done
return 0
}
# Core program functions
printhelp() {
cat << EOF
Usage: $_name [OPTION]...
-c [FILE] Load the given file in place of the usual config file
-h Print this help text
-v Print more status messages. Stacks
Copyright (c) %YEAR% %MAIL%
Licensed under the %LICENSE% license
EOF
}
# Main
main() {
# Parse out arguments
while [ -n "$1" ]; do
# Parse out flags
while getopts ":c:hv" opt; do
case $opt in
c)
_optconfigfile="$OPTARG"
;;
h)
_opthelp=1
;;
v)
_optverbose+=1
;;
:)
error "Option requires argument: -$OPTARG" 2
;;
*)
error "Invalid option: -$OPTARG" 2
;;
esac
done
# Store arguments
shift $((OPTIND - 1))
if [ -n "$1" ]; then
_args+=("$1")
shift
fi
unset OPTIND
done
# Early hook for help
[ -n "$_opthelp" ] && printhelp && exit 0
# Parse out a config file if it exists
if [ -f "$_optconfigfile" ]; then
log "Loading config file" 2
while read line; do
# If the line has an equals sign and isn't a comment
if [ "$line" != "${line#*=}" ] && validateline "$line"; then
local key="${line%=*}"
local value="${line#*=}"
_config[$key]="$value"
log "Setting $key to $value" 2
fi
done < "$_optconfigfile"
else
warn "Could not find configuration file" 2
fi
# Validate critical options
# TODO: That
# Validate core program dependencies
log "Validating dependencies" 2
if ! has basename; then
error "Failed to find program: $_return" 1
fi
# Do the do
# TODO: The do
warn "Nothing to do"
exit 0
}
main "$@"

View File

@ -0,0 +1,9 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © %YEAR% %USER% <%MAIL%>
#
# Distributed under terms of the %LICENSE% license.
%HERE%

81
vim/.vimrc Normal file
View File

@ -0,0 +1,81 @@
execute pathogen#infect()
syntax on
filetype plugin indent on
" Theming
if $TERM != 'linux' && version >= 800
colorscheme gruvbox
set termguicolors
set background=dark
endif
set autoread " Automatically read when a file is changed outside of Vim
set clipboard=unnamedplus " Use XA_PRIMARY clipboard by default
set encoding=utf-8
set foldmethod=syntax
set hidden " Allow buffer switching without saving
set incsearch " Search while you type
set laststatus=2 " Always show statusbar
set list
set listchars=tab:>·,trail
set modeline
set modelines=5
set nofoldenable " Fuck autofolding
set number relativenumber " Relative line numbering
set t_Co=256
set viminfo='20,<1000,s1000 " Increase buffer size
" Templates
let g:email = 'rehashedsalt@cock.li'
let g:user = 'Vintage Salt'
let g:license = 'MIT'
let g:templates_directory = [ '~/.vim/templates' ]
" Lightline
set noshowmode
let g:lightline = {
\ 'active': {
\ 'left': [
\ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename', 'modified' ],
\ [ 'charvaluehex' ]
\ ],
\ 'right': [
\ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype' ]
\ ]
\ },
\ 'component': {
\ 'charvaluehex': 'char: 0x%B'
\ },
\}
let g:lightline.colorscheme = 'gruvbox'
" Json
au BufNewFile,BufRead *.json
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2 |
\ set autoindent |
\ set smartindent
" Python
au BufNewFile,BufRead *.py " Set up nice PEP8 indentation
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
" HTML
au BufNewFile,BufRead *.html,*.php
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2 |
\ set autoindent |
\ set smartindent
" Treat PHP like HTML
au BufNewFile,BufRead *.php
\ set filetype=html