Skip to content

Commit

Permalink
some updates for this century
Browse files Browse the repository at this point in the history
  • Loading branch information
fuhrysteve committed Jun 30, 2017
1 parent a085648 commit ebebc06
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 151 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SHELL := /bin/bash -euo pipefail

install-neovim:
sudo -H bash ./install_neovim.sh

install-vim-plug:
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

install: install-neovim install-vim-plug deploy

deploy:
bash ./deploy.sh
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
cd ~/
git clone [email protected]:fuhrysteve/vim-settings.git .vim
cd ~/.vim && bash deploy.sh
git clone [email protected]:fuhrysteve/vim-settings.git
make install
45 changes: 17 additions & 28 deletions deploy.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,36 +1,25 @@
#!/bin/bash
#!/bin/bash -euo pipefail

if [ -f ~/.vimrc ] && [ ! -L ~/.vimrc ]
then
echo "Backing up existing ~/.vimrc to ~/.vimrc.bak"
mv ~/.vimrc ~/.vimrc.bak
fi
if [ -L ~/.vimrc ]
then
SYMLINK_LOCATION=$(readlink "$HOME/.vimrc")
if [ "$SYMLINK_LOCATION" == "$HOME/.vim/vimrc" ]; then
echo "Renaming symlink to point to ~/.vim/nvimrc"
rm ~/.vimrc
ln -s ~/.vim/nvimrc ~/.vimrc
else
echo "Already have ~/.vimrc symlink, we're good"
if [[ $EUID = 0 ]]; then
read -r -p "You're running as root. Are you sure you want to proceed? [y/N]" response
response=${response,,} # tolower
if [[ ! $response =~ ^(yes|y| ) ]]; then
exit 1
fi
else
echo "Creating symlink ~/.vimrc, which points to ~/.vim/vimrc"
ln -s ~/.vim/nvimrc ~/.vimrc
fi
if [ ! -d ~/.nvim ] || [ ! -L ~/.nvim ]; then
echo "Creating symlink ~/.nvim which points to ~/.vim"
ln -s ~/.vim ~/.nvim

if [ -f "$HOME/.config/nvim/init.vim" ] && [ ! -L "$HOME/.config/nvim/init.vim" ]
then
echo "Backing up existing $HOME/.config/nvim/init.vim to $HOME/.config/nvim/init.vim.bak"
mv "$HOME/.config/nvim/init.vim" "$HOME/.config/nvim/init.vim.bak"
fi

VIMINFO_OWNER=$(stat -c "%U" ~/.viminfo)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ "$VIMINFO_OWNER" == "root" ]
if [ -L "$HOME/.config/nvim/init.vim" ]
then
echo "Your .viminfo file is owned by root. Changing owner to $(whoami)"
sudo chown $(whoami) ~/.viminfo
echo "Already have $HOME/.config/nvim/init.vim symlink, we're good"
else
echo "Creating symlink $HOME/.config/nvim/init.vim which points to $DIR/init.vim"
ln -s "$DIR/init.vim" "$HOME/.config/nvim/init.vim"
fi
git submodule init
git submodule update
vim +PluginInstall! +qall
163 changes: 163 additions & 0 deletions init.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
set nocompatible " Use Vim defaults
filetype off " required for vundle, can be turned on later

call plug#begin('~/.local/share/nvim/plugged')

let g:syntastic_python_checkers=['flake8']
let g:syntastic_javascript_checkers=['jshint']
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-eunuch'
" Plug 'jmcantrell/vim-virtualenv'
Plug 'pangloss/vim-javascript'

if has('python')
Plug 'zchee/deoplete-jedi'
endif
Plug 'nvie/vim-flake8'
Plug 'romainl/flattened'
Plug 'gregsexton/MatchTag'
Plug 'bling/vim-airline'
Plug 'hdima/python-syntax'
Plug 'groenewege/vim-less'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'chase/vim-ansible-yaml'
Plug 'Shougo/deoplete.nvim'
Plug 'neomake/neomake'
Plug 'mpyatishev/vim-sqlformat'
Plug 'SirVer/ultisnips'

call plug#end()

" set runtimepath+=~/projects/stream

" UltiSnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"

autocmd CompleteDone * pclose
let g:jedi#auto_close_doc = 0 " close preview window after completion
let g:neomake_python_enabled_makers = ['flake8', 'mypy']
let g:neomake_verbose = 0
let g:neomake_javascript_eslint_exe = $PWD .'/node_modules/.bin/eslint'

let g:neomake_warning_sign = {
\ 'text': 'W',
\ 'texthl': 'WarningMsg',
\ }
let g:neomake_error_sign = {
\ 'text': 'E',
\ 'texthl': 'ErrorMsg',
\ }


" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
set grepformat=%f:%l:%c:%m,%f:%l:%m

" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'

" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif

" Use deoplete.
let g:deoplete#enable_at_startup = 1

" Always show status bar
set laststatus=2
au BufReadPost *.conf set syntax=ini

set termguicolors
set background=dark
colorscheme flattened_dark

" In case I ever go back to solarized, this helps make it sane
" let g:solarized_termcolors=256
" let g:solarized_termtrans=1
" colorscheme solarized
"
" if exists("g:colors_name")
" if g:colors_name != 'solarized'
" " I despise bright yellow line numbers
" " disabled for solarized
" highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
" endif
" endif

" Allow way more tabs
set tabpagemax=50

" disable arrow keys
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>

syntax on
" prevent slow downs from syntax highlighting
set synmaxcol=2048
set mouse=

"set smartindent
set autoindent
set cindent
"set smarttab
set shiftwidth=4
set tabstop=4
set expandtab
set softtabstop=4
" indent/outdent to nearest tabstops
set shiftround
set hidden

set ic " ignore case in search
set incsearch " incremental search
set hlsearch " highlight search results
set smartcase " ignore case when lowercase

" always have some lines of text when scrolling
set scrolloff=8

filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins

set bs=indent,eol,start " allow backspacing over everything in insert mode
"set ai " always set autoindenting on
"set backup " keep a backup file
set backupdir=~/.local/share/nvim/swap

" not necessary w/ neovim - neovim uses shada
" set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set number " linenumbers

" Only do this part when compiled with support for autocommands
if has("autocmd")

autocmd! BufWritePost,BufEnter * Neomake

" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
endif

"
cmap w!! w !sudo tee > /dev/null %
22 changes: 22 additions & 0 deletions install_neovim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash -euo pipefail

apt-get install -y software-properties-common python-dev python-pip python3-dev python3-pip

add_ppa() {
for i in "$@"; do
grep -h "^deb.*$i" /etc/apt/sources.list.d/* > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "Adding ppa:$i"
sudo add-apt-repository -y ppa:$i
else
echo "ppa:$i already exists"
fi
done
}

add_ppa neovim-ppa/stable
apt-get update
apt-get install -y neovim
sudo -H pip3 install -U neovim
sudo -H pip install -U neovim
120 changes: 0 additions & 120 deletions nvimrc

This file was deleted.

0 comments on commit ebebc06

Please sign in to comment.