dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit 579eb0a7fe0b8eb0a4c69cab60306e5f41103762
parent e43063360408a1af4a1e08e0fec71212c4edaa47
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Wed,  3 Jan 2018 21:10:29 -0500

Numerous revisions

1. Inputrc: End the vi experiment
2. Create lessfilter and set LESSOPEN in shrc
3. Add xdg-open to my-open
4. Add my-open to mailcap
5. Colorize PS1 in shrc
6. Add pathogen as fallback in Vim8 packages not available

Diffstat:
M.inputrc | 24+++++++++---------------
A.lessfilter | 26++++++++++++++++++++++++++
M.local/bin/my-open | 3+++
M.mailcap | 1+
M.shrc | 30+++++++++++++++++++++++++-----
M.vim/vimrc | 19++++++++++++++++---
6 files changed, 80 insertions(+), 23 deletions(-)

diff --git a/.inputrc b/.inputrc @@ -1,6 +1,4 @@ # Vi keymap -set editing-mode vi -set show-mode-in-prompt on set vi-cmd-mode-string "[n]" set vi-ins-mode-string "[i]" set emacs-mode-string "" @@ -14,20 +12,16 @@ set mark-symlinked-directories on # My speakers are almost always muted, so use the visual bell instead set bell-style visible -$if mode=emacs - # Right arrow to cycle through possible completions - Control-Space: menu-complete +# Right arrow to cycle through possible completions +Control-Space: menu-complete - # Up arrow will try to complete from my history - "\e[A": history-search-backward -$endif +# Up arrow will try to complete from my history +"\e[A": history-search-backward -$if mode=vi - set keymap vi-command +set keymap vi-command - # k key in vi-command to complete from my history - "k": history-search-backward +# k key in vi-command to complete from my history +"k": history-search-backward - # l key to cycle through possible completions - "L": menu-complete -$endif +# l key to cycle through possible completions +"L": menu-complete diff --git a/.lessfilter b/.lessfilter @@ -0,0 +1,26 @@ +#!/bin/sh +if [ -d "$1" ] +then + ls -lA --color=force "$1" +elif which pygmentize > /dev/null 2>&1 +then + case "$1" in + *.awk|*.groff|*.java|*.js|*.m4|*.php|*.pl|*.pm|*.pod|*.sh|\ + *.ad[asb]|*.asm|*.inc|*.[ch]|*.[ch]pp|*.[ch]xx|*.cc|*.hh|\ + *.lsp|*.l|*.pas|*.p|*.xml|*.xps|*.xsl|*.axp|*.ppd|*.pov|\ + *.diff|*.patch|*.py|*.rb|*.sql|*.ebuild|*.eclass) + pygmentize -O style=friendly -f 256 "$1";; + *shrc*|*profile*) + pygmentize -O style=friendly -f 256 -l sh "$1" + ;; + *) + grep "#\!/bin/bash" "$1" > /dev/null + if [ "$?" -eq "0" ]; then + pygmentize -O style=friendly -f 256 -l sh "$1" + else + exit 1 + fi + esac +fi + +exit 0 diff --git a/.local/bin/my-open b/.local/bin/my-open @@ -19,6 +19,9 @@ then elif which exo-open > /dev/null 2>&1 then handler=exo-open +elif which xdg-open > /dev/null 2>&1 +then + handler=xdg-open else echo "my-open: No suitable handler found" > /dev/stderr exit -1 diff --git a/.mailcap b/.mailcap @@ -1 +1,2 @@ text/html; w3m -I %{charset} -T text/html; copiousoutput; +*/*; my-open '%s'; diff --git a/.shrc b/.shrc @@ -4,6 +4,8 @@ # vim: ft=sh [ -r $HOME/.shrc.local ] && . $HOME/.shrc.local +set -o emacs + if which vim > /dev/null 2>&1 then EDITOR=vim @@ -12,7 +14,9 @@ else fi VISUAL=$EDITOR -PS1="$LOGNAME@\h:\W\$ " +user=`printf '\033[34m%s\033[m' "$LOGNAME"` +host=`printf '\033[32m\\h\033[m'` +PS1="$user@$host:\W\$ " PAGER=less LESS="-FMRqX#10" export EDITOR VISUAL PS1 PAGER LESS @@ -22,10 +26,20 @@ then [ -r "$HOME/.less" ] || lesskey fi +if which lesspipe > /dev/null 2>&1 +then + LESSOPEN="|`which lesspipe` %s" +else + LESSOPEN="|$HOME/.lessfilter %s" +fi +export LESSOPEN +unset LESSCLOSE + # Keep the go folder hidden if which go > /dev/null 2>&1 then - export GOPATH=$HOME/.go + GOPATH=$HOME/.go + export GOPATH fi # Turn on ls colors @@ -38,8 +52,9 @@ then unset SOURCE_DIRCOLORS fi else - export CLICOLOR=1 - export LSCOLORS=ExFxBxDxCxegedabagacad + CLICOLOR=1 + LSCOLORS=ExFxBxDxCxegedabagacad + export CLICOLOR LSCOLORS fi # Colorize others if they exist @@ -63,7 +78,10 @@ then if [ -z "$SSH_TTY" ] && which gpgconf > /dev/null 2>&1 then unset SSH_AGENT_PID - export SSH_AUTH_SOCK=`gpgconf --list-dirs agent-ssh-socket` + if [ "`gpgconf --list-dirs agent-ssh-socket | wc -l`" -eq 1 ] + then + export SSH_AUTH_SOCK=`gpgconf --list-dirs agent-ssh-socket` + fi fi fi @@ -85,6 +103,8 @@ __appendpath "$HOME/.go/bin" __appendpath "$HOME/.cargo/bin" __appendpath "$HOME/.local/bin" +export PATH + # Handy Tmux aliases if which tmux > /dev/null 2>&1 then diff --git a/.vim/vimrc b/.vim/vimrc @@ -29,8 +29,18 @@ if has('vim_starting') endif set encoding=utf-8 set undofile - if isdirectory(expand('~/Documents/src/vim_plugins')) - set packpath+=~/Documents/src/vim_plugins + if has('packages') + if isdirectory(expand('~/Documents/src/vim_plugins')) + set packpath+=~/Documents/src/vim_plugins + endif + elseif filereadable('pack/bundle/vim-pathogen/autoload/pathogen.vim') + runtime 'pack/bundle/vim-pathogen/autoload/pathogen.vim' + if isdirectory(expand('~/Documents/src/vim_plugins')) + execute pathogen#infect('pack/bundle/start/{}', '~Documents/src/vim_plugins/pack/bundle/start{}') + else + execute pathogen#infect() + endif + execute pathogen#helptags() endif syntax on filetype plugin indent on @@ -38,11 +48,14 @@ endif " }}} " Globals {{{ +let readline_has_bash=1 let g:gutentags_project_root = ['.git','.project','.svn'] let delimitMate_expand_space = 1 let delimitMate_expand_cr = 1 if exists('$TMUX') - packadd vim-slime + if has('packages') + packadd vim-slime + endif let g:slime_no_mappings = 1 let g:slime_target = 'tmux' let g:slime_paste_file = tempname()