dotfiles

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

commit c2a062ca0b25a20be5cd8f6dd7705bcd40a0988e
parent 10ccf648247e4a1d0939b70cc173b7d5f88d4597
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Tue, 16 Jan 2018 10:58:47 +0000

Merge branch 'master' of github.com:djmoch/dotfiles

Diffstat:
M.Xresources | 8++++----
M.local/bin/my-init | 81++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
M.profile | 12++++++------
D.vim/pack/get_plugins | 42------------------------------------------
M.vim/vimrc | 16+++++++++++++---
5 files changed, 103 insertions(+), 56 deletions(-)

diff --git a/.Xresources b/.Xresources @@ -26,22 +26,22 @@ *color7: #6C6C6C *color15: #FFFFFF -! Xterm +! XTerm XTerm.termName: xterm-256color XTerm*font: -bitstream-meslo lg m dz-medium-r-normal--11-*-*-*-*-*-*-* XTerm*renderFont: true XTerm*faceName: -bitstream-meslo lg m dz-medium-r-normal--11-*-*-*-*-*-*-* XTerm*faceSize: 10.0 XTerm*visualBell: true +XTerm*bellIsUrgent: true XTerm*highlightColorMode: true XTerm*highlightReverse: false XTerm*highlightColor: #8FAFD7 -XTerm*bellIsUrgent: true -! Xdvi +! XDvi XDvi.background: #BCBCBC XDvi.foreground: #262626 -XDvi.editor: gvim --servername XDvi --remote +%l %f +XDvi.editor: gvim --servername xdvi --remote +%l %f XDvi.wwwBrowser: my-open XDvi.expertMode: 31 XDvi.shrinkFactor: 7 diff --git a/.local/bin/my-init b/.local/bin/my-init @@ -4,8 +4,38 @@ # # A place to dump run-once type initializations -if [ ! -d "$HOME/.terminfo" ] +vim_bundle_path="$HOME/.vim/pack/bundle" + +__has() +{ + for token in $@ + do + type -p $token > /dev/null 2>&1 + [ $? -ne 0 ] && return 1 + done + return 0 +} + +__clone() +{ + git clone https://github.com/$1.git > /dev/null 2>&1 +} + +echo "Performing run-once initializations" + +if [ -n "$1" -a "$1" == "-f" ] then + echo " Re-initialization requested" + rm -f "$HOME/._.djmoch" + rm -rf "$HOME/.terminfo" + rm -rf "$vim_bundle_path" + rm "$HOME/.less" +fi + +# Terminfo +if __has "infocmp" "tic" && [ ! -d "$HOME/.terminfo" ] +then + echo " Initializing Termcaps" if infocmp tmux-256color > /dev/null 2>&1 then tic "$HOME/.config/terminfo/tmux.terminfo" @@ -13,3 +43,52 @@ then tic "$HOME/.config/terminfo/tmux-from-screen.terminfo" fi fi + +# Lesskey +if __has "lesskey" && [ ! -f "$HOME/.less" ] +then + echo " Initializing .less" + lesskey +fi + +# Vim plugins +if __has "git" && [ ! -d "$vim_bundle_path" ] +then + echo " Downloading Vim plugins" + # Plugins that should always be enabled + mkdir -p bundle/start + cd bundle/start + __clone romainl/Apprentice + __clone tpope/vim-commentary + __clone tpope/vim-eunuch + __clone tpope/vim-fugitive + __clone tpope/vim-obsession + __clone tpope/vim-scriptease + __clone tpope/vim-surround + __clone tpope/vim-unimpaired + __clone tpope/vim-vinegar + __clone Raimondi/delimitMate + __clone junegunn/goyo.vim + __clone junegunn/limelight.vim + __clone ajh17/VimCompletesMe + __clone skammer/vim-css-color + __clone ludovicchabant/vim-gutentags + __clone beloglazov/vim-online-thesaurus + __clone jszakmeister/vim-togglecursor + __clone chr4/sslsecure.vim + cd - > /dev/null 2>&1 + + # Plugins used optionally + mkdir -p bundle/opt + cd bundle/opt + __clone jpalardy/vim-slime + cd - > /dev/null 2>&1 +fi + +if [ ! -f "$HOME/._.djmoch" ] +then + touch "$HOME/._.djmoch" + chmod 000 "$HOME/._.djmoch" +fi + +unset __clone __has diff --git a/.profile b/.profile @@ -20,11 +20,6 @@ PAGER=less LESS="-FMRqX#10" export EDITOR VISUAL PAGER LESS -if type -p lesskey > /dev/null 2>&1 && [ -r "$HOME/.lesskey" ] -then - lesskey -fi - if type -p lesspipe > /dev/null 2>&1 then eval `lesspipe` @@ -40,7 +35,7 @@ then export GOPATH fi -# Append our default paths +# Add our default paths __addpath () { if [ -d "$1" ] @@ -65,3 +60,8 @@ __addpath "$HOME/.local/bin" "before" unset __addpath export PATH + +if type -p my-init > /dev/null 2>&1 && [ ! -f "$HOME/._.djmoch" ] +then + my-init +fi diff --git a/.vim/pack/get_plugins b/.vim/pack/get_plugins @@ -1,42 +0,0 @@ -#!/bin/sh -__clone() -{ - echo "Cloning $1" - git clone https://github.com/$1 > /dev/null 2>&1 -} - -if [ -d bundle/start -o -d bundle/opt ] -then - echo "bundle/start or bundle/opt already exists. Aborting." > 2 - exit 1 -fi - -# Plugins that should always be enabled -mkdir -p bundle/start -cd bundle/start -__clone romainl/Apprentice -__clone tpope/vim-commentary -__clone tpope/vim-eunuch -__clone tpope/vim-fugitive -__clone tpope/vim-obsession -__clone tpope/vim-scriptease -__clone tpope/vim-surround -__clone tpope/vim-unimpaired -__clone tpope/vim-vinegar -__clone Raimondi/delimitMate -__clone junegunn/goyo.vim -__clone junegunn/limelight.vim -__clone ajh17/VimCompletesMe -__clone skammer/vim-css-color -__clone ludovicchabant/vim-gutentags -__clone beloglazov/vim-online-thesaurus -__clone jszakmeister/vim-togglecursor -cd - > /dev/null 2>&1 - -# Plugins used optionally -mkdir -p bundle/opt -cd bundle/opt -__clone jpalardy/vim-slime -cd - > /dev/null 2>&1 - -unset __clone diff --git a/.vim/vimrc b/.vim/vimrc @@ -64,6 +64,16 @@ endif " }}} " Helper functions {{{ +function! MyTmuxStatusLine(action) + if exists('$TMUX') + if a:action == 'off' + execute 'silent !tmux set -s status off' | redraw! + else + execute 'silent !tmux set -s status on' | redraw! + endif + endif +endfunction + function! MyFileEncoding() if &fileencoding != '' return '['.&fileencoding.']' @@ -279,8 +289,8 @@ augroup myvimrc autocmd BufWritePost *imrc so % | call MyItalicize() endif autocmd VimResized * wincmd = | call MyDiffOpt() - autocmd User GoyoEnter Limelight - autocmd User GoyoLeave Limelight! + autocmd User GoyoEnter Limelight | execute MyTmuxStatusLine('off') + autocmd User GoyoLeave Limelight! | execute MyTmuxStatusLine('') autocmd QuickFixCmdPost [^l]* nested cwindow autocmd QuickFixCmdPost l* nested lwindow autocmd QuickFixCmdPre [^l]* nested silent! cclose @@ -320,7 +330,7 @@ endif if has('win32') || has('win64') nnoremap <Leader>o :execute 'silent ! start '.expand('<cWORD>')<CR> else - nnoremap <Leader>o :execute 'silent !my-start ' + nnoremap <Leader>o :execute 'silent !my-open ' \ .expand(shellescape('<cWORD>')) \| redraw!<CR> endif nnoremap <Leader>c :silent! execute 'cclose' \|