diff options
-rw-r--r-- | bash_aliases | 17 | ||||
-rw-r--r-- | bashrc | 140 | ||||
-rw-r--r-- | gitignore_global | 1 | ||||
-rw-r--r-- | kshrc | 42 | ||||
-rw-r--r-- | newsboat/config | 2 | ||||
-rw-r--r-- | newsboat/urls | 1 | ||||
-rw-r--r-- | profile | 2 | ||||
-rw-r--r-- | qutebrowser/config.py | 2 | ||||
-rw-r--r-- | taskrc | 16 | ||||
-rw-r--r-- | vim/autoload/plug.vim | 25 | ||||
m--------- | vim/plugged/vim-go | 0 | ||||
-rw-r--r-- | vim/vimrc | 503 |
12 files changed, 421 insertions, 330 deletions
diff --git a/bash_aliases b/bash_aliases index a3687da..156e004 100644 --- a/bash_aliases +++ b/bash_aliases @@ -1,4 +1,4 @@ -alias lynx='~/dotfiles/lynx/lynx' +alias lynx='~/debian-dotfiles/lynx/lynx' alias xclip='xclip -selection c' alias '?'=duck alias vimpluginstall="vim +':PlugInstall' +':q!' +':q!'" @@ -6,6 +6,21 @@ alias ipinfo="curl ipinfo.io" alias weather="curl wttr.in" alias vi='vim' alias a='task add' +alias s='task sync' +alias t='task' +alias ttoday='task ml_due_or_scheduled_today' alias du='ncdu --color dark -rr -x --exclude .git' alias free='free -h' alias gloga='git log --oneline --decorate --graph --all' +alias taskallprojects='task rc.list.all.projects=1 projects' +alias taskalltags='task rc.list.all.tags=1 tags' +alias taskcurrentprojects='task projects' +alias gac="git commit -am 'update' && git push origin master" +alias rcal1w="ssh bobbins rem -cc+a1 -w160 -m" +alias rcal2w="ssh bobbins rem -cc+a2 -w160 -m" +alias rcal3w="ssh bobbins rem -cc+a3 -w160 -m" +alias rcal1m="ssh bobbins rem -cca -w160 -m" +alias rcal2m="ssh bobbins rem -cca2 -w160 -m" +alias qrclip="xclip -o -s c | qrencode -o - | feh --force-aliasing -ZF -" +alias rcal1w_small="ssh bobbins rem -cca+1 -w120 -m" +alias rcal2w_small="ssh bobbins rem -cca+2 -w120 -m" @@ -3,11 +3,22 @@ # for examples # If not running interactively, don't do anything -case $- in - *i*) ;; - *) return;; +#case $- in +# *i*) ;; +# *) return;; +#esac + +# Use vi if not vim +case "$(command -v vim)" in + */vim) VIM=vim ;; + *) VIM=vi ;; esac +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" +fi + # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth @@ -17,95 +28,27 @@ shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 -HISTFILESIZE=2000 +HISTFILESIZE=20000 + +# use colorls if it's installed, plain old ls otherwise +if command -v colorls > /dev/null ; then + LS='colorls' +else + LS='ls' +fi # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize -# If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -#shopt -s globstar - -# make less more friendly for non-text input files, see lesspipe(1) -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (used in the prompt below) -if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -# set a fancy prompt (non-color, unless we know we "want" color) -# case "$TERM" in -# xterm-color|*-256color) color_prompt=yes;; -# esac - -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - PS1="\h:\w \u$ " -#if [ "$color_prompt" = yes ]; then -# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -#else -# PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' -#fi -unset color_prompt force_color_prompt - -# If this is an xterm set the title to user@host:dir -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; -*) - ;; -esac - -# enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - alias grep='grep --color=auto' - #alias fgrep='fgrep --color=auto' - #alias egrep='egrep --color=auto' -fi - -# colored GCC warnings and errors -export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' - -# some more ls aliases -alias ll='ls -l' -alias la='ls -A' -alias l='ls -CF' - # Alias definitions. -# You may want to put all your additions into a separate file like -# ~/.bash_aliases, instead of adding them here directly. -# See /usr/share/doc/bash-doc/examples in the bash-doc package. - if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi # enable programmable completion features (you don't need to enable -# this, if it's already enabled in /etc/bash.bashrc and /etc/profile -# sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion @@ -114,10 +57,14 @@ if ! shopt -oq posix; then fi fi +# source funcs and completion +for f in ~/.bash_completion.d/*; do source $f; done +for f in ~/.bash_functions.d/*; do source $f; done + # use GPG to encrypt files secret () { - output=~/"${1}".$(date +%s).enc - gpg --encrypt --armor --output ${output} -r 0xEE63349F8526B820 "${1}" && echo "${1} -> ${output}" + output=~/Downloads/"${1}".$(date +%s).enc + gpg --encrypt --armor --output ${output} -r matt@matthewlemon.com "${1}" && echo "${1} -> ${output}" } reveal () { @@ -125,12 +72,35 @@ reveal () { gpg --decrypt --output ${output} "${1}" && echo "${1} -> ${output}" } +# journal funcs +todj () { + CMD=cat + if [[ $1 = "-vim" ]]; then + CMD=vim + fi + $CMD $(find /home/lemon/Notes/journal -name "*$(date '+%Y-%m-%d')*") +} + +tj () { + if [[ -z $1 ]]; then + echo "Please give me your message in quotes." + fi + echo $1 | _tj +} + +tjclip () { + if [[ -z $1 ]]; then + echo "Please give me your message in quotes." + fi + echo "$1: $(xclip -o -selection clipboard)." | _tj +} + # GPG agent settings (https://github.com/hammerheadlemon/YubiKey-Guide) # See Replace Agents section export GPG_TTY="$(tty)" -export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) -gpgconf --launch gpg-agent +#export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +#gpgconf --launch gpg-agent # FZF export FZF_DEFAULT_COMMAND='ag -g ""' @@ -141,10 +111,6 @@ export FZF_DEFAULT_OPTS='--color info:108,prompt:109,spinner:108,pointer:168,mar #set TERM export TERM="xterm-256color" -#PATH -export PATH=/home/lemon/bin:/home/lemon/.local/bin:$PATH - [ -f ~/.fzf.bash ] && source ~/.fzf.bash EDITOR=/usr/local/bin/vim -#source ~/.bash_completion.d/task.sh diff --git a/gitignore_global b/gitignore_global index 22582b6..7bba777 100644 --- a/gitignore_global +++ b/gitignore_global @@ -54,3 +54,4 @@ docs/_build/ .pdb-pyhist .mypy_cache/ .venv +*.un~ @@ -64,21 +64,39 @@ esac PS1='$_XTERM_TITLE\A $_PS1_COLOR\u@\h$_PS1_CLEAR:$_PS1_BLUE\w$_PS1_COLOR\$$_PS1_CLEAR ' todj () { - cat /home/lemon/Notes/journal/2022-04-17.md + CMD=cat + if [[ $1 = "-vim" ]]; then + CMD=vim + fi + $CMD $(find /home/lemon/Notes/journal -name "*$(date '+%Y-%m-%d')*") +} + +tj () { + if [[ -z $1 ]]; then + echo "Please give me your message in quotes." + fi + echo $1 | _tj +} + +tjclip () { + if [[ -z $1 ]]; then + echo "Please give me your message in quotes." + fi + echo "$1: $(xclip -o -selection clipboard)." | _tj } # FZF -export FZF_DEFAULT_COMMAND='ag -g ""' -export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND -export FZF_ALT_C_COMMAND=$FZF_DEFAULT_COMMAND -export FZF_DEFAULT_OPTS='--color info:108,prompt:109,spinner:108,pointer:168,marker:168' +#export FZF_DEFAULT_COMMAND='ag -g ""' +#export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND +#export FZF_ALT_C_COMMAND=$FZF_DEFAULT_COMMAND +#export FZF_DEFAULT_OPTS='--color info:108,prompt:109,spinner:108,pointer:168,marker:168' #[ -f ~/.fzf.bash ] && source ~/.fzf.bash # from https://dataswamp.org/~solene/2021-10-17-ksh-fzf.html -function fzf-histo { - RES=$(fzf --tac --no-sort -e < $HISTFILE) - test -n "$RES" || exit 0 - eval "$RES" - } - -bind -m ^R=fzf-histo^J +#function fzf-histo { +# RES=$(fzf --tac --no-sort -e < $HISTFILE) +# test -n "$RES" || exit 0 +# eval "$RES" +# } +# +#bind -m ^R=fzf-histo^J diff --git a/newsboat/config b/newsboat/config index e3cb4cc..0492b06 100644 --- a/newsboat/config +++ b/newsboat/config @@ -42,7 +42,7 @@ max-items 20 download-path "~/Downloads" player mpv -browser /home/lemon/dotfiles/lynx/lynx +browser /home/lemon/openbsd-dotfiles/lynx/lynx macro m set browser "mpv %u" ; open-in-browser ; set browser "/home/lemon/dotfiles/lynx/lynx %u" # # press ,y to log the url - you can type a comment to prefix the URL in the log file but it doesn't prompt you... diff --git a/newsboat/urls b/newsboat/urls index f8af09a..6ac2497 100644 --- a/newsboat/urls +++ b/newsboat/urls @@ -1,3 +1,4 @@ +https://undeadly.org/errata/errata.rss https://www.reddit.com/r/rugbyunion/.rss https://gosamples.dev/index.xml https://eli.thegreenplace.net/feeds/all.atom.xml @@ -5,5 +5,3 @@ PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games export PATH HOME TERM export ENV=$HOME/.kshrc -eval `ssh-agent -s` -ssh-add diff --git a/qutebrowser/config.py b/qutebrowser/config.py index a43eb02..f8f3ca3 100644 --- a/qutebrowser/config.py +++ b/qutebrowser/config.py @@ -1493,7 +1493,7 @@ c.url.searchengines.update({'r': 'https://www.reddit.com/search?q={}'}) ## Default zoom level. ## Type: Perc -c.zoom.default = '115%' +c.zoom.default = '110%' ## Available zoom levels. ## Type: List of Perc @@ -176,17 +176,17 @@ recurrence=no recurrence.limit=1 # Context - context.work=project:w - context.work.write=project:w - context.work.read=project:w +context.work=project:w +context.work.write=project:w +context.work.read=project:w - context.home=project:h - context.home.write=project:h - context.home.read=project:h +context.home=project:h +context.home.write=project:h +context.home.read=project:h # context.code=project:code # context.work=-code +dft # context.nowork=-dft -# context.nocode=project.not:code +context.nocode=project.not:code # context.home=(project.not:code) -dft @@ -299,4 +299,4 @@ recurrence.limit=1 regex=on news.version=2.6.0 -context=home +context=nocode diff --git a/vim/autoload/plug.vim b/vim/autoload/plug.vim index 2b89b5a..46416b8 100644 --- a/vim/autoload/plug.vim +++ b/vim/autoload/plug.vim @@ -116,6 +116,10 @@ let s:TYPE = { let s:loaded = get(s:, 'loaded', {}) let s:triggers = get(s:, 'triggers', {}) +function! s:is_powershell(shell) + return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$' +endfunction + function! s:isabsolute(dir) abort return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)') endfunction @@ -238,6 +242,8 @@ function! plug#begin(...) let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p')) elseif exists('g:plug_home') let home = s:path(g:plug_home) + elseif has('nvim') + let home = stdpath('data') . '/plugged' elseif !empty(&rtp) let home = s:path(split(&rtp, ',')[0]) . '/plugged' else @@ -263,7 +269,7 @@ function! s:define_commands() endif if has('win32') \ && &shellslash - \ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$') + \ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell)) return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.') endif if !has('nvim') @@ -401,7 +407,7 @@ function! plug#end() for [map, names] in items(lod.map) for [mode, map_prefix, key_prefix] in - \ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] + \ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] execute printf( \ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>', \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) @@ -503,7 +509,7 @@ if s:is_win let batchfile = s:plug_tempname().'.bat' call writefile(s:wrap_cmds(a:cmd), batchfile) let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0}) - if &shell =~# 'powershell\(\.exe\)\?$' + if s:is_powershell(&shell) let cmd = '& ' . cmd endif return [batchfile, cmd] @@ -984,7 +990,7 @@ function! s:chsh(swap) set shell=sh endif if a:swap - if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$' + if s:is_powershell(&shell) let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s' elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$' set shellredir=>%s\ 2>&1 @@ -1204,7 +1210,8 @@ function! s:update_impl(pull, force, args) abort normal! 2G silent! redraw - let s:clone_opt = [] + " Set remote name, overriding a possible user git config's clone.defaultRemoteName + let s:clone_opt = ['--origin', 'origin'] if get(g:, 'plug_shallow', 1) call extend(s:clone_opt, ['--depth', '1']) if s:git_version_requirement(1, 7, 10) @@ -2225,7 +2232,7 @@ function! plug#shellescape(arg, ...) let script = get(opts, 'script', 1) if shell =~# 'cmd\(\.exe\)\?$' return s:shellesc_cmd(a:arg, script) - elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$' + elseif s:is_powershell(shell) return s:shellesc_ps1(a:arg) endif return s:shellesc_sh(a:arg) @@ -2277,7 +2284,7 @@ function! s:system(cmd, ...) return system(a:cmd) endif let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})')) - if &shell =~# 'powershell\(\.exe\)\?$' + if s:is_powershell(&shell) let cmd = '& ' . cmd endif else @@ -2759,9 +2766,9 @@ function! s:snapshot(force, ...) abort 1 let anchor = line('$') - 3 let names = sort(keys(filter(copy(g:plugs), - \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)'))) + \'has_key(v:val, "uri") && isdirectory(v:val.dir)'))) for name in reverse(names) - let sha = s:git_revision(g:plugs[name].dir) + let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir) if !empty(sha) call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) redraw diff --git a/vim/plugged/vim-go b/vim/plugged/vim-go -Subproject 9b9b527d61a6fe10a6d0c618cc0dd113b6aa769 +Subproject 11752f23743ac55ffa8b0662ae480ebfb0dc855 @@ -1,81 +1,70 @@ -" New vimrc! Jan 2020 +" from https://jamesdixon.dev/posts/a-minimal-vimrc/ + +if filereadable(expand('$VIMRUNTIME/defaults.vim')) + unlet! g:skip_defaults_vim + source $VIMRUNTIME/defaults.vim +endif " -" We want to load this first - everything else I include overrides it -runtime! plugin/sensible.vim - -" try to speed vim on openbsd -" https://www.reddit.com/r/openbsd/comments/9t3t4q/vim_81_slow_on_openbsd/ -let sh_minlines=100 -let sh_maxlines=600 -set belloff=all -set synmaxcol=300 -set noshowmatch -set synmaxcol=200 -set shell=/bin/ksh - -set nocompatible - -set cmdheight=1 -set re=1 "" Fuck - this does speed up vim a bit https://stackoverflow.com/questions/19030290/syntax-highlighting-causes-terrible-lag-in-vim -set foldmethod=manual -set encoding=utf-8 -set modelines=0 -" set relativenumber ! might slow down vim -set autoindent -set showmode -set nocursorline -set ttyfast -"set ttimeout -set notimeout -set nottimeout -set backspace=indent,eol,start -set laststatus=2 -set history=1000 " remember more commands and search history -set undolevels=1000 " use many muchos levels of undo -set wildignore=*.swp,*.bak,*.pyc,*.class -set visualbell " don't beep -set noerrorbells " don't beep -set number -set fillchars=diff:⣿,vert:\| -set ruler " show the cursor position all the time -set showcmd " display incomplete commands -set vb -"set list -set listchars=tab:▸\ ,eol:¬,extends:❯,precedes:❮ -set lazyredraw -set matchtime=3 -set showbreak=↪ -set splitbelow -set splitright -set autowrite -set linebreak -set fileencodings=utf-8 -set path+=** - -" Searching and movement ... -nnoremap / /\v -vnoremap / /\v -set ignorecase -set smartcase -set incsearch -set showmatch -set hlsearch -set gdefault -set scrolloff=3 -set sidescroll=1 -set sidescrolloff=10 -set virtualedit+=block -nnoremap <leader><space> :noh<cr>:call clearmatches()<cr> +" leader +let maplocalleader = "\\" +let mapleader = "," -" calcurse -" markdown notes from https://www.youtube.com/watch?v=I_-MqgpEWFA -autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown +" this needs to be here when using vim native package manager: +" https://github.com/dracula/vim/issues/161 +"packadd! dracula | colorscheme dracula -" open a Quickfix window for the last search -nnoremap <silent> <leader>/ :execute 'vimgrep /'.@/.'/g %'<CR>:copen<CR> +" leader +let maplocalleader = "\\" +let mapleader = "," +set novisualbell +set nonumber "show line numbers +set wildmenu "enable a menu that shows tab completion options in the status bar +set showmatch "highlights matching brackets on cursor hover +set ruler "show cursor position in status bar +set showcmd "shows the normal mode command before it gets executed +set encoding=utf-8 +set fileformats=unix,dos,mac +set nohlsearch "highlights searches +set incsearch "incremental search (searches character by character) +set ignorecase "ignores the case of a search +set smartcase "only ignores case if there are no capital letters in search (only works after ignorecase has been set) +set tabstop=4 "the amount of spaces that vim will equate to a tab character +set softtabstop=4 "like tabstop, but for editing operations (insert mode) +set splitbelow " split horiz below +set noswapfile +set splitright " split new to the right when doing vertical +set shiftwidth=4 "used for autoindent and << and >> operators in normal mode +set autoindent "copies indent from current line to the next line +set expandtab "tabs will expand to whitespace characters +set esckeys "allows function keys to be recognized in Insert mode +set ttimeoutlen=20 "timeout for a key code mapping +set timeoutlen=1000 "time(ms) to wait for key mappings +set hidden +set number + " vim-plug call plug#begin('~/.vim/plugged') +Plug 'morhetz/gruvbox' +Plug 'sheerun/vim-polyglot' +Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-dispatch' +Plug 'tpope/vim-fugitive' +Plug 'tpope/vim-sensible' +Plug 'tpope/vim-unimpaired' +Plug 'tpope/vim-surround' +Plug 'dense-analysis/ale' +Plug 'vim-test/vim-test' +Plug 'jlanzarotta/bufexplorer' +Plug 'preservim/nerdtree' +Plug 'mhinz/vim-signify' +Plug 'mattn/emmet-vim' +Plug 'junegunn/fzf' +Plug 'junegunn/fzf.vim' +Plug 'SirVer/Ultisnips' +Plug 'honza/vim-snippets' +Plug 'pangloss/vim-javascript' Plug 'fatih/vim-go', { 'tag': '*' } Plug 'altercation/vim-colors-solarized' Plug 'vimwiki/vimwiki' @@ -84,178 +73,274 @@ Plug 'powerman/vim-plugin-AnsiEsc' Plug 'farseer90718/vim-taskwarrior' Plug 'majutsushi/tagbar' call plug#end() + +" vim-test -" colorscheme -set background=light -"colorscheme solarized -colorscheme default +" use vim-dispatch to run tests in the quickfix window +" from Modern Vim Ch.4 +" the mappings below are from vim-test +" https://github.com/vim-test/vim-test +" dispatch opens send test output to quickfix window +" let test#strategy = "vimterminal" +let test#strategy = "basic" +let test#python#runner = "pytest" +let test#vim#term_position = "topleft 10" +" let test#python#pytest#options = '-vvv --tb=short' +let test#python#pytest#options = '--tb=short' +let test#go#runner = 'gotest' +"let test#go#gotest#options = '-v' +" To run mypy using vim-dispath -with Dispatch +autocmd FileType python let b:dispatch = 'mypy --ignore-missing-imports' - -"backups/swap -set noswapfile -set nobackup +nmap <silent> t<C-n> :TestNearest<CR> +nmap <silent> t<C-f> :TestFile<CR> +nmap <silent> t<C-s> :TestSuite<CR> +"nmap <silent> t<C-l> :TestLast<CR> +nmap <silent> <S-F10> :TestLast<CR> +nmap <silent> t<C-g> :TestVisit<CR> -" persist the undo tree for each file -set undofile -set undodir^=~/.vim/undo// +" CoC extensions +let g:coc_global_extensions = ['coc-tsserver', 'coc-pyright', 'coc-html'] -" Formatting, like Textmate -nnoremap Q gqip +" Coc Use `[g` and `]g` to navigate diagnostics +" Coc Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. +nmap <silent> [g <Plug>(coc-diagnostic-prev) +nmap <silent> ]g <Plug>(coc-diagnostic-next) + +" CoC GoTo code navigation. +nmap <silent> gd <Plug>(coc-definition) +nmap <silent> gy <Plug>(coc-type-definition) +nmap <silent> gi <Plug>(coc-implementation) " -" Django ... -augroup ft_django - au! - au BufNewFile,BufRead urls.py setlocal nowrap - au BufNewFile,BufRead urls.py normal! zR - au BufNewFile,BufRead dashboard.py normal! zR - au BufNewFile,BufRead local_settings.py normal! zR - - au BufNewFile,BufRead admin.py setlocal filetype=python.django - au BufNewFile,BufRead urls.py setlocal filetype=python.django - au BufNewFile,BufRead models.py setlocal filetype=python.django - au BufNewFile,BufRead views.py setlocal filetype=python.django - au BufNewFile,BufRead settings.py setlocal filetype=python.django - au BufNewFile,BufRead settings.py setlocal foldmethod=marker - au BufNewFile,BufRead forms.py setlocal filetype=python.django - au BufNewFile,BufRead common_settings.py setlocal filetype=python.django - au BufNewFile,BufRead common_settings.py setlocal foldmethod=marker -augroup END +" ALE ale config +let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' +let g:ale_sign_error = '✘' +let g:ale_sign_warning = '⚠' +let g:ale_lint_on_text_changed = 'never' + + +let g:ale_hover_cursor = 1 +let g:ale_enabled = 1 +let g:ale_sign_column_always = 1 +let g:ale_open_list = 0 +let g:ale_set_highlights = 0 +let g:ale_set_signs = 0 +let g:ale_set_loclist = 1 +let g:ale_set_quickfix = 0 +let g:ale_echo_cursor = 1 +let g:ale_echo_msg_error_str = 'Error' +let g:ale_echo_msg_format = '%linter% - %code: %%s' +let g:ale_loclist_msg_format = '%linter% - %code: %%s' +let g:ale_echo_msg_warning_str = 'Warning' +let g:ale_linters = {'python': ['flake8', 'mypy'], +\ 'ocaml': ['merlin'], +\ 'cpp': ['clang'], +\ 'yaml': ['yamllint'], +\ 'c': ['clang'], +\ 'go': ['gopls', 'golint', 'gofmt'], + \} +let g:ale_fixers = { +\ 'python': ['isort', 'yapf', 'black'], +\ 'go': ['gofmt'], +\ 'rust': ['rustfmt'] +\ } +let g:ale_python_mypy_ignore_invalid_syntax = 1 +let g:ale_python_mypy_executable = 'mypy' +let g:ale_python_mypy_options = '--config-file mypy.ini' +" let g:ale_sign_error = '>>' +let g:ale_fix_on_save = 1 +let g:ale_linters_explicit = 0 +nmap <silent> gr <Plug>(coc-references) + +" Use K to show documentation in preview window. +nnoremap <silent> K :call <SID>show_documentation()<CR> + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('<cword>') + elseif (coc#rpc#ready()) + call CocActionAsync('doHover') + else + execute '!' . &keywordprg . " " . expand('<cword>') + endif +endfunction " -" Mutt ... -augroup ft_muttrc - au! +"" Quick Editing vimrc +nnoremap <leader>ev <C-w>s<C-w>j<C-w>L:e $MYVIMRC<cr> - au BufRead,BufNewFile *.muttrc set ft=muttrc +" Highlight the symbol and its references when holding the cursor. +autocmd CursorHold * silent call CocActionAsync('highlight') - au FileType muttrc setlocal foldmethod=marker foldmarker=,}}} -augroup END -" -" General python properness ... -autocmd FileType python set sw=4 -autocmd FileType python set ts=4 -autocmd FileType python set sts=4 - -autocmd FileType python set omnifunc=pythoncomplete#Complete -autocmd FileType html set omnifunc=htmlcomplete#Complete +" clear search highlights +nnoremap <leader><space> :noh<cr>:call clearmatches()<cr> -syntax on -filetype indent on -filetype plugin on +" previews in netrw +let g:netrw_preview = 1 -set omnifunc=syntaxcomplete#Complete +" journal stuff +autocmd BufNewFile,BufReadPost *.md map <leader>jj <Esc>:r! date +" - \%H:\%M: "<ENTER>kJA<Esc>$<space><Esc> +autocmd BufNewFile,BufReadPost *.md map <leader>jd <Esc>:r! date +"(\%Y-\%m-\%dT\%H:\%M)"<ENTER>i<backspace><space><Esc> -" Do not scan included files when doing autocomplete -" When doing C-n in default Vim autocomplete, it looks through all -" includes which can take time. We can turn it off... This is referenced -" at https://stackoverflow.com/questions/2169645/vims-autocomplete-is-excruciatingly-slow -" and on p287 of Practical Vim -set complete-=i +" switch off Coc with Markdown +autocmd FileType markdown let b:coc_suggest_disable = 1 -" Go stuff +"syntax on "turn syntax highlighting on +filetype plugin indent on "load plugin and indent files associated a detected filetype +runtime macros/matchit.vim "allows jumping between brackets with % in normal mode +" Go stuff let g:go_highlight_fields = 1 let g:go_highlight_functions = 1 let g:go_highlight_function_calls = 1 let g:go_highlight_extra_types = 1 let g:go_highlight_operators = 1 - +let g:go_doc_keywordprg_enabled = 1 +let g:go_list_height = 0 +let g:go_highlight_operators = 1 +let g:go_highlight_function_parameters = 1 +let g:go_doc_max_height = 50 +let g:go_doc_popup_window = 1 +let g:go_list_height = 10 + + +" vim-go debugger window settings +let g:go_debug_windows = { + \ 'vars': 'leftabove 40vnew', + \ 'stack': 'leftabove 20new', + \ 'goroutines': 'botright 10new', + \ 'out': 'botright 5new', +\ } + +" vim-go and gopls +let g:go_def_mode='gopls' +let g:go_info_mode='gopls' +let g:go_play_browser_command = 'firefox %URL% &' +let g:go_test_show_name = 1 let g:go_auto_type_info = 1 - let test#go#runner = 'gotest' - let g:go_term_mode = "split" -let g:go_term_height = 10 +let g:go_term_height = 50 +let g:go_highlight_fields = 1 +let g:go_highlight_functions = 1 + "autocmd FileType go nmap <leader>r :w<CR>:split <bar> terminal go run %<CR> -autocmd FileType go nmap <leader>r :GoRun<CR> +autocmd FileType go nmap <leader>R :GoRun<CR> " highlights the variable in the file for you.. "let g:go_auto_sameids = 1 " auto import... let g:go_fmt_command = "goimports" " automatic type info on cursor let g:go_auto_type_info = 1 -"let g:go_snippet_engine = "neosnippet" +let g:go_snippet_engine = "ultisnips" au Filetype go nmap <leader>ga <Plug>(go-alternate-edit) au Filetype go nmap <leader>gah <Plug>(go-alternate-split) au Filetype go nmap <leader>gav <Plug>(go-alternate-vertical) +au FileType go nmap <F8> :GoTestFunc -short<cr> au FileType go nmap <F10> :GoTest -short<cr> au FileType go nmap <F9> :DlvToggleBreakpoint<CR> au FileType go nmap <S-F9> :DlvTest<CR> au FileType go nmap <F11> :DlvDebug<CR> au FileType go nmap <S-F5> :GoRename<CR> -" vim-test - -" use vim-dispatch to run tests in the quickfix window -" from Modern Vim Ch.4 -" the mappings below are from vim-test -" https://github.com/vim-test/vim-test -" dispatch opens send test output to quickfix window -let test#strategy = "vimterminal" -let test#python#runner = "pytest" -let test#neovim#term_position = "topleft" -let test#python#pytest#options = '-vvv --tb=short' -let test#go#runner = 'gotest' -"let test#go#gotest#options = '-v' - -" To run mypy using vim-dispath -with Dispatch -autocmd FileType python let b:dispatch = 'mypy --ignore-missing-imports' - -nmap <silent> t<C-n> :TestNearest<CR> -nmap <silent> t<C-f> :TestFile<CR> -nmap <silent> t<C-s> :TestSuite<CR> -"nmap <silent> t<C-l> :TestLast<CR> -nmap <silent> <S-F10> :TestLast<CR> -nmap <silent> t<C-g> :TestVisit<CR> -" -" wildignore -set wildignore=*.swp,*.bak,*.pyc,*.class -set wildignore+=.hg,.git,.svn " Version control -set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files -set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images -set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files -set wildignore+=*.spl " compiled spelling word lists -set wildignore+=*.sw? " Vim swap files -set wildignore+=*.DS_Store " OSX bullshit -set wildignore+=*.luac " Lua byte code -set wildignore+=migrations " Django migrations -set wildignore+=*.pyc " Python byte code -set wildignore+=*.orig " Merge resolution files - -" make complete popupmenu better -set completeopt=longest,menuone - -" leader -let maplocalleader = "\\" -let mapleader = "," - -" Ag -if executable("ag") - set grepprg=ag\ --nogroup\ --nocolor\ --ignore-case\ --column - set grepformat=%f:%l:%c:%m,%f:%l:%m -endif +" FZF +" This is the default extra key bindings +let g:fzf_action = { + \ 'ctrl-t': 'tab split', + \ 'ctrl-x': 'split', + \ 'ctrl-v': 'vsplit' } + +" - FZF Popup window (center of the screen) +let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } } + +" Customize fzf colors to match your color scheme +let g:fzf_colors = +\ { 'fg': ['fg', '#f8f8f2'], + \ 'bg': ['bg', '#282a36'], + \ 'hl': ['fg', '#bd93f9'], + \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], + \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], + \ 'hl+': ['fg', 'Statement'], + \ 'info': ['fg', '#ffb86c'], + \ 'prompt': ['fg', '#50fa7b'], + \ 'pointer': ['fg', 'Exception'], + \ 'marker': ['fg', 'Keyword'], + \ 'spinner': ['fg', '#ffb86c'], + \ 'header': ['fg', '#6272a4'] } +" More fzf settings +" (https://github.com/zenbro/dotfiles/blob/master/.nvimrc#L151-L187) + let g:fzf_nvim_statusline = 0 " disable statusline overwriting + +" command history is :History: + nnoremap <C-s> :GFiles!<CR> + nnoremap <leader><C-p> :<C-u>FZF!<CR> + nnoremap <leader>t :Files<CR> + nnoremap <leader>o :Tags<CR> + nnoremap <leader>h :History<CR> + nnoremap <silent> <leader>0 :Files<CR> + nnoremap <silent> <leader>; :BLines<CR> + nnoremap <silent> <leader>l :Lines<CR> + nnoremap <silent> <leader>o :BTags<CR> + nnoremap <silent> <leader>bu :Buffers<CR> + nnoremap <silent> <leader>? :History:<CR> + nnoremap <silent> <leader>/ :execute 'Ag ' . input('Ag/')<CR> + nnoremap <silent> <leader>P :call SearchWordWithAg()<CR> + vnoremap <silent> <leader>P :call SearchVisualSelectionWithAg()<CR> + nnoremap <silent> <leader>ft :Filetypes<CR> + nnoremap <silent> <leader>CC :Commands<CR> + imap <C-x><C-f> <plug>(fzf-complete-file-ag) + imap <C-x><C-l> <plug>(fzf-complete-line) + +" Search with ripgrep +command! -bang -nargs=* Rg + \ call fzf#vim#grep( + \ 'rg --column --line-number --no-heading --color=always --ignore-case '.shellescape(<q-args>), 1, + \ <bang>0 ? fzf#vim#with_preview('up:60%') + \ : fzf#vim#with_preview('right:50%:hidden', '?'), + \ <bang>0) + +nnoremap <C-p>a :Rg + +"" Quick Editing vimrc +nnoremap <leader>ev <C-w>s<C-w>j<C-w>L:e $MYVIMRC<cr> + +" dracula (must be set before colorscheme) +let g:dracula_colorterm = 0 +let g:dracula_bold = 1 +let g:dracula_italic = 0 " this has to be set to 0 to avoid lots of erroneous highlighting (https://github.com/dracula/vim/issues/219) +let g:dracula_underline = 1 + +" Colorscheme +"colorscheme dracula +"colorscheme elflord +let g:gruvbox_contrast_dark = 'hard' +set background=dark +colorscheme gruvbox + + +map <F7> :if exists("g:syntax_on") <Bar> +\ syntax off <Bar> +\ else <Bar> +\ syntax enable <Bar> +\ endif <CR> + +augroup general + autocmd! + "keep equal proportions when windows resized + autocmd VimResized * wincmd = + "save cursor position in a file + autocmd BufReadPost * if line("'\"") > 1 && line("'\"") + \ <= line("$") | exe "normal! g'\"" | endif +augroup END -" maps -nnoremap <leader>b :b <C-d> -nnoremap <leader>g :grep<space> -nnoremap <leader>q :b#<cr> -nnoremap <leader><space> :noh<cr>:call clearmatches()<cr> -nnoremap <leader>e :e ./**/ - -" nice search in buffer -" (example use :14 to select from menu) -nnoremap <leader>S :g//#<left><left> - -" playing with Python syntax highlighting -highlight pythonString cterm=NONE ctermbg=NONE ctermfg=65 -highlight pythonQuotes cterm=NONE ctermbg=NONE ctermfg=65 -highlight pythonBuiltin cterm=NONE ctermbg=NONE ctermfg=32 - -" ghetto linting -autocmd FileType python setlocal makeprg=flake8 -" this makes the quickfix window open automatically after -autocmd QuickFixCmdPost [^l]* cwindow - -" nice statusline -"set statusline=%-20F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v] -"set statusline+=%{gutentags#statusline()} -set statusline=%<\ %f\ %m%r%y%w%=\ L:\ \%l\/\%L\ C:\ \%c\ +augroup languages + autocmd! + autocmd BufNewFile,BufRead *.bash set syntax=sh + autocmd FileType python xnoremap <leader>r <esc>:'<,'>:w !python3<CR> + autocmd FileType go set noexpandtab + autocmd FileType html :syntax sync fromstart + autocmd FileType html,javascript,css,json,yaml,sh + \ setlocal ts=2 sts=2 sw=2 expandtab +augroup ENDj + +hi Search cterm=NONE ctermfg=black ctermbg=blue +hi Visual cterm=NONE ctermfg=black ctermbg=blue |