From f113e0428c7bac99699284f2721fa6306e26eee1 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Thu, 31 Aug 2017 00:19:46 -0400 Subject: [PATCH] Swap to nvim, but make sure vim still works --- Makefile | 10 +++++++--- aliases | 2 +- gitconfig | 1 - nvim/init.vim | 3 +++ tmux.conf | 5 ++++- vimrc | 19 +++++++++++-------- zshenv | 8 ++++++++ 7 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 nvim/init.vim diff --git a/Makefile b/Makefile index 1be3068..241b9e9 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,18 @@ excludes = -I Makefile -I README.md -symlinks = $(shell find . \( ! -iname "Makefile" ! -iname "README.md" ! -iname ".*" ! -path "./.git/*" ! -path "./zsh/*" \) | sed 's|./||') +symlinks = $(shell find . \( ! -iname "Makefile" ! -iname "README.md" ! -iname ".*" ! -path "./.git/*" ! -path "./zsh/*" ! -path "./nvim/*" ! -iname "nvim" \) | sed 's|./||') -.PHONY: $(symlinks) +.PHONY: $(symlinks) nvim all: install install: plug-vim $(symlinks) +nvim: + mkdir -p ~/.config/nvim + cp nvim/init.vim ~/.config/nvim/ + plug-vim: - if test ! -d ~/.vim/autoload/plug.vim ; then \ + if test ! -f ~/.vim/autoload/plug.vim ; then \ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim ; \ fi diff --git a/aliases b/aliases index 63e336f..1a5af83 100644 --- a/aliases +++ b/aliases @@ -80,7 +80,7 @@ alias pf="port-forward" alias t="tmux new-session -A -s" alias tf="tail -f" alias tls="tmux list-sessions" -alias v="vim" +alias v="$EDITOR" alias w="python -m SimpleHTTPServer" alias wo="curl http://wttr.in/48912?m" alias y="yarn" diff --git a/gitconfig b/gitconfig index b8c6451..475bde9 100644 --- a/gitconfig +++ b/gitconfig @@ -33,7 +33,6 @@ gpgsign = true [core] autocrlf = input - editor = vim excludesfile = ~/.gitignore_global filemode = false [gpg] diff --git a/nvim/init.vim b/nvim/init.vim new file mode 100644 index 0000000..0716b3f --- /dev/null +++ b/nvim/init.vim @@ -0,0 +1,3 @@ +set runtimepath+=~/.vim,~/.vim/after +set packpath+=~/.vim +source ~/.vimrc diff --git a/tmux.conf b/tmux.conf index b759615..8346e8e 100644 --- a/tmux.conf +++ b/tmux.conf @@ -1,10 +1,13 @@ # for setting up bind-key r source-file ~/.tmux.conf \; display-message " ✱ ~/.tmux.conf is reloaded" -# 256 colors +# colors set -g default-terminal "screen-256color" set-option -ga terminal-overrides ",xterm-256color:Tc" +# faster escaping? From neovim CheckHealth +set-option -sg escape-time 10 + # double tap for back and forth bind-key C-b last-window diff --git a/vimrc b/vimrc index 8632e25..807cf7f 100644 --- a/vimrc +++ b/vimrc @@ -2,8 +2,8 @@ call plug#begin('~/.vim/plugged') " colors -Plug 'alessandroyorba/alduin' Plug 'nanotech/jellybeans.vim' +Plug 'joshdick/onedark.vim' " keepers Plug 'airblade/vim-gitgutter' @@ -46,8 +46,6 @@ set cpoptions+=$ " delimit end of change text set laststatus=2 " Always show status line set showmode " Show current mode set history=100 " History length -set cursorline " Highlight current line -set cursorcolumn " Highlight current column set nowrap " Disable wrapping by default set backspace=2 " Backspace over indent, eol, start of insert set hlsearch " Search highlights @@ -147,13 +145,18 @@ map sz :so ~/.vimrc " PLUGIN CONFIGURATION " style -colorscheme jellybeans +set t_8f=[38;2;%lu;%lu;%lum +set t_8b=[48;2;%lu;%lu;%lum +if has('nvim') + set termguicolors + set cursorline " Highlight current line + set cursorcolumn " Highlight current column + colorscheme onedark +else + colorscheme jellybeans +endif syntax enable -highlight ColorColumn ctermbg=236 -highlight CursorColumn ctermbg=236 -highlight CursorLine ctermbg=236 - " go let g:go_fmt_command = "goimports" diff --git a/zshenv b/zshenv index 9c0ea5a..25e13c4 100644 --- a/zshenv +++ b/zshenv @@ -28,4 +28,12 @@ fi # MAN [[ -d "$GNU_TOOLS_MAN_PATH" ]] && MANPATH="$GNU_TOOLS_MAN_PATH:$MANPATH" +# EDITOR +if [[ -x "$(command -v nvim)" ]]; then + export {EDITOR,GIT_EDITOR}=nvim +else + export {EDITOR,GIT_EDITOR}=vim +fi + + export GOPATH="$HOME/go-workspace/"