~gpanders/dotfiles

bcfa1f3ebf7f2cb73a6db56b266378b22c4ddeea — Greg Anders 2 years ago 5124a6c
Add fzf color options, nvim init file, neomake configs, minor vimrc updates, and xmodmap file
6 files changed, 103 insertions(+), 2 deletions(-)

A fzf.bash
A nvim/init.vim
M setup.sh
A vim/plugin/neomake.vim
M vimrc
A xmodmap
A fzf.bash => fzf.bash +41 -0
@@ 0,0 1,41 @@
# Setup fzf
# ---------
if [[ ! "$PATH" == */home/greande/.fzf/bin* ]]; then
  export PATH="$PATH:/home/greande/.fzf/bin"
fi

# Auto-completion
# ---------------
[[ $- == *i* ]] && source "/home/greande/.fzf/shell/completion.bash" 2> /dev/null

# Key bindings
# ------------
source "/home/greande/.fzf/shell/key-bindings.bash"

# Color
declare -A fzf_colors
fzf_colors["Solarized Dark"]="fg:-1,bg:-1,hl:33,fg+:254,bg+:235,hl+:33,info:136,prompt:136,pointer:230,marker:230,spinner:136"
fzf_colors["Solarized Light"]="fg:-1,bg:-1,hl:33,fg+:235,bg+:254,hl+:33,info:136,prompt:136,pointer:234,marker:234,spinner:136"
export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS} --color ${fzf_colors['Solarized Light']}"

# Use ag
if hash ag 2>/dev/null; then
  export FZF_CTRL_T_COMMAND="ag -g ''"
  _fzf_compgen_path() {
    ag -g '' "$1"
  }
fi

export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
export FZF_DEFAULT_OPTS="--color ${fzf_colors}"

if [ -n "$TMUX_PANE" ]; then
  export FZF_TMUX=1
  alias fzf="fzf-tmux -d40%"
else
  export FZF_TMUX=0
  export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS} --height 40% --inline-info --reverse"
fi



A nvim/init.vim => nvim/init.vim +3 -0
@@ 0,0 1,3 @@
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc

M setup.sh => setup.sh +17 -1
@@ 33,7 33,7 @@ if hash nvim 2>/dev/null; then
    ln -f $pfile $curr_dir/nvim/config/${pfile##*/}
  done

  ln -vfs $HOME/.vimrc $HOME/.config/nvim/init.vim
  # ln -vfs $HOME/.vimrc $HOME/.config/nvim/init.vim

  mkdir -p $HOME/.local/share/nvim/site/autoload
  cp -n $HOME/.vim/autoload/plug.vim $HOME/.local/share/nvim/site/autoload/plug.vim


@@ 92,11 92,27 @@ if [ ! -d "$HOME/.pyenv" ]; then
  fi
fi

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

read -r -p "Install solarized dircolors? [y/N] " ans
if [[ "$ans" =~ ^([Yy]|[Yy][Ee][Ss])+$ ]]; then
  curl -fsLo $HOME/.dir_colors \
    https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.ansi-universal
fi

if hash xmodmap 2>/dev/null; then
  read -r -p "Use .xmodmap file to set Caps Lock to Control? [y/N] " ans
  if [[ "$ans" =~ ^([Yy]|[Yy][Ee][Ss])+$ ]]; then
    if [ -f "$HOME/.xmodmap" ]; then
      cat $curr_dir/xmodmap >> $HOME/.xmodmap
    else
      cp $curr_dir/xmodmap $HOME/.xmodmap
    fi
  fi
fi

echo " "
echo "Setup complete."

A vim/plugin/neomake.vim => vim/plugin/neomake.vim +31 -0
@@ 0,0 1,31 @@
if exists('plugs') && has_key(plugs, 'neomake')
  function! s:is_battery()
    return readfile('/sys/class/power_supply/ac/online') == ['0']
  endfunction

  if s:is_battery()
    call neomake#configure#automake('w')
  else
    call neomake#configure#automake('nw', 1000)
  endif


  if has('mac')
    let g:neomake_c_clangtidy_maker = neomake#makers#ft#c#clangtidy()
    let g:neomake_c_clangcheck_maker = neomake#makers#ft#c#clangcheck()
    let g:neomake_c_clangtidy_maker.exe = '/usr/local/opt/llvm/bin/clang-tidy'
    let g:neomake_c_clangcheck_maker.exe = '/usr/local/opt/llvm/bin/clang-check'
    let g:neomake_cpp_clangtidy_maker = g:neomake_c_clangtidy_maker
    let g:neomake_cpp_clangcheck_maker = g:neomake_c_clangcheck_maker
  endif


  " Disable clang as a maker because you cannot specify a compilation database,
  " so it always complains about things it shouldn't
  let g:neomake_cpp_enabled_makers = neomake#makers#ft#cpp#EnabledMakers()
  let idx = index(g:neomake_cpp_enabled_makers, 'clang')
  if idx >= 0
    call remove(g:neomake_cpp_enabled_makers, idx)
  endif

endif

M vimrc => vimrc +4 -1
@@ 1,6 1,6 @@
" Plugins {{{
" Specify a directory for plugins
call plug#begin(has('nvim') ? '~/.config/nvim/plugins' : '~/.vim/bundle')
call plug#begin('~/.vim/plug')

Plug 'tpope/vim-unimpaired'     " A bunch of useful keybindings
Plug 'tpope/vim-capslock'       " Software caps lock


@@ 114,6 114,9 @@ set colorcolumn=80      " Show column at 80 characters
" Don't press Shift to enter command mode
" map ; :

" jj in Insert mode escapes to Normal mode
imap jj <Esc>

" Auto close braces in insert mode
inoremap {<CR> {<CR>}<Esc>ko


A xmodmap => xmodmap +7 -0
@@ 0,0 1,7 @@
!
! Set Caps_Lock and Control_L
!
clear lock
clear control
keycode 66 = Control_L
add control = Control_L Control_R