diff --git a/apps/git/config b/apps/git/config index e9551d9..fbbc7b9 100644 --- a/apps/git/config +++ b/apps/git/config @@ -7,7 +7,7 @@ [core] editor = nvim - pager = nvim -c 'silent %sm/\\e.\\{-}m//g' -c 'silent %s/^diff/\\r\\rdiff/' -c 'silent set ft=diff' -c 'silent setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile' -c 'goto 1' - + pager = less -r [http "https://gopkg.in"] followRedirects = true @@ -33,3 +33,7 @@ [push] default = current + +[pager] + branch = false + diff = nvim -c 'silent %sm/\\e.\\{-}m//g' -c 'silent %s/^diff/\\r\\rdiff/' -c 'silent set ft=diff' -c 'silent setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile' -c 'goto 1' - diff --git a/apps/neovim/bindings.vim b/apps/neovim/bindings.vim index 79f40ba..c2f02ff 100644 --- a/apps/neovim/bindings.vim +++ b/apps/neovim/bindings.vim @@ -21,10 +21,10 @@ if has('nvim') tnoremap :q! " moving between terminal splits - " tnoremap h - " tnoremap j - " tnoremap k - " tnoremap l + tnoremap :TmuxNavigateLeft + tnoremap :TmuxNavigateDown + tnoremap :TmuxNavigateUp + tnoremap :TmuxNavigateRight endif " enter insert mode when entering a terminal buffer @@ -51,25 +51,28 @@ function! NextIndent(exclusive, fwd, lowerlevel, skipblanks) let stepvalue = a:fwd ? 1 : -1 while (line > 0 && line <= lastline) let line = line + stepvalue - if ( ! a:lowerlevel && indent(line) == indent || - \ a:lowerlevel && indent(line) < indent) + if ( a:lowerlevel == 0 && indent(line) == indent || + \ a:lowerlevel == 1 && indent(line) < indent || + \ a:lowerlevel == -1 && indent(line) > indent) if (! a:skipblanks || strlen(getline(line)) > 0) if (a:exclusive) let line = line - stepvalue endif exe line - exe 'normal ' column . '|' + exe 'normal ' (column+1) . '|' return endif endif endwhile endfunction -" Moving back and forth between lines of same or lower indentation. +" moving back and forth between lines of same or lower indentation should be sane nnoremap [l :call NextIndent(0, 0, 0, 1) nnoremap ]l :call NextIndent(0, 1, 0, 1) nnoremap [L :call NextIndent(0, 0, 1, 1) nnoremap ]L :call NextIndent(0, 1, 1, 1) +nnoremap [ :call NextIndent(0, 0, -1, 1) +nnoremap ] :call NextIndent(0, 1, -1, 1) vnoremap [l :call NextIndent(0, 0, 0, 1)m'gv'' vnoremap ]l :call NextIndent(0, 1, 0, 1)m'gv'' vnoremap [L :call NextIndent(0, 0, 1, 1)m'gv'' @@ -82,27 +85,15 @@ onoremap ]L :call NextIndent(1, 1, 1, 1) " run make with leader,m nnoremap m :call RunMake() -" show project viewer with leader,n -nnoremap n :call OpenProjectViewer() - -" change buffers with leader,tab -nnoremap :bnext -nnoremap :bprevious +" show project viewer with leader,n or C-n +nnoremap :call NERDProjectViewer() +nnoremap n :call NERDProjectViewer() " don't kill vim +" REBIND nnoremap K nnoremap -" nerdtree -nnoremap :NERDTree - -" run macro across visually selected lines -xnoremap @ :call ExecuteMacroOverVisualRange() -function! ExecuteMacroOverVisualRange() - echo '@'.getcmdline() - execute ":'<,'>normal @".nr2char(getchar()) -endfunction - " quick paragraph formatting vmap Q gq nmap Q gqap @@ -131,14 +122,14 @@ nnoremap j :bprevious nnoremap :bnext nnoremap :bprevious +" change buffers with leader,tab +nnoremap :bnext +nnoremap :bprevious + " fast word change nnoremap c ciw nnoremap C ciW -" bash-like deletion -inoremap -inoremap - " clear search higlight nnoremap / :let @/ = "": @@ -158,7 +149,7 @@ nnoremap k gk vnoremap j gj vnoremap k gk -" camel case movements +" camel case motions map ,w CamelCaseMotion_w map ,b CamelCaseMotion_b map ,e CamelCaseMotion_e @@ -170,14 +161,6 @@ xmap ib CamelCaseMotion_ib omap ie CamelCaseMotion_ie xmap ie CamelCaseMotion_ie -" a _ objects -" omap aw CamelCaseMotion_aw -" xmap aw CamelCaseMotion_aw -omap ab CamelCaseMotion_ab -xmap ab CamelCaseMotion_ab -omap ae CamelCaseMotion_ae -xmap ae CamelCaseMotion_ae - " remove trailing whitespace map mw:%s/\s\+$//:let @/ = ""'w @@ -185,20 +168,17 @@ map mw:%s/\s\+$//:let @/ = ""'w nnoremap w :bd " toggle spell checking: -map :setlocal spell! +map :setlocal spell! " open urls, files, etc. example: http://google.com: noremap o :!xdg-open -" run `make run` -nnoremap R :ProjectRootExe !make run - " insert newline -" doesn't work in terminals? +" NOTE: doesn't work in terminals? " noremap i " noremap i -" keep that dumb window from popping up (wild something or another) +" prevent wildmenu map q: :q noremap qqq: q: @@ -214,7 +194,8 @@ cnoremap xnoremap < >gv -nmap ga -xmap ga - +" distraction-free mode nnoremap df :DistractionFreeMode + +" recalc syntax highlighting +nnoremap gs :syntax sync fromstart diff --git a/apps/neovim/commands.vim b/apps/neovim/commands.vim index ff3921c..4804b61 100644 --- a/apps/neovim/commands.vim +++ b/apps/neovim/commands.vim @@ -12,19 +12,13 @@ hi LeadingWhiteSpaces ctermfg=black ctermbg=black :command! ShowSpaceIndents call ShowSpaceIndentation() :command! HideSpaceIndents call HideSpaceIndentation() -" allows for manual and syntax folding... supposedly -augroup vimrc - au BufReadPre * setlocal foldmethod=indent - au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif -augroup END - " jump to last opened position in file except in git commits let jump_to_pos_blacklist = ['gitcommit'] if has("autocmd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") && index(jump_to_pos_blacklist, &ft) | exe "normal! g'\"" | endif endif -" terminal split in neovim +" terminal split in neovim even tho we tmux if has('nvim') function! TerminalSplit() let current_file = @% @@ -40,7 +34,7 @@ if has('nvim') endfunction endif -" Make any necessary directories in the path when saving a file +" make any necessary directories in the path when saving a file fun! AutoMakeDirectory() let s:directory = expand(":p:h") if !isdirectory(s:directory) @@ -49,6 +43,7 @@ fun! AutoMakeDirectory() endfun autocmd BufWritePre,FileWritePre * :call AutoMakeDirectory() +" run make from vim smartly if !exists("g:make_args") let g:make_args="default" endif @@ -68,7 +63,7 @@ endfun " kill the terminal buffer when the process exits autocmd TermClose * call feedkeys('') -fun! OpenProjectViewer() +fun! NERDProjectViewer() let path = system("git rev-parse --show-toplevel | tr -d '\\n'") execute 'NERDTree' path endfun diff --git a/apps/neovim/ftplugin/elixir.vim b/apps/neovim/ftplugin/elixir.vim index 9cd4c09..0f8779b 100644 --- a/apps/neovim/ftplugin/elixir.vim +++ b/apps/neovim/ftplugin/elixir.vim @@ -1,3 +1,2 @@ let b:ale_fixers = ['mix_format'] let g:ale_elixir_elixir_ls_release = '/home/daniel/code/open-source/elixir-ls/release' - diff --git a/apps/neovim/ftplugin/markdown.vim b/apps/neovim/ftplugin/markdown.vim index d5d6b13..83c33f9 100644 --- a/apps/neovim/ftplugin/markdown.vim +++ b/apps/neovim/ftplugin/markdown.vim @@ -1 +1,2 @@ let g:neomake_markdown_enabled_makers = [] +autocmd BufNewFile,BufReadPost *.md setl filetype=markdown spell diff --git a/apps/neovim/ftplugin/vue.vim b/apps/neovim/ftplugin/vue.vim index e5b04bb..12441b4 100644 --- a/apps/neovim/ftplugin/vue.vim +++ b/apps/neovim/ftplugin/vue.vim @@ -1 +1,2 @@ let b:ale_fixers = ['prettier', 'eslint'] +autocmd FileType vue syntax sync fromstart diff --git a/apps/neovim/plugin-manager.vim b/apps/neovim/plugin-manager.vim deleted file mode 100644 index e69de29..0000000 diff --git a/apps/neovim/plugins.vim b/apps/neovim/plugins.vim index 5583845..36f00b4 100644 --- a/apps/neovim/plugins.vim +++ b/apps/neovim/plugins.vim @@ -24,34 +24,34 @@ else let g:prosession_dir = '~/.config/nvim/session/' endif -Plug 'junegunn/vim-plug' " plugin manager should manage itself -Plug 'vim-airline/vim-airline' " status line -Plug 'vim-airline/vim-airline-themes' " more minimal status line -Plug 'nathanaelkane/vim-indent-guides' " indentation guides -Plug 'w0rp/ale' " syntax checker -Plug 'SirVer/ultisnips' +Plug 'junegunn/vim-plug' " plugin manager should manage itself +Plug 'vim-airline/vim-airline' " status line +Plug 'vim-airline/vim-airline-themes' " more minimal status line +Plug 'nathanaelkane/vim-indent-guides' " indentation guides +Plug 'w0rp/ale' " syntax checker +Plug 'SirVer/ultisnips' " snippet manager Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} " fuzzy file finding -Plug 'junegunn/fzf.vim' " helpers for using fzf in vim -Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements -Plug 'vim-scripts/LargeFile' " gracefully handle very large files -Plug 'tpope/vim-commentary' " toggle comments in code easily -Plug 'tpope/vim-repeat' " better vim repeating for plugin-provided actions -Plug 'vim-scripts/SyntaxRange' " defined different syntax ranges in a file for highlighting -Plug 'tmux-plugins/vim-tmux-focus-events' " allow transitions within tmux -Plug 'christoomey/vim-tmux-navigator' " allow transitions within tmux -Plug 'godlygeek/tabular' " align text -Plug 'lytedev/vim-superman' " view man pages with vim -Plug 'tpope/vim-surround' " quickly modify text surrounding objects -Plug 'tpope/vim-speeddating' " vim knows about date-like text objects -Plug 'tpope/vim-fugitive' " vim git commands -Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object -Plug 'wellle/targets.vim' " adds some more handy text objects -Plug 'dbakker/vim-projectroot' " adds helper functions for getting to a project's root directory -Plug 'junegunn/goyo.vim' " better distraction-free editing -Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings -Plug 'sheerun/vim-polyglot' " vim plugin loader for many languages -Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']} -Plug 'OmniSharp/omnisharp-vim', {'for': ['cs']} -Plug 'junegunn/vim-peekaboo' -Plug 'scrooloose/nerdtree' -Plug 'tpope/vim-eunuch' +Plug 'junegunn/fzf.vim' " helpers for using fzf in vim +Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements +Plug 'vim-scripts/LargeFile' " gracefully handle very large files +Plug 'tpope/vim-commentary' " toggle comments in code easily +Plug 'tpope/vim-repeat' " better vim repeating for plugin-provided actions +Plug 'vim-scripts/SyntaxRange' " defined different syntax ranges in a file for highlighting +Plug 'tmux-plugins/vim-tmux-focus-events' " allow transitions within tmux +Plug 'christoomey/vim-tmux-navigator' " allow transitions within tmux +Plug 'godlygeek/tabular' " align text +Plug 'lytedev/vim-superman' " view man pages with vim +Plug 'tpope/vim-surround' " quickly modify text surrounding objects +Plug 'tpope/vim-speeddating' " vim knows about date-like text objects +Plug 'tpope/vim-fugitive' " vim git commands +Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object +Plug 'wellle/targets.vim' " adds some more handy text objects +Plug 'dbakker/vim-projectroot' " adds helper functions for getting to a project's root directory +Plug 'junegunn/goyo.vim' " better distraction-free editing +Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings +Plug 'sheerun/vim-polyglot' " vim plugin loader for many languages +Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']} " moonscript language +Plug 'OmniSharp/omnisharp-vim', {'for': ['cs']} " C# language +Plug 'junegunn/vim-peekaboo' " preview registers +Plug 'scrooloose/nerdtree' " file browser +Plug 'tpope/vim-eunuch' " unix helper commands diff --git a/apps/neovim/settings.vim b/apps/neovim/settings.vim index 0099429..6a1e184 100644 --- a/apps/neovim/settings.vim +++ b/apps/neovim/settings.vim @@ -5,6 +5,8 @@ let g:airline#extensions#tabline#enabled = 1 " automatically displays all buffer let g:airline#extensions#tabline#fnamemod = ':t' " set laststatus=2 " always show statusline " set noshowmode " hides default mode + +" cleanup/simplify airline let g:airline#extensions#tabline#left_sep = '' let g:airline#extensions#tabline#left_alt_sep = '' let g:airline_right_alt_sep = '' @@ -13,11 +15,14 @@ let g:airline_left_alt_sep= '' let g:airline_left_sep = '' let g:airline#extensions#tabline#buffers_label = '' +" short mode texts let g:airline_mode_map = { \ '__' : '-', \ 'n' : 'N', \ 'i' : 'I', \ 'R' : 'R', + \ 'T' : 'T', + \ 't' : 'T', \ 'c' : 'C', \ 'v' : 'V', \ 'V' : 'V', @@ -30,8 +35,7 @@ let g:airline_mode_map = { let g:indent_guide_auto_colors = 1 let g:indent_guides_enable_on_vim_startup = 1 -let g:ale_elixir_elixir_ls_release = '/home/daniel/code/open-source/elixir-ls/release' - +" no ALE gutter let g:ale_sign_column_always = 0 let g:ale_set_signs = 0 highlight clear ALEErrorSign @@ -39,11 +43,14 @@ highlight clear ALEWarningSign let g:fzf_layout = { 'window': 'enew' } -set completeopt=noinsert,menuone,noselect,longest,preview +" ALE completeopt recommendation +set completeopt=menu,menuone,preview,noselect,noinsert +" set completeopt=noinsert,menuone,noselect,longest,preview " fix neovim cursor let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 1 +" fix me, baby let g:ale_fix_on_save = 1 " line number defaults @@ -59,7 +66,7 @@ set norelativenumber " set norelativenumber " line numbers " endif -" use tabs at a two-space width +" use tabs at a two-space width like God intended set tabstop=2 set shiftwidth=2 set softtabstop=2 @@ -84,41 +91,44 @@ set formatoptions=crql1j " :h fo-table " handle window title set title -" don't do syntax highlighting on lines longer than 2048 characters -set synmaxcol=2048 +" limit syntax highlighting line length +set synmaxcol=500 " don't highlight the current line set nocursorline -" set cursorcolumn " highlight the current column -" let &colorcolumn=join(range(81,400),",") " colors columns past 80 +" don't highlight the current column +" set nocursorcolumn + +" OBSOLETE: colors columns past 80 +" let &colorcolumn=join(range(81,400),",") " highlight the 81st character in a line where it exists highlight ColorColumn ctermbg=magenta ctermfg=7 call matchadd('ColorColumn', '\%81v', 100) -set noshowcmd -set nowildmenu -set wildmode=longest,list,full -set cpoptions-=$ -set showmatch -set mouse=a -set mousehide -set backspace=indent,eol,start -set noruler -set lazyredraw -set scrolloff=8 -set sidescrolloff=8 -set splitright -set splitbelow -set noerrorbells -set visualbell -set nobackup -set nowritebackup -set noswapfile -set timeout -set ttimeoutlen=200 -set isfname+=32 +" set noshowcmd +" set nowildmenu +" set wildmode=longest,list,full +set cpoptions-=$ " make buffer options more global +set noshowmatch " don't briefly highlight matching brackets +set mouse=a " enable mouse use +set mousehide " hide mouse when typing +set backspace=indent,eol,start " sane backspace +set noruler " hide the ruler - we have airline +set lazyredraw " don't draw during macros and other such things +set scrolloff=8 " keep lines above and below cursor (padding) +set sidescrolloff=15 " same but for columns +set splitright " don't split left +set splitbelow " don't split top +set noerrorbells " shhhh, vim +set visualbell " but visual noise for alerts is ok +set nobackup " sessions handle this quite nicely +set nowritebackup " no but really they do +set noswapfile " no seriously sessions are cool +set timeout " key combo mapping timeout +set ttimeoutlen=200 " ms for key combo mapping timeout +set isfname+=32 " allow filenames to show them 32s " no freakin' bell set visualbell t_vb= @@ -144,7 +154,7 @@ highlight GitGutterChangeDelete ctermbg=black guibg=black hi NonText ctermfg=black guifg=black set hidden " allows buffer switching without saving -set shortmess=Ia +set shortmess=Ia " hide vim intro, skip lots of file messages/prompts set history=1000 " undo files @@ -153,40 +163,36 @@ set undodir=$vimdir/undo set undolevels=1000 set undoreload=10000 -" backup files -set backupdir=$vimdir/backup -set directory=$vimdir/backup - " spell file set spellfile=$vimdir/spell/en.utf-8.add -" smart case insensitivity by default +" more sane search settings set ignorecase set smartcase set incsearch -set hlsearch set wrapscan +" highlight search matches +set hlsearch + +" enable syntax folding set foldmethod=syntax set foldlevel=99 set foldnestmax=10 set foldlevelstart=0 -set autowrite -set autochdir -set autoread -set nomodeline -set noshowmode -set noshowcmd +set noautowrite " let me do the writing +set autochdir " `:e` all day +set autoread " this is fine with `u` +set nomodeline " airline wins +set noshowmode " airline is really good +set noshowcmd " be clean -set laststatus=0 +set laststatus=0 " be clean -" yank to OS clipboard +" yank to OS clipboard by default set clipboard+=unnamedplus -set nofoldenable -setlocal nofoldenable - " no empty buffer on startup augroup DisableEmptyBuffer autocmd VimEnter * nested if bufname('')=='' && line('$') == 1 && col('$')==1 && !&modified | bd % | endif diff --git a/de/x/resources b/de/x/resources index 6f91fcd..61c0d21 100755 --- a/de/x/resources +++ b/de/x/resources @@ -30,7 +30,7 @@ URxvt*utf8: 1 URxvt*scaleHeight: 1 URxvt*depth: 32 URxvt*internalBorder: 24 -URxvt*perl-ext-common: default,matcher,resize-font,config-reload +URxvt*perl-ext-common: default,matcher,resize-font URxvt*keysym.M-Escape: perl:keyboard-select:activate URxvt*resize-font.smaller: C-Down URxvt*resize-font.bigger: C-Up diff --git a/shell/bash/aliases b/shell/bash/aliases index d978cbf..8b56b17 100644 --- a/shell/bash/aliases +++ b/shell/bash/aliases @@ -55,6 +55,8 @@ alias tcom="tmux attach -t comms || tmux new -s comms" # TODO: make these git aliases in the gitconfig? alias g="git" alias gs="git status" +alias gd="git diff" +alias gdv="git dv" alias gpl="git pull" alias gp="git push" alias gpa="git push --all && git push --tags"