~gpanders/dotfiles

17467a41b7071a894aab9da026dfb953adc639e3 — Greg Anders 2 years ago 2a5c058
Use stow to create and manage symlinks to home directory
34 files changed, 281 insertions(+), 87 deletions(-)

M .gitignore
M .gitmodules
R Xmodmap => X/.Xmodmap
R bash_aliases => bash/.bash_aliases
R bashrc => bash/.bashrc
R fzf.bash => bash/.fzf.bash
R conkyrc => conky/.conkyrc
A emacs/.emacs.d/custom.el
A emacs/.emacs.d/init.el
A emacs/.emacs.d/lisp/evil-config.el
A emacs/.gitignore
R i3/{config => .config/i3/config}
R i3/{conky-i3bar => .config/i3/conky-i3bar}
R nvim/{init.vim => .config/nvim/init.vim}
R pyenvrc => pyenv/.pyenvrc
M setup.sh
D st
A tmux/.gitignore
R tmux.conf => tmux/.tmux.conf
A tmux/.tmux/plugins/tpm
D tmux/plugins/tpm
A vim/.gitignore
A vim/.vim/.gitignore
R vim/{autoload/plug.vim => .vim/autoload/plug.vim}
R vim/{config/capslock.vim => .vim/config/capslock.vim}
R vim/{config/deoplete.vim => .vim/config/deoplete.vim}
R vim/{config/fzf.vim => .vim/config/fzf.vim}
R vim/{config/lightline.vim => .vim/config/lightline.vim}
R vim/{config/neomake.vim => .vim/config/neomake.vim}
R vim/{config/python.vim => .vim/config/python.vim}
R vim/{config/sneak.vim => .vim/config/sneak.vim}
R vim/{config/vimtex.vim => .vim/config/vimtex.vim}
R vim/{plugins.vim => .vim/plugins.vim}
R vimrc => vim/.vimrc
M .gitignore => .gitignore +0 -4
@@ 1,4 0,0 @@
tmux/plugins
tmux/resurrect
vim/plug
vim/session

M .gitmodules => .gitmodules +1 -5
@@ 1,8 1,4 @@
[submodule "tmux/plugins/tpm"]
	path = tmux/plugins/tpm
	path = tmux/.tmux/plugins/tpm
	url = https://github.com/tmux-plugins/tpm
	branch = master
[submodule "st"]
	path = st
	url = git://git.suckless.org/st
	branch = master

R Xmodmap => X/.Xmodmap +0 -0
R bash_aliases => bash/.bash_aliases +0 -0
R bashrc => bash/.bashrc +0 -0
R fzf.bash => bash/.fzf.bash +0 -0
R conkyrc => conky/.conkyrc +0 -0
A emacs/.emacs.d/custom.el => emacs/.emacs.d/custom.el +35 -0
@@ 0,0 1,35 @@
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default-frame-alist
    (quote
     ((horizontal-scroll-bars)
      (width . 200)
      (height . 60))))
 '(display-line-numbers t)
 '(evil-magit-state (quote normal))
 '(evil-magit-use-y-for-yank nil)
 '(inhibit-startup-screen t)
 '(initial-frame-alist
   (quote
    ((vertical-scroll-bars)
     (width . 200)
     (height . 60))))
 '(markdown-command "pandoc")
 '(markdown-open-command "/usr/local/bin/macdown")
 '(menu-bar-mode nil)
 '(package-selected-packages
   (quote
    (flx delight diminish solarized-theme dracula-theme exec-path-from-shell evil-magit markdown-mode smart-mode-line better-defaults leuven-theme evil-collection counsel ivy projectile evil-surround evil-commentary evil-leader key-chord f magit evil use-package)))
 '(scroll-bar-mode nil)
 '(sml/no-confirm-load-theme t)
 '(sml/theme (quote light))
 '(tool-bar-mode nil))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:weight normal :height 120 :width normal :family "Fira Code")))))

A emacs/.emacs.d/init.el => emacs/.emacs.d/init.el +151 -0
@@ 0,0 1,151 @@
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file)

; Increase garbage collection threshold
(setq gc-cons-threshold 20000000)

(require 'package)

(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))

(setq package-enable-at-startup nil)
(package-initialize)

;; Install use-package
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(eval-when-compile
  (require 'use-package))

(setq use-package-always-ensure t) ; Always download package if not already installed
(use-package use-package-ensure-system-package)

(setq url-proxy-services '(("http" . "wwwproxy.sandia.gov:80")
                           ("https" . "wwwproxy.sandia.gov:80")))

;; Themes
(use-package dracula-theme)
(use-package leuven-theme)
(use-package solarized-theme)
(load-theme 'solarized-dark t)

;; Better defaults for Emacs
(use-package better-defaults
  :config
  ;; Disable some options
  (ido-mode nil)
  (setq visible-bell nil)
  (setq ring-bell-function 'ignore))

;; Use delight to manage minor mode displays
(use-package delight)

;; Allow key-chords
(use-package key-chord
  :config
  (key-chord-mode 1))

;; Make sure Emacs PATH matches shell PATH
(use-package exec-path-from-shell
  :if (memq window-system '(mac ns x))
  :config
  (exec-path-from-shell-initialize))

;; Evil mode!
(use-package evil
  :custom
  (evil-want-C-u-scroll t)
  (evil-want-keybinding nil)
  :config
  ;; Install evil packages
  (use-package evil-leader
    :config
    (global-evil-leader-mode))
  (use-package evil-commentary
    :delight
    :config
    (evil-commentary-mode))
  (use-package evil-surround
    :config
    (global-evil-surround-mode 1))
  (use-package evil-magit
    :custom
    (evil-magit-state 'normal)
    (evil-magit-use-y-for-yank nil))
  (use-package evil-collection
    :config
    (evil-collection-init))
  (use-package evil-unimpaired
    :disabled
    :load-path "user/evil-unimpaired"
    :config
    (evil-unimpaired-mode))
  (use-package evil-config
    :ensure f
    :load-path "lisp"
    :after evil-leader)
  ;; Enable evil mode
  (evil-mode 1))

;; Git porcelain
(use-package magit
  :ensure-system-package git)

;; Package management
(use-package projectile
  :bind-keymap
  ("C-c p" . projectile-command-map)
  :config
  (projectile-mode 1))

;; Fuzzy matching
(use-package flx)

;; Similar to ido or helm
(use-package ivy
  :delight
  :bind ("C-s" . swiper)
  :custom
  (ivy-use-virtual-buffers t)
  (enable-recursive-minibuffers t)
  :config
  (ivy-mode 1)
  (setq projectile-completion-system 'ivy))

;; Includes ivy keybindings
(use-package counsel
  :delight
  :config
  (counsel-mode 1))

;; Smart mode line
(use-package smart-mode-line
  :disabled
  :custom
  (sml/no-confirm-load-theme t)
  (sml/theme 'light)
  :config
  (sml/setup))

;; Markdown mode
(use-package markdown-mode
  :ensure-system-package pandoc
  :commands (markdown-mode gfm-mode)
  :mode
  ("README\\.md\\'" . gfm-mode)
  ("\\.md\\'" . markdown-mode)
  ("\\.markdown\\'" . markdown-mode)
  :config
  (setq markdown-command "pandoc")
  (when (eq system-type 'darwin)
    (setq markdown-open-command "/usr/local/bin/macdown")))

;; Disable line numbers in terminal
(add-hook 'term-mode-hook (lambda () (display-line-numbers-mode -1)))

;; Start server if not already running
(if (not (server-running-p)) (server-start))

A emacs/.emacs.d/lisp/evil-config.el => emacs/.emacs.d/lisp/evil-config.el +34 -0
@@ 0,0 1,34 @@
;; Evil mode configuration
(defun find-user-init-file ()
  "Edit the `user-init-file', in another window."
  (interactive)
  (find-file-other-window user-init-file))

(defun load-user-init-file ()
  "Load the `user-init-file'."
  (interactive)
  (load-file user-init-file))

(defun toggle-relative-line-numbers ()
  "Toggle relative line numbers."
  (interactive)
  (if (eq display-line-numbers 'relative)
      (setq display-line-numbers t)
    (setq display-line-numbers 'relative)))

;; Vim keybindings
(evil-leader/set-leader ",")
(evil-leader/set-key
  "w" 'save-buffer
  "b" 'ivy-switch-buffer
  "r" 'toggle-relative-line-numbers
  "ev" 'find-user-init-file
  "sv" 'load-user-init-file)

(define-key evil-normal-state-map "\C-y" 'yank)
(define-key evil-normal-state-map "\C-e" 'end-of-line)
(define-key evil-normal-state-map "-" 'dired-jump)
(key-chord-define evil-insert-state-map (kbd "j k") 'evil-normal-state)
(key-chord-define evil-replace-state-map (kbd "j k") 'evil-normal-state)

(provide 'evil-config)

A emacs/.gitignore => emacs/.gitignore +12 -0
@@ 0,0 1,12 @@
*~
\#*
.emacs.d/auto-save-list
.emacs.d/elpa
.emacs.d/elpa-*
.emacs.d/smex-items
.emacs.d/ido.last
.emacs.d/projectile-bookmarks.eld
.emacs.d/projectile.cache
.emacs.d/recentf
.emacs.d/server
.emacs.d/network-security.data

R i3/config => i3/.config/i3/config +0 -0
R i3/conky-i3bar => i3/.config/i3/conky-i3bar +0 -0
R nvim/init.vim => nvim/.config/nvim/init.vim +0 -0
R pyenvrc => pyenv/.pyenvrc +0 -0
M setup.sh => setup.sh +37 -75
@@ 4,76 4,56 @@ shopt -s extglob

curr_dir=$(pwd)

if [ -h $HOME/.vim ]; then
  rm $HOME/.vim
elif [ -d $HOME/.vim ]; then
  mv $HOME/.vim $HOME/.vim.bak
fi
ln -sv $curr_dir/vim $HOME/.vim

if [ -h $HOME/.tmux ]; then
  rm $HOME/.tmux
elif [ -d $HOME/.tmux ]; then
  mv $HOME/.tmux $HOME/.tmux.bak
fi
ln -sv $curr_dir/tmux $HOME/.tmux

if [ -h $HOME/.vimrc ]; then
  rm $HOME/.vimrc
elif [ -f $HOME/.vimrc ]; then
  mv $HOME/.vimrc $HOME/.vimrc.bak
fi
ln -sv $curr_dir/vimrc $HOME/.vimrc

if [ -h $HOME/.tmux.conf ]; then
  rm $HOME/.tmux.conf
elif [ -f $HOME/.tmux.conf ]; then
  mv $HOME/.tmux.conf $HOME/.tmux.conf.bak
fi
ln -sv $curr_dir/tmux.conf $HOME/.tmux.conf
function install() {
  if [[ "$OSTYPE" == darwin* ]]; then
    brew install "$@"
  elif [[ "$OSTYPE" == linux-gnu ]]; then
    if hash apt-get 2>/dev/null; then
      sudo apt-get install -y "$@"
    elif hash yum 2>/dev/null; then
      sudo yum install "$@"
    elif hash pacman 2>/dev/null; then
      sudo pacman -S "$@"
    fi
  fi
}

mkdir -p $HOME/.config/nvim
if [ -h $HOME/.config/nvim/init.vim ]; then
  rm $HOME/.config/nvim/init.vim
elif [ -f $HOME/.config/nvim/init.vim ]; then
  mv $HOME/.config/nvim/init.vim $HOME/.config/nvim/init.vim.bak
if ! hash stow 2>/dev/null; then
  install stow
fi
ln -sv $curr_dir/nvim/init.vim $HOME/.config/nvim/init.vim

if [[ "$SHELL" =~ "bash" ]]; then
  if [ -h $HOME/.fzf.bash ]; then
    rm $HOME/.fzf.bash
  elif [ -f $HOME/.fzf.bash ]; then
    mv $HOME/.fzf.bash $HOME/.fzf.bash.bak
  fi
  ln -sv $curr_dir/fzf.bash $HOME/.fzf.bash
echo "Creating symlinks for vim"
stow vim
echo "Creating symlinks for bash"
stow bash
echo "Creating symlinks for tmux"
stow tmux

  if [ -h $HOME/.bashrc ]; then
    rm $HOME/.bashrc
  elif [ -f $HOME/.bashrc ]; then
    mv $HOME/.bashrc $HOME/.bashrc.bak
if ! hash i3 2>/dev/null; then
  read -r -p "Install i3? [y/N]" ans
  if [[ "$ans" =~ ^([Yy]|[Yy][Ee][Ss])+$ ]]; then
    install i3wm conky
  fi
  ln -sv $curr_dir/bashrc $HOME/.bashrc
fi

# Use .Xmodmap to set Caps Lock to Control
if hash xmodmap 2>/dev/null; then
  if [ -h "$HOME/.Xmodmap" ]; then
    rm $HOME/.Xmodmap
  elif [ -f "$HOME/.Xmodmap" ]; then
    mv $HOME/.Xmodmap $HOME/.Xmodmap.bak
  fi
  ln -s $curr_dir/Xmodmap $HOME/.Xmodmap
if hash i3 2>/dev/null; then
  echo "Creating symlinks for i3"
  stow i3

  echo "Creating symlinks for conky"
  stow conky
fi

# Upgrade vim-plug and install vim plugins
if [ ! -d $curr_dir/vim/plug ]; then
  vim -u $curr_dir/vim/plugins.vim -c PlugUpgrade -c PlugInstall -c qall!
if [ ! -d $HOME/.vim/plug ]; then
  echo "Installing vim plugins..."
  vim -u $HOME/.vim/plugins.vim -c PlugUpgrade -c PlugInstall -c qall! 2>&1 > /dev/null &
  echo "Done."
fi

if hash tmux 2>/dev/null; then
  # Install tmux plugins in a background session
  git submodule update --init --remote tmux/plugins/tpm
  git submodule update --init --remote tmux/.tmux/plugins/tpm
  tmux new-session -s install_plugins -d "tmux run-shell $HOME/.tmux/plugins/tpm/bindings/install_plugins"
fi



@@ 139,17 119,10 @@ if hash zsh 2>/dev/null; then
  fi
fi

if [[ "$SHELL" =~ "bash" ]]; then
  read -r -p "Use .bash_aliases file? [y/N] " ans
  if [[ "$ans" =~ ^([Yy]|[Yy][Ee][Ss])+$ ]]; then
    cp $curr_dir/bash_aliases $HOME/.bash_aliases
  fi
fi

if [ ! -d "$HOME/.pyenv" ]; then
  read -r -p "Install pyenv? [y/N] " ans
  if [[ "$ans" =~ ^([Yy]|[Yy][Ee][Ss])+$ ]]; then
    ln -s $curr_dir/pyenvrc $HOME/.pyenvrc
    stow pyenv
    if [[ "$OSTYPE" == darwin* ]]; then
      brew install pyenv pyenv-virtualenv
    elif [[ "$OSTYPE" == linux-gnu ]]; then


@@ 159,17 132,6 @@ if [ ! -d "$HOME/.pyenv" ]; then
  fi
fi

# Setup conky and i3
mkdir -p $HOME/.config/i3
if [ -h $HOME/.conkyrc ]; then
  rm $HOME/.conkyrc
elif [ -f $HOME/.conkyrc ]; then
  mv $HOME/.conkyrc $HOME/.conkyrc.bak
fi
ln -s $curr_dir/conkyrc $HOME/.conkyrc
ln -sf $curr_dir/i3/config $HOME/.config/i3/config
ln -sf $curr_dir/i3/conky-i3bar $HOME/.config/i3/conky-i3bar

echo "Install solarized dircolors?"
echo "    1) light"
echo "    2) dark"

D st => st +0 -1
@@ 1,1 0,0 @@
Subproject commit 30ec9a3dc354ab1a561c9edd808046bdf5dfd392

A tmux/.gitignore => tmux/.gitignore +2 -0
@@ 0,0 1,2 @@
.tmux/plugins
.tmux/resurrect

R tmux.conf => tmux/.tmux.conf +1 -1
@@ 25,7 25,7 @@ set -g status-right  "#{prefix_highlight} #S "
set -g @continuum-restore 'on'

# Set solarized colors
set -g @colors-solarized 'light'
set -g @colors-solarized 'dark'

# List of plugins
set -g @plugin "tmux-plugins/tpm"

A tmux/.tmux/plugins/tpm => tmux/.tmux/plugins/tpm +1 -0
@@ 0,0 1,1 @@
Subproject commit 95f78336c3972f3e6648b7b3db754f2224320a5e

D tmux/plugins/tpm => tmux/plugins/tpm +0 -1
@@ 1,1 0,0 @@
Subproject commit 95f78336c3972f3e6648b7b3db754f2224320a5e

A vim/.gitignore => vim/.gitignore +3 -0
@@ 0,0 1,3 @@
.vim/plug
.vim/session
.vim/.netrwhist

A vim/.vim/.gitignore => vim/.vim/.gitignore +1 -0
@@ 0,0 1,1 @@
.netrwhist

R vim/autoload/plug.vim => vim/.vim/autoload/plug.vim +0 -0
R vim/config/capslock.vim => vim/.vim/config/capslock.vim +0 -0
R vim/config/deoplete.vim => vim/.vim/config/deoplete.vim +0 -0
R vim/config/fzf.vim => vim/.vim/config/fzf.vim +0 -0
R vim/config/lightline.vim => vim/.vim/config/lightline.vim +0 -0
R vim/config/neomake.vim => vim/.vim/config/neomake.vim +0 -0
R vim/config/python.vim => vim/.vim/config/python.vim +0 -0
R vim/config/sneak.vim => vim/.vim/config/sneak.vim +0 -0
R vim/config/vimtex.vim => vim/.vim/config/vimtex.vim +0 -0
R vim/plugins.vim => vim/.vim/plugins.vim +0 -0
R vimrc => vim/.vimrc +3 -0
@@ 293,6 293,9 @@ augroup vimrc

  " crontab
  au FileType crontab setlocal nobackup nowritebackup

  " help
  au FileType help nnoremap q :q<CR>
  " }}}

augroup END