dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit c60f6ea853d2d5001bb7b60d24d9393aff83ba90 (patch)
parent 85822d5a7be8ff95bc5c01a8c375dc52ef850349
Author: Alexander Karle <akarle@umass.edu>
Date:   Sun, 23 Sep 2018 19:57:56 -0400

[vim] fall cleaning

I've been working on learning some Vimscript, so I spent
a bit of time to cleanup my .vimrc with my newfound knowledge
and just to remove things that I don't use anymore in some cases.

Diffstat:
Mneovim/init.vim | 4----
Mvim/gvimrc | 3---
Mvim/syntax/python.vim | 3++-
Mvim/vimrc | 63+++++++++++++++++++--------------------------------------------
4 files changed, 21 insertions(+), 52 deletions(-)

diff --git a/neovim/init.vim b/neovim/init.vim @@ -7,10 +7,6 @@ set runtimepath+=~/.vim,~/.vim/after set packpath+=~/.vim source ~/.vimrc -" Custom mappings for terminal -tnoremap <ESC> <C-\><C-n> -tnoremap <M-[> <Esc> - " no numbers in terminal autocmd TermOpen * setlocal nonumber diff --git a/vim/gvimrc b/vim/gvimrc @@ -2,9 +2,6 @@ set noerrorbells visualbell t_vb= autocmd GUIEnter * set visualbell t_vb= -" Gonna be using that system clipboard -set clipboard=unnamed - " Pretty printing set printoptions=left:1in,right:1in,paper:letter set printfont=Consolas:h11 diff --git a/vim/syntax/python.vim b/vim/syntax/python.vim @@ -1,2 +1,3 @@ -" Highlight the self keyword red +" Highlight the self keyword syn keyword pythonSelf self +highlight link pythonSelf GruvboxBlue diff --git a/vim/vimrc b/vim/vimrc @@ -6,13 +6,13 @@ " GENERAL EDITOR SETTINGS {{{ " Try to be platform agnostic: if has('win64') || has('win32') - let s:vimdir = $HOME . '/vimfiles' + let s:vimdir = expand($HOME . '/vimfiles') else - let s:vimdir = $HOME . '/.vim' + let s:vimdir = expand($HOME . '/.vim') endif " Add all the plugins to the path -if filereadable(expand(s:vimdir . "/autoload/pathogen.vim")) +if filereadable(s:vimdir . "/autoload/pathogen.vim") execute pathogen#infect() endif @@ -48,25 +48,16 @@ set scrolloff=5 " Scroll at 5 rows from top/bot of screen filetype plugin indent on " Enable filetype specific plugins/indent " Persistent undo -if(has('persistent_undo') && !empty(finddir(s:vimdir . '/undo', '~'))) - if has('win64') || has('win32') - set undodir=~/vimfiles/undo/ - else - set undodir=~/.vim/undo/ " Directory for undo files - endif +if has('persistent_undo') && isdirectory(s:vimdir . '/undo') + exe 'set undodir='.s:vimdir.'/undo/' set undofile " Do indeed create said files set undolevels=1000 " Max # changes that can be undone set undoreload=10000 " Saves undofile on reload (:e) if < 10k LOC endif " Use ~/.vim/swp if avail (else .) for backup and swp files respectively -if has('win64') || has('win32') - set backupdir=~/vimfiles/swp,. - set directory=~/vimfiles/swp,. -else - set backupdir=~/.vim/swp,. - set directory=~/.vim/swp,. -endif +exe 'set backupdir='.s:vimdir.'/swp,.' +exe 'set directory='.s:vimdir.'/swp,.' " }}} " PLUGIN RELATED SETTINGS {{{ @@ -75,9 +66,6 @@ let g:vimtex_view_method='skim' " Don't use powerline font in airline (not neces. installed) let g:airline_powerline_fonts = 0 - -" Don't open instant markown on opening a md doc -let g:instant_markdown_autostart = 0 " }}} " THEME AND APPEARANCE {{{ @@ -91,49 +79,37 @@ set noequalalways " Don't resize split on open/close event " Whitespace chars to display with :set list set listchars=space:·,tab:>–,trail:~,eol:¬ -if(has('gui_running')) - " Show no sidebars, etc - set guioptions= -endif - " COLORSCHEME " if can use truecolor, do -if (has("termguicolors") || has('gui_running')) - " load colorscheme if plugins installed - if filereadable(expand(s:vimdir . "/bundle/gruvbox/colors/gruvbox.vim")) || filereadable(expand(s:vimdir . "/colors/gruvbox.vim")) - let g:gruvbox_italic = 1 - set termguicolors - colorscheme gruvbox - " make pythonSelf red not grey - highlight link pythonSelf GruvboxBlue - endif +if (has("termguicolors") || has('gui_running')) && + \ filereadable(s:vimdir . "/bundle/gruvbox/colors/gruvbox.vim") + let g:gruvbox_italic = 1 + set termguicolors + colorscheme gruvbox - " Needed for termgui in tmux--&term begins w screen-... + " See :h xterm-true-color for tmux+termguicolors if &term =~# '^tmux' - " Set the terminal foreground+background colors - " See :h xterm-true-color let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" endif +else + colorscheme elflord endif set background=dark " seems to need to be after gruvbox -" Allow cursor to change shape -" https://stackoverflow.com/questions/6488683/ -" how-do-i-change-the-vim-cursor-in-insert-normal-mode/42118416#42118416 +" Allow cursor to change shape: https://stackoverflow.com/questions/6488683 let &t_SI = "\e[6 q" let &t_EI = "\e[2 q" " auto commands (grouped so that re-sourcing vimrc doesn't cause duplicates!) -if(has('autocmd')) +if has('autocmd') augroup MyCustomAucmds " removes all autocmds from this group (needed when re-sourcing) autocmd! " Set cursor line when in insert mode (to indicate insert mode) autocmd InsertEnter,InsertLeave * set cul! - autocmd BufNewFile,BufRead *.notes set filetype=markdown augroup END " goes back to default augroup endif " }}} @@ -172,7 +148,7 @@ nnoremap <C-k> <C-w>k nnoremap <C-h> <C-w>h nnoremap <C-l> <C-w>l -if(has('terminal')) +if has('terminal') || has('nvim') tnoremap <ESC> <C-\><C-n> tnoremap <M-[> <ESC> endif @@ -182,7 +158,6 @@ nnoremap <C-p> :set paste!<CR> " Elim Whitespace (through regexp) nnoremap <leader><space> :call CMDPreserve("%s/\\s\\+$//e")<CR> - " save session " nnoremap <leader>s :mksession!<CR> @@ -196,7 +171,7 @@ nnoremap <leader>L :set background=light<CR> nnoremap <leader>D :set background=dark<CR> " toggle color column (to ensure short lines) -nnoremap <leader>C :call ToggleColorColumn()<CR> +nnoremap <expr> <leader>C ToggleColorColumn() " easier tab switching (good for use w terminal wher gt doesn't work) nnoremap <C-w>t :tabnext<CR>