From 85b63b831945849377a28a8f20d3e27904a3a11f Mon Sep 17 00:00:00 2001 From: Salt Date: Wed, 16 Aug 2017 14:30:47 -0500 Subject: [PATCH] .vim, .vimrc: Heavy Vim configuration Gruvbox, templates, and pathogen --- .profile | 113 ++++++++-------- .vim/.netrwhist | 3 + .vim/autoload/pathogen.vim | 264 +++++++++++++++++++++++++++++++++++++ .vim/bundle/gruvbox | 1 + .vim/bundle/vim-template | 1 + .vimrc | 15 +++ .zshrc | 20 --- 7 files changed, 343 insertions(+), 74 deletions(-) create mode 100644 .vim/.netrwhist create mode 100644 .vim/autoload/pathogen.vim create mode 160000 .vim/bundle/gruvbox create mode 160000 .vim/bundle/vim-template create mode 100644 .vimrc diff --git a/.profile b/.profile index 597a0d3f..6e28d6a4 100755 --- a/.profile +++ b/.profile @@ -1,67 +1,72 @@ #!/bin/sh # POSIX NOTICE -# This script is not fully POSIX-compliant. It uses features that, -# while popular, are undefined by POSIX. Namely: -# -# * The use of the `local` keyword -# -# Users of this script on minimalist shells will have to adapt -# this script accordingly. +# This script should be fully POSIX-compliant +# If it is not, open a bug report at github.com/rehashedsalt/home and I'll take +# care of it -# Common miscellaneous aliases are all defined here for convenience -__define_aliases() { - - # Common Aliases - - alias cp='cp -i' - if [ `which dcfldd` ]; then - alias dd=dcfldd +# dcfldd is a fork of dd with some improvements +# I prefer it, so there's an alias here +if [ `which dcfldd` ]; then + alias dd=dcfldd alias ddgnu=dd - fi - alias ls='ls --color=auto' - alias ll='ls -alF' - alias la='ls -a --color=auto' - alias l='ls -CF' - alias waitwhat='echo $?' +fi - alias fug='sudo `history -p !!`' -} +# If emerge exists, add emerge aliases +if [ `which emerge` ]; then + alias e-depclean='sudo emerge -a --depclean' + alias e-inst='sudo emerge -av' + alias e-upgrade='sudo emerge -DNuva --with-bdeps=y @world' + alias e-search='emerge -s' + alias e-sync='sudo emerge --sync' +fi -# Functions to be exported to the shell -# Mostly just helper wrappers and such -__define_functions() { - # Arch-only helper functions - if [ "$(which pacman > /dev/null 2>&1)" ]; then - export PAC_HELPER="pacaur" - local helpers="pacaur yaourt pacman" - for helper in $helpers; do - if [ "$(pacman -Qq "$helper" > /dev/null)" ]; then - export PAC_HELPER="$helper" - break - fi - done - - alias pac="\$PAC_HELPER" - alias pacq="\$PAC_HELPER -Qs" - alias pacqi="\$PAC_HELPER -Qi" - alias pacs="\$PAC_HELPER -S" - alias pacss="\$PAC_HELPER -Ss" - alias pacsu="\$PAC_HELPER -Syu" - alias pacsyu="\$PAC_HELPER -Syyu" - alias pacsr="\$PAC_HELPER -Rsnu" - fi -} +if [ `which neofetch` ]; then + alias fetch='neofetch --disable model resolution --block_range 0 15 --image wall --xoffset 4 --yoffset 4 --scrot ~/Pictures/Screenshots/neofetch.png' + alias fetch-up='neofetch --disable model resolution --block_range 0 15 --image wall --xoffset 4 --yoffset 4 --upload --image-host imgur' +fi -# Call functions that need to be called -__define_aliases -__define_functions +# If pacman exists, check for helpers and add aliases +if [ "`which pacman > /dev/null 2>&1`" ]; then + export pac_helper="pacaur" + helpers="pacaur yaourt pacman" + for helper in $helpers; do + if [ "$(pacman -Qq "$helper" > /dev/null)" ]; then + export pac_helper="$helper" + break + fi + done + + alias pac="\$pac_helper" + alias pacq="\$pac_helper -Qs" + alias pacqi="\$pac_helper -Qi" + alias pacs="\$pac_helper -S" + alias pacss="\$pac_helper -Ss" + alias pacsu="\$pac_helper -Syu" + alias pacsyu="\$pac_helper -Syyu" + alias pacsr="\$pac_helper -Rsnu" + unset helpers +fi +# Alias for the dotfile setup +if [ -d "$HOME/.dotfiles" ]; then + alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' +fi + +# Aliases for common utilities +alias cp='cp -i' +alias l='ls -CF --color=auto --file-type' +alias la='ls -AF --color=auto --file-type' +alias ls='ls -F --color=auto' +alias ll='ls -AhlF --color=auto --file-type' +alias waitwhat='echo $?' +alias fug='sudo `history -p !!`' + +# urxvt isn't a very well-known terminal if [ "$TERM" = "rxvt-unicode-256color" ]; then export TERM=xterm-256color fi -EDITOR=$(which vim) -PATH=$PATH:$HOME/.bin:$HOME/.local/bin -export EDITOR -export PATH +# Minor configuration settings +export EDITOR=$(which vim) +export PATH=$PATH:$HOME/.bin:$HOME/.local/bin diff --git a/.vim/.netrwhist b/.vim/.netrwhist new file mode 100644 index 00000000..85725fe9 --- /dev/null +++ b/.vim/.netrwhist @@ -0,0 +1,3 @@ +let g:netrw_dirhistmax =10 +let g:netrw_dirhist_cnt =1 +let g:netrw_dirhist_1='/usr/share/themes/Numix' diff --git a/.vim/autoload/pathogen.vim b/.vim/autoload/pathogen.vim new file mode 100644 index 00000000..3582fbf5 --- /dev/null +++ b/.vim/autoload/pathogen.vim @@ -0,0 +1,264 @@ +" pathogen.vim - path option manipulation +" Maintainer: Tim Pope +" 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() 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. +" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}" +" on versions of Vim without native package support. +function! pathogen#infect(...) abort + if a:0 + let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")') + else + let paths = ['bundle/{}', 'pack/{}/start/{}'] + endif + if has('packages') + call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"') + endif + let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*$' + for path in filter(copy(paths), 'v:val =~# static') + call pathogen#surround(path) + endfor + for path in filter(copy(paths), 'v:val !~# static') + if path =~# '^\%([$~\\/]\|\w:[\\/]\)' + call pathogen#surround(path) + else + 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,'\\\@]','\\&','') + 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 + +" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/.vim/bundle/gruvbox b/.vim/bundle/gruvbox new file mode 160000 index 00000000..96f0b0c6 --- /dev/null +++ b/.vim/bundle/gruvbox @@ -0,0 +1 @@ +Subproject commit 96f0b0c69e11f4d3aa480b6a6b1396b100815ace diff --git a/.vim/bundle/vim-template b/.vim/bundle/vim-template new file mode 160000 index 00000000..3ce02574 --- /dev/null +++ b/.vim/bundle/vim-template @@ -0,0 +1 @@ +Subproject commit 3ce0257401562f2234cc7031073d09a69fba8911 diff --git a/.vimrc b/.vimrc new file mode 100644 index 00000000..c915daca --- /dev/null +++ b/.vimrc @@ -0,0 +1,15 @@ +execute pathogen#infect() + +colorscheme gruvbox +set background=dark +let g:gruvbox_contrast_dark='medium' + +syntax on +filetype plugin indent on + +" Automatically read when a file is changed outside of Vim +set autoread + +" Enable 256-color support +" All of my machines support 256-color so this should be fine +set t_Co=256 diff --git a/.zshrc b/.zshrc index c8a5d9fc..364f8f87 100644 --- a/.zshrc +++ b/.zshrc @@ -57,24 +57,4 @@ zstyle :compinstall filename '/home/salt/.zshrc' autoload -Uz compinit compinit -# Aliases -## ls -alias l='ls --color=auto --file-type' -alias la='ls -A --color=auto --file-type' -alias ls='ls --color=auto' -alias ll='ls -Ahl --color=auto --file-type' -alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' -## emerge -if [[ "$(which emerge)" ]]; then - alias e-sync='sudo emerge --sync' - alias e-upgrade='sudo emerge -DNuva --with-bdeps=y @world' - alias e-inst='sudo emerge -av' - alias e-depclean='sudo emerge -a --depclean' -fi -## neofetch -if [[ "$(which neofetch)" ]]; then - alias fetch='neofetch --disable model resolution --block_range 0 15 --image wall --xoffset 4 --yoffset 4 --scrot ~/Pictures/neofetch.png' - alias fetch-up='neofetch --disable model resolution --block_range 0 15 --image wall --xoffset 4 --yoffset 4 --upload --image_host imgur' -fi - source $ZSH/oh-my-zsh.sh