usr

Modulate your userpace into POSIX-compliant shell scripts!
git clone git://clone.theohenson.com/usr.git
Log | Files | Refs | README

commit 95cc8e04583015ee9b6a60b6ba6fedddc31b204b
parent 75743c5ba7d13ae83075b8844c5e6f2a4a07a4b1
Author: Theo Henson <[email protected]>
Date:   Mon, 14 Dec 2020 23:36:24 -0500

Add a few things, dramatically refactor nvim config

Diffstat:
Mhome/.config/X11/Xresources | 1-
Mhome/.config/fish/config.fish | 6++++++
Mhome/.config/nvim/init.vim | 189+++++++++++++++++++++++++++++++++++++++++++------------------------------------
Mhome/.config/sxhkd/sxhkdrc | 3+++
Mhome/.xinitrc | 1+
5 files changed, 114 insertions(+), 86 deletions(-)

diff --git a/home/.config/X11/Xresources b/home/.config/X11/Xresources @@ -4,7 +4,6 @@ Xcursor.size: 12 *foreground: #ebdbb2 *foreground_bold: #ebdbb2 -*cursor: #83a598 *background: #282828 *color0: #282828 diff --git a/home/.config/fish/config.fish b/home/.config/fish/config.fish @@ -56,3 +56,9 @@ function sudo command sudo $argv end end + +# switch two files' names +function sw + set TMPFILE (mktemp) + mv -f $argv[1] $TMPFILE && mv $argv[2] $argv[1] && mv $TMPFILE $argv[2] +end diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim @@ -1,126 +1,145 @@ -" PLUGINS +" Theo Henson's neovim init.vim + +" Plugins {{{ +if empty(glob('~/.config/nvim/autoload/plug.vim')) + silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall + autocmd VimEnter * CocInstall coc-go coc-css coc-html coc-json coc-python +endif + call plug#begin('~/.vim/plugged') -Plug 'junegunn/goyo.vim' " Distraction-free mode -Plug 'itchyny/vim-cursorword' " Fancy underlines -Plug 'tpope/vim-fugitive' " Noice git stuff -Plug 'tpope/vim-commentary' " For 'debugging' -Plug 'tpope/vim-surround' " Change surrounding characters -Plug 'tmsvg/pear-tree' " Make pairs of brackets, etc. -Plug 'morhetz/gruvbox' " Colorscheme -Plug 'airblade/vim-gitgutter' " See file changes -Plug 'vim-airline/vim-airline' " Fancy bar -Plug 'vim-airline/vim-airline-themes' " Fancy bar themes -Plug 'dag/vim-fish' " Syntax highlighting for .fish files -Plug 'neoclide/coc.nvim', {'branch': 'release'} " Completion, etc. -Plug 'vimwiki/vimwiki' " Notes -" TODO: get better css color plugin -"Plug 'skammer/vim-css-color' " See color of hex codes +" Editing functionality +Plug 'tmsvg/pear-tree' +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-surround' +Plug 'neoclide/coc.nvim', {'branch': 'release'} +" Appearance +Plug 'airblade/vim-gitgutter' +Plug 'morhetz/gruvbox' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'itchyny/vim-cursorword' +Plug 'dag/vim-fish' +" Misc +Plug 'vimwiki/vimwiki' call plug#end() -" :CocInstall -" coc-go -" coc-css -" coc-html -" coc-json -" coc-python -" coc-prettier -" coc-snippets +" }}} -" REMAPS -" For when you type too quickly +" General configuration {{{ +" For when you type too quickly {{{2 cnoremap Wq<CR> wq<CR> cnoremap W<CR> w<CR> cnoremap Q<CR> q<CR> -" Disable Ex mode -nnoremap Q <Nop> -" Split navigation +noremap Q <Nop> +" }}}2 Folds {{{2 +set foldmethod=marker +" }}}2 Splits {{{2 +set splitbelow splitright +noremap <C-s> :split<CR> +noremap <C-v> :vsplit<CR> noremap <C-h> <C-w>h noremap <C-j> <C-w>j noremap <C-k> <C-w>k noremap <C-l> <C-w>l -" Make tags -command! MakeTags !ctags -R . -" Easier search navigation +noremap <A-h> :vertical resize -5<CR> +noremap <A-l> :vertical resize +5<CR> +noremap <A-j> :resize -5<CR> +noremap <A-k> :resize +5<CR> +noremap <C-c> <C-w>q +" }}}2 Tabs {{{2 +noremap <A-TAB> :tabnext<CR> +noremap <A-t> :tabnew<CR> +noremap <A-c> :tabclose<CR> +" }}}2 Easier search/replace navigation {{{2 +set nohlsearch +set ignorecase nnoremap n nzz nnoremap N Nzz -set nohlsearch - -" MISC -set autoindent -set path+=** +nnoremap S :%s//g<Left><Left> +" }}}2 Make tags command {{{2 +command! MakeTags !ctags -R . +" }}}2 Fuzzy file search {{{2 +noremap <C-f> :find +set path=** set wildmenu -set splitbelow splitright -set number -set relativenumber -set nowrap +" }}}2 Indentation {{{2 +set autoindent set tabstop=8 -set listchars=tab:\|\ set list +set listchars=tab:\|\ +" }}}2 Line behaviour {{{2 +set nowrap +set number set cursorline -set showcmd -set noshowmode +set relativenumber +" }}}2 General compatibility {{{2 +set nocompatible set encoding=UTF-8 -set updatetime=50 -let mapleader = ',' -" coc specific +let mapleader = "," +filetype plugin indent on +" }}}2 Coc compatibility {{{2 set hidden set nobackup set nowritebackup set shortmess+=c set signcolumn=yes - -" GOYO -noremap <C-g> :Goyo<CR> - -" VIMWIKI +" }}}2 Vim wiki {{{2 let g:vimwiki_list = [{'path': '~/docs/vimwiki'}] - -" AIRLINE +" }}}2 Status line {{{2 +set showcmd +set noshowmode +set updatetime=50 let g:airline_theme = 'gruvbox' let g:airline_symbols_ascii = 1 let g:airline_section_z = '%l:%c %p%%' let g:airline_extensions = [] - -" COLORS +" }}}2 Color scheme {{{2 syntax on let g:gruvbox_italic = 1 -" let g:gruvbox_termcolors=16 colorscheme gruvbox +" }}}2 }}} -" COC.NVIM -" Abort completion on backspace +" Coc configuration {{{ +" Use tab for trigger completion with characters ahead and navigate. +" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by +" other plugin before putting this into your config. +inoremap <silent><expr> <TAB> + \ pumvisible() ? "\<C-n>" : + \ <SID>check_back_space() ? "\<TAB>" : + \ coc#refresh() +inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' endfunction -" Tab completion -inoremap <silent><expr> <TAB> - \ pumvisible() ? "\<C-n>" : - \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" : - \ <SID>check_back_space() ? "\<TAB>" : - \ coc#refresh() -" <CR> to confirm completion -if exists('*complete_info') - inoremap <expr> <CR> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>" +" Use <c-space> to trigger completion. +if has('nvim') + inoremap <silent><expr> <C-space> coc#refresh() else - inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" + inoremap <silent><expr> <[email protected]> coc#refresh() endif +" Make <CR> auto-select the first completion item and notify coc.nvim to +" format on enter, <cr> could be remapped by other vim plugin +inoremap <silent><expr> <CR> pumvisible() ? coc#_select_confirm() + \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" " 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>') - else - call CocAction('doHover') - endif + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('<cword>') + else + call CocAction('doHover') + endif endfunction -" Jump to error -nnoremap <leader>ge :lnext<CR> +" Use `[g` and `]g` to navigate errors +nmap <silent> [g <Plug>(coc-diagnostic-prev) +nmap <silent> ]g <Plug>(coc-diagnostic-next) " Symbol renaming -nnoremap <silent> <leader>rn <Plug>(coc-rename) +nmap <silent> <Leader>rn <Plug>(coc-rename) " Code navigation -nnoremap <silent> <leader>gd <Plug>(coc-definition) -nnoremap <silent> <leader>gy <Plug>(coc-type-definition) -nnoremap <silent> <leader>gi <Plug>(coc-implementation) -nnoremap <silent> <leader>gr <Plug>(coc-references) -" Use <C-s> for trigger snippet expand. -inoremap <silent> <C-s> <Plug>(coc-snippets-expand) +nmap <silent> <Leader>gd <Plug>(coc-definition) +nmap <silent> <Leader>gy <Plug>(coc-type-definition) +nmap <silent> <Leader>gi <Plug>(coc-implementation) +nmap <silent> <Leader>gr <Plug>(coc-references) +" }}} diff --git a/home/.config/sxhkd/sxhkdrc b/home/.config/sxhkd/sxhkdrc @@ -53,6 +53,9 @@ alt + shift + s # thunar alt + shift + t thunar +# htop +alt + shift + h + $TERMINAL -e htop # nnn alt + shift + n $TERMINAL -e nnn -de diff --git a/home/.xinitrc b/home/.xinitrc @@ -20,4 +20,5 @@ export _JAVA_AWT_WM_NONREPARENTING=1 dwmblocks & lxpolkit & setxkbmap -option caps:swapescape +setxkbmap -option compose:ralt exec dwm