dotfiles

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

commit a1468f779ece74e01e4d501ed238904d95d23022 (patch)
parent 1fa98f1b00a7a7d5483964087e207152226f3539
Author: Alexander Karle <akarle@umass.edu>
Date:   Mon,  1 Oct 2018 00:16:01 -0400

Promoting vim/ to https://github.com/akarle/dotvim

Diffstat:
MREADME.md | 37++++---------------------------------
Minstall.sh | 35++++++++++++++---------------------
Mneovim/init.vim | 2+-
Dvim/ftplugin/c.vim | 4----
Dvim/ftplugin/html.vim | 3---
Dvim/ftplugin/javascript.vim | 3---
Dvim/ftplugin/markdown.vim | 11-----------
Dvim/ftplugin/python.vim | 10----------
Dvim/ftplugin/tex.vim | 14--------------
Dvim/ftplugin/vim.vim | 21---------------------
Dvim/gvimrc | 12------------
Dvim/swp/.gitkeep | 0
Dvim/syntax/python.vim | 3---
Dvim/undo/.gitkeep | 0
Dvim/vimrc | 200-------------------------------------------------------------------------------
15 files changed, 19 insertions(+), 336 deletions(-)

diff --git a/README.md b/README.md @@ -1,10 +1,11 @@ # dotfiles + My dotfiles. -## Basic Setup -My vimrc is tailored for Vim 8 and Neovim. I recently migrated to [pathogen](https://github.com/tpope/vim-pathogen) for my plugin manager because I am trying to learn some Vimscript and its the simplest and most intuitive out there! +I found that most of my customization was going to Vim, so I promoted it to its +own repo, [dotvim](https://github.com/akarle/dotvim). -The plugins I am currently rocking are listed below. +Note that the install will still download it! ## Install @@ -13,33 +14,3 @@ Note that bash is required for this install (as some of the interactive options ``` bash -c "$(curl -fsSL https://raw.githubusercontent.com/akarle/dotfiles/master/install.sh)" ``` - -## Vim Plugins - -**Extra syntax files** -* [octol/vim-cpp-enhanced-highlight](https://github.com/octol/vim-cpp-enhanced-highlight) -* [pangloss/vim-javascript](https://github.com/pangloss/vim-javascript) -* [posva/vim-vue](https://github.com/posva/vim-vue) -* [cespare/vim-toml](https://github.com/cespare/vim-toml) -* [cakebaker/scss-syntax.vim](https://github.com/cakebaker/scss-syntax.vim) - -**Theme/Appearance** -* [scrooloose/nerdtree](https://github.com/scrooloose/nerdtree) -* [morhetz/gruvbox](https://github.com/morhetz/gruvbox) -* [vim-airline/vim-airline](https://github.com/vim-airline/vim-airline) -* [vim-airline/vim-airline-themes](https://github.com/vim-airline/vim-airline-themes) - -**Git** -* [tpope/vim-fugitive](https://github.com/tpope/vim-fugitive) -* [airblade/vim-gitgutter](https://github.com/airblade/vim-gitgutter) - -**Other Tools** -* [scrooloose/nerdcommenter](https://github.com/scrooloose/nerdcommenter) -* [irrationalistic/vim-tasks](https://github.com/irrationalistic/vim-tasks) -* [lervag/vimtex](https://github.com/lervag/vimtex) -* [junegunn/fzf](https://github.com/junegunn/fzf) -* [tpope/vim-surround](https://github.com/tpope/vim-surround) -* [suan/vim-instant-markdown](https://github.com/suan/vim-instant-markdown) - -**Async Linting!** -* [w0rp/ale](https://github.com/w0rp/ale) diff --git a/install.sh b/install.sh @@ -12,8 +12,7 @@ fi # Establish Globals HOMEDOTS=$HOME/.akarledots -VIMHOME=$HOME/.vim -DOTSVIM=$HOMEDOTS/vim +DOTVIM=$HOME/.vim # Define colors (for printouts) if tput setaf 1 &> /dev/null; then tput sgr0 @@ -52,13 +51,6 @@ error_msg() { echo "${RED}$1${RESET}" } -try_mkdir() { - if [ ! -d $1 ]; then - success_msg "Making directory $1" - mkdir $1 - fi -} - try_ln() { # if it doesn't exist, just create it -- works for broken symlinks too! if [ ! -f $2 ]; then @@ -124,39 +116,40 @@ if [ -d $HOMEDOTS ]; then fi # Next, clone a fresh one -try_mkdir $HOMEDOTS git clone https://github.com/akarle/dotfiles.git $HOMEDOTS success_msg "Clone successful! Putting you on your own branch '$(whoami)' so you can make changes!" (cd $HOMEDOTS && exec git checkout -b $(whoami)) # $HOME level ln's -try_ln $DOTSVIM/vimrc $HOME/.vimrc try_ln $HOMEDOTS/tmux.conf $HOME/.tmux.conf try_ln $HOMEDOTS/zsh/zshrc $HOME/.zshrc try_ln $HOMEDOTS/inputrc $HOME/.inputrc +# Now for Vim +if [ -d $DOTVIM ]; then + BACKUP="${DOTVIM}_backup_$(date +%s)" + mv $DOTVIM $BACKUP + warn_msg "Backing up old $DOTVIM to $BACKUP" +fi + +git clone https://github.com/akarle/dotvim.git $DOTVIM +success_msg "Successfully cloned dotvim to $DOTVIM. Woot!" + for file in $HOMEDOTS/bash/*; do [ -e "$file" ] || continue try_ln $file $HOME/.$(basename $file) done unset file -# Symlink HOMEDOTS/vim -> ~/.vim -try_ln $HOMEDOTS/vim $VIMHOME - -# Make the swp and undo folders in ~/.vim -try_mkdir $VIMHOME/undo -try_mkdir $VIMHOME/swp - printf "\n\n" # Optional installs via curl: if [ -x "$(command -v curl)" ]; then # vim-plug install_via_curl \ - "vim-plug" \ - "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" \ - "$HOME/.vim/autoload/plug.vim" + "vim-pathogen" \ + "https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim" \ + "$HOME/.vim/autoload/pathogen.vim" # git bash/zsh completion install_via_curl \ diff --git a/neovim/init.vim b/neovim/init.vim @@ -5,7 +5,7 @@ " First, just source the regular Vim stuff set runtimepath+=~/.vim,~/.vim/after set packpath+=~/.vim -source ~/.vimrc +source ~/.vim/vimrc " no numbers in terminal autocmd TermOpen * setlocal nonumber diff --git a/vim/ftplugin/c.vim b/vim/ftplugin/c.vim @@ -1,4 +0,0 @@ -" for neovim development! -if exists( "g:loaded_youcompleteme" ) - nnoremap <buffer> <c-]> :YcmCompleter GoTo<CR> -endif diff --git a/vim/ftplugin/html.vim b/vim/ftplugin/html.vim @@ -1,3 +0,0 @@ -" 2 spaces -setlocal softtabstop=2 -setlocal shiftwidth=2 diff --git a/vim/ftplugin/javascript.vim b/vim/ftplugin/javascript.vim @@ -1,3 +0,0 @@ -" 2 space -setlocal softtabstop=2 -setlocal shiftwidth=2 diff --git a/vim/ftplugin/markdown.vim b/vim/ftplugin/markdown.vim @@ -1,11 +0,0 @@ -" wrap at word breaks -setlocal linebreak - -" have broken lines indent! -setlocal breakindent - -" spell check -setlocal spell spelllang=en_us - -" Break at 80 -setlocal textwidth=80 diff --git a/vim/ftplugin/python.vim b/vim/ftplugin/python.vim @@ -1,10 +0,0 @@ -" set fold method to be indent based -" USAGE: -" KEY: no longer use zf#j or zf/<str> to create folds -" instead: -" zc -- close a fold by indent (at cursor until end indent) -" zo -- open a closed fold -setlocal foldmethod=indent - -" Set the local :make command to run flake8 -setlocal makeprg=flake8\ % diff --git a/vim/ftplugin/tex.vim b/vim/ftplugin/tex.vim @@ -1,14 +0,0 @@ -" ignore the wrapped lines -noremap <buffer> <silent> k gk -noremap <buffer> <silent> j gj - -" spell check! -setlocal spell spelllang=en_us - -" soft word wrap should not break words -" NOTE: don't use listchars with this feature -setlocal linebreak -setlocal breakindent - -" Break at 80 -setlocal textwidth=80 diff --git a/vim/ftplugin/vim.vim b/vim/ftplugin/vim.vim @@ -1,21 +0,0 @@ -" Custom folding by expression to fold markers and functions - -let b:viml_fold_markers = split(&foldmarker, ',') - -function! VimLFoldByFunctionAndMarker(lnum) abort - let l = getline(a:lnum) - if l =~ '^function' - return 'a1' - elseif l =~ '^endfunction' - return 's1' - elseif l =~ b:viml_fold_markers[0] - return 'a1' - elseif l =~ b:viml_fold_markers[1] - return 's1' - else - return '=' - endif -endfunction - -setlocal foldmethod=expr -setlocal foldexpr=VimLFoldByFunctionAndMarker(v:lnum) diff --git a/vim/gvimrc b/vim/gvimrc @@ -1,12 +0,0 @@ -" Disable visual bells -set noerrorbells visualbell t_vb= -autocmd GUIEnter * set visualbell t_vb= - -" Pretty printing -set printoptions=left:1in,right:1in,paper:letter -set printfont=Consolas:h11 - -" Minimal UI -set guioptions= " Don't show guioptions (toolbar, scrollbar,..) -set guifont=Consolas:h11 " Font that doesn't hurt my eyes -set guicursor=a:blinkon0 " Don't blink the cursor (not my thang) diff --git a/vim/swp/.gitkeep b/vim/swp/.gitkeep diff --git a/vim/syntax/python.vim b/vim/syntax/python.vim @@ -1,3 +0,0 @@ -" Highlight the self keyword -syn keyword pythonSelf self -highlight link pythonSelf GruvboxBlue diff --git a/vim/undo/.gitkeep b/vim/undo/.gitkeep diff --git a/vim/vimrc b/vim/vimrc @@ -1,200 +0,0 @@ -" .vimrc by Alex Karle -" Hosted at https://github.com/akarle/dotfiles -" -" Inspired by tips all over the interwebs - -" GENERAL EDITOR SETTINGS {{{ -" Try to be platform agnostic: -if has('win64') || has('win32') - let s:vimdir = expand($HOME . '/vimfiles') -else - let s:vimdir = expand($HOME . '/.vim') -endif - -" Add all the plugins to the path -if filereadable(s:vimdir . "/autoload/pathogen.vim") - execute pathogen#infect() -endif - -" Space related -set softtabstop=4 " <TAB> is 4 spaces (when expandtab set) -set shiftwidth=4 " >> will indent 4 spaces -set expandtab " Needed to replace <TAB> with spaces -set autoindent " Indent carries over on new line -set smarttab " Use shiftwidth for <TAB> and <BS> - -" Search related -set hlsearch " Highlight searches -set incsearch " Incrementally search - -" Faster grepping! (use ripgrep if available for :grep and :FZF) -if executable('rg') - set grepprg=rg\ --vimgrep\ --no-heading - set grepformat=%f:%l:%c:%m,%f:%l:%m - let $FZF_DEFAULT_COMMAND = 'rg --files --hidden --glob "!.git/*"' -endif - -" Key related behavior -set backspace=indent,eol,start " Backspace should function as expected -set foldopen-=block " {}, (), [] commands don't open folds -set ttimeout " Tell how to interpret key codes (used below) -set ttimeoutlen=30 " Low keycode timeout to avoid <ESC> delay - -" Other -set modelines=0 " Disable modelines for security -set encoding=utf-8 " Encoding -set history=1000 " Remember last 1000 :commands -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') && 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 -exe 'set backupdir='.s:vimdir.'/swp,.' -exe 'set directory='.s:vimdir.'/swp,.' -" }}} - -" PLUGIN RELATED SETTINGS {{{ -" Set pdf viewer to skim for vimtex -let g:vimtex_view_method='skim' - -" Don't use powerline font in airline (not neces. installed) -let g:airline_powerline_fonts = 0 -" }}} - -" THEME AND APPEARANCE {{{ -syntax on " Syntax highlighting on -set number " Line numbers on -set wildmenu " Visual completion for command mode -set showcmd " Show the command being typed -set laststatus=2 " Always show the statusbar -set noequalalways " Don't resize split on open/close event - -" Whitespace chars to display with :set list -set listchars=space:·,tab:>–,trail:~,eol:¬ - -" COLORSCHEME -" if can use truecolor, do -if (has("termguicolors") || has('gui_running')) && - \ filereadable(s:vimdir . "/bundle/gruvbox/colors/gruvbox.vim") - let g:gruvbox_italic = 1 - set termguicolors - colorscheme gruvbox - - " See :h xterm-true-color for tmux+termguicolors - if &term =~# '^tmux' - 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 -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') - 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! - augroup END " goes back to default augroup -endif -" }}} - -" FUNCTIONS {{{ -" A function to execute a command and return to the old position -" CREDIT: http://vimcasts.org/episodes/tidying-whitespace/ -function! CMDPreserve(command) abort - " Preparation: save last search, and cursor position. - let _s=@/ - let l = line(".") - let c = col(".") - " Do the business: - execute a:command - " Clean up: restore previous search history, and cursor position - let @/=_s - call cursor(l, c) -endfunction - -function! ToggleColorColumn() abort - if &colorcolumn == "" - set colorcolumn=80 - else - set colorcolumn="" - endif -endfunction -" }}} - -" KEY MAPPINGS {{{ -" set leader to be spacebar -let mapleader = " " - -"Map ctrl-i/j/k/h to switch between splits -nnoremap <C-j> <C-w>j -nnoremap <C-k> <C-w>k -nnoremap <C-h> <C-w>h -nnoremap <C-l> <C-w>l - -if has('terminal') || has('nvim') - tnoremap <ESC> <C-\><C-n> - tnoremap <M-[> <ESC> -endif - -"Map ctrl-p to toggle paste mode -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> - -" edit in current buffer dir -nnoremap <leader>e :e %:h/ -nnoremap <leader>v :vsp %:h/ -nnoremap <leader>s :sp %:h/ - -" quick toggle for light/dark background -nnoremap <leader>L :set background=light<CR> -nnoremap <leader>D :set background=dark<CR> - -" toggle color column (to ensure short lines) -nnoremap <expr> <leader>C ToggleColorColumn() - -" easier tab switching (good for use w terminal wher gt doesn't work) -nnoremap <C-w>t :tabnext<CR> - -" call fzf! -nnoremap <leader>f :FZF<CR> - -" 2 space / 4 space toggle -nnoremap <leader>2 :setlocal softtabstop=2 shiftwidth=2<CR> -nnoremap <leader>4 :setlocal softtabstop=4 shiftwidth=4<CR> - -" Faster file navigation -nnoremap <LEFT> :cprev<CR> -nnoremap <RIGHT> :cnext<CR> -nnoremap <UP> :prev<CR> -nnoremap <DOWN> :next<CR> - -" Clear that highlight! -nnoremap <BS> :nohlsearch<CR> - -" Get greppin quick! --> search word under cursor (escape # for VimL autoload) -nnoremap <leader>g :exe "grep " . substitute(expand('<cword>'), '#', '\\#', 'g')<CR> - -" Toggle whitespace -nnoremap <leader>w :set list!<CR> -" }}}