From a2b81da12cc412b9eb98ce0b1007da6b018701c4 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Fri, 24 Apr 2020 16:41:23 -0500 Subject: [PATCH] clean things up, get a new slimmed down vimrc Signed-off-by: Adam Miller --- README.rst | 22 ----------------- bootstrap-vim.sh | 3 --- bootstrap.sh | 63 +++++++++++++++++++++++++++++++----------------- vimrc | 29 ++++++++++++---------- 4 files changed, 57 insertions(+), 60 deletions(-) diff --git a/README.rst b/README.rst index d560fad..faa5c4b 100644 --- a/README.rst +++ b/README.rst @@ -24,26 +24,6 @@ run it. bash ~/dotfiles/bootstrap.sh -Vim ---- - -For `vim`_ I use the `vimified`_ config distro because it's simple, it does -everything I want, is easy to use, and I'm really lazy. - -My modifications to the default vimified setup are are contained in the -``local.vimrc`` and ``after.vimrc`` files in this repository. The following is -how I set it all up including installing `vimified`_, and then symlink these -files into ``~/vimified/``. - -I also install `powerline`_'s `patched fonts`_ to supplement the `airline`_ -config that comes with vimified. - -Again, feel free to read the script if you're curious what it's doing. Otherwise -just run it. - -:: - - bash ~/dotfiles/bootstrap-vim.sh Notes ----- @@ -55,8 +35,6 @@ that others might find useful in it's own right then I'm happy to have shared. .. _vim: http://www.vim.org/ .. _Ansible: https://www.ansible.com/ -.. _vimified: https://github.com/zaiste/vimified -.. _powerline: https://github.com/powerline/powerline .. _airline: https://github.com/vim-airline/vim-airline .. _workstation setup: https://github.com/maxamillion/maxible .. _patched fonts: diff --git a/bootstrap-vim.sh b/bootstrap-vim.sh index 01c116f..4bd85a4 100755 --- a/bootstrap-vim.sh +++ b/bootstrap-vim.sh @@ -12,8 +12,5 @@ #ln -s ~/dotfiles/after.vimrc ~/vimified/after.vimrc #vim +BundleInstall +qall -curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - diff --git a/bootstrap.sh b/bootstrap.sh index e9051f5..3d3e3c0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,31 +1,50 @@ +#!/bin/bash # Ensure the needed dirs exist -mkdir -p ~/.config/{dunst,i3,i3status,fontconfig} -mkdir -p ~/.config/fontconfig/conf.d -mkdir ~/.tmuxinator -mkdir ~/.ptpython -mkdir ~/.fonts -mkdir ~/.ssh/ +mkdir_if_needed() { + if [[ ! -d $1 ]]; then + mkdir -p $1 + fi +} + +mkdir_if_needed ~/.config/{dunst,i3,i3status,fontconfig} +mkdir_if_needed ~/.config/fontconfig/conf.d +mkdir_if_needed ~/.tmuxinator +mkdir_if_needed ~/.ptpython +mkdir_if_needed ~/.fonts +mkdir_if_needed ~/.ssh +mkdir_if_needed ~/.vimundo # Symlink the conf files -ln -s ~/dotfiles/snclirc ~/.snclirc -ln -s ~/dotfiles/dunstrc ~/.config/dunst/dunstrc -ln -s ~/dotfiles/i3-config ~/.config/i3/config -ln -s ~/dotfiles/i3status-config ~/.config/i3status/config -ln -s ~/dotfiles/redshift.conf ~/.config/redshift.conf -ln -s ~/dotfiles/tmux.conf ~/.tmux.conf -ln -s ~/dotfiles/tmuxinator-wm.yml ~/.tmuxinator/wm.yml -ln -s ~/dotfiles/screenrc ~/.screenrc -ln -s ~/dotfiles/gitconfig ~/.gitconfig -ln -s ~/dotfiles/inputrc ~/.inputrc -ln -s ~/dotfiles/ptpython_config.py ~/.ptpython/config.py -ln -s ~/dotfiles/ssh_config ~/.ssh/config -ln -s ~/dotfiles/Xresources ~/.Xresources -ln -s ~/dotfiles/bashrc ~/.bashrc +symlink_if_needed() { + if [[ ! -h $2 ]]; then + ln -s $1 $2 + fi +} +symlink_if_needed ~/dotfiles/snclirc ~/.snclirc +symlink_if_needed ~/dotfiles/dunstrc ~/.config/dunst/dunstrc +symlink_if_needed ~/dotfiles/i3-config ~/.config/i3/config +symlink_if_needed ~/dotfiles/i3status-config ~/.config/i3status/config +symlink_if_needed ~/dotfiles/redshift.conf ~/.config/redshift.conf +symlink_if_needed ~/dotfiles/tmux.conf ~/.tmux.conf +symlink_if_needed ~/dotfiles/tmuxinator-wm.yml ~/.tmuxinator/wm.yml +symlink_if_needed ~/dotfiles/screenrc ~/.screenrc +symlink_if_needed ~/dotfiles/gitconfig ~/.gitconfig +symlink_if_needed ~/dotfiles/inputrc ~/.inputrc +symlink_if_needed ~/dotfiles/ptpython_config.py ~/.ptpython/config.py +symlink_if_needed ~/dotfiles/ssh_config ~/.ssh/config +symlink_if_needed ~/dotfiles/Xresources ~/.Xresources +symlink_if_needed ~/dotfiles/bashrc ~/.bashrc +symlink_if_needed ~/dotfiles/vimrc ~/.vimrc + +if [[ ! -f ~/.vim/autoload/plug.vim ]]; then + curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim; + vim +PlugInstall! +qall +fi # This doesn't appear to be necessary, but keep it around just in case -#ln -s ~/dotfiles/sshrc ~/.ssh/rc +#link_if_needed ~/dotfiles/sshrc ~/.ssh/rc # Set perms on ~/.ssh/config chmod 0600 ~/dotfiles/ssh_config -restorecon -Rvv ~/.ssh diff --git a/vimrc b/vimrc index 3e4e2d6..6ea5617 100644 --- a/vimrc +++ b/vimrc @@ -1,7 +1,4 @@ """"""""""""""""""""""""""" BEGIN VIM PLUG -" Specify a directory for plugins -" - For Neovim: stdpath('data') . '/plugged' -" - Avoid using standard Vim directory names like 'plugin' call plug#begin('~/.vim/plugged') Plug 'Glench/Vim-Jinja2-Syntax' Plug 'nathanaelkane/vim-indent-guides' @@ -11,12 +8,16 @@ Plug 'scrooloose/syntastic' Plug 'sjl/badwolf' Plug 'junegunn/vim-easy-align' Plug 'tpope/vim-endwise' - -" Initialize plugin system +Plug 'pearofducks/ansible-vim' call plug#end() """"""""""""""""""""""""""" END VIM PLUG """"""""""""""""""""""""""" BEING GENERAL SETTINGS +" tell it to use an undo file +set undofile +" set a directory to store the undo history +set undodir=$HOME/.vimundo/ + " fuck the arrow keys noremap noremap @@ -27,6 +28,7 @@ noremap map Y y$ command! W :w +command! Q :q set modelines=0 set relativenumber @@ -50,8 +52,8 @@ let g:indent_guides_exclude_filetypes = ['help', 'nerdtree'] let g:indent_guides_start_level=2 let g:indent_guides_guide_size=1 let g:indent_guides_auto_colors = 0 -autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=238 -autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=236 +au VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=238 +au VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=236 """ Syntastic let g:syntastic_check_on_wq = 0 @@ -71,14 +73,15 @@ cnoreabbrev SR SyntasticReset cnoreabbrev AR AirlineRefresh cnoreabbrev SP set paste - """ Random filetype settings au BufRead,BufNewFile *.adoc set filetype=asciidoc -autocmd BufNewFile,BufRead *.j2,*.jinja,*.jinja2 set ft=jinja -autocmd FileType python setlocal expandtab sw=4 sts=4 ts=8 -autocmd FileType yaml setlocal expandtab sw=2 sts=2 ts=4 -autocmd FileType ruby setlocal expandtab sw=2 sts=2 ts=4 -autocmd FileType go setlocal ts=4 sts=4 sw=4 noexpandtab +au BufRead,BufNewFile *.j2,*.jinja,*.jinja2 set ft=jinja +au BufRead,BufNewFile */playbooks/*.yml,*/roles/*.yml,*/ansible_collections/*.yml set filetype=yaml.ansible +au FileType python setlocal expandtab sw=4 sts=4 ts=8 +au FileType sh setlocal expandtab sw=4 sts=4 ts=8 +au FileType yaml setlocal expandtab sw=2 sts=2 ts=4 +au FileType ruby setlocal expandtab sw=2 sts=2 ts=4 +au FileType go setlocal ts=4 sts=4 sw=4 noexpandtab " Some webfonts don't handle this well which screws up ssh (hterm) on ChromeOS set showbreak=>