From cd92310b79aef6752254f1ae65c3f4aef55f4dcc Mon Sep 17 00:00:00 2001 From: speedie Date: Wed, 27 Dec 2023 00:18:07 +0100 Subject: [PATCH] Slim down my Vim config, remove a bunch of bloat that I really don't need anymore. --- .config/nvim/coc-settings.json | 1 - .config/nvim/config | 243 ++++----------------------------- .config/nvim/footer.sh | 0 .config/nvim/header.sh | 47 ------- .config/nvim/init.vim | 0 .config/nvim/setup.sh | 3 - 6 files changed, 25 insertions(+), 269 deletions(-) delete mode 100755 .config/nvim/coc-settings.json mode change 100755 => 100644 .config/nvim/config delete mode 100755 .config/nvim/footer.sh delete mode 100755 .config/nvim/header.sh mode change 100755 => 100644 .config/nvim/init.vim delete mode 100755 .config/nvim/setup.sh diff --git a/.config/nvim/coc-settings.json b/.config/nvim/coc-settings.json deleted file mode 100755 index 0380b28..0000000 --- a/.config/nvim/coc-settings.json +++ /dev/null @@ -1 +0,0 @@ -"coc.preferences.formatOnSaveFiletypes": ["css", "markdown"], diff --git a/.config/nvim/config b/.config/nvim/config old mode 100755 new mode 100644 index e0d0a9c..a4a356f --- a/.config/nvim/config +++ b/.config/nvim/config @@ -1,246 +1,53 @@ -" speedie's neovim configuration - -let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.config/nvim/vimdata' -if empty(glob(data_dir . '/autoload/plug.vim')) - silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC -endif - -if empty(glob('~/.config/nvim/vimdata/autoload/plug.vim')) - silent !curl -fLo ~/.config/nvim/vimdata/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -endif - -autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) - \| PlugInstall --sync | source $MYVIMRC -\| endif -call plug#begin('~/.config/nvim/vimdata/plugged') -Plug 'dylanaraps/wal.vim' -Plug 'lilydjwg/colorizer' -Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'ervandew/supertab' -Plug 'mhinz/vim-startify' -Plug 'preservim/nerdtree' -Plug 'ryanoasis/vim-devicons' -Plug 'Xuyuanp/nerdtree-git-plugin' -Plug 'vim-airline/vim-airline' -Plug 'vifm/vifm.vim' -Plug 'derekwyatt/vim-fswitch' -Plug 'pulkomandy/c.vim' -Plug 'kg8m/vim-simple-align' -Plug 'jreybert/vimagit' -Plug 'mattn/emmet-vim' -Plug 'airblade/vim-gitgutter' -Plug 'ctrlpvim/ctrlp.vim' -Plug 'tomasiser/vim-code-dark' -Plug 'rainbowhxch/accelerated-jk.nvim' -Plug 'jreybert/vimagit' -Plug 'tpope/vim-fugitive' -Plug 'tpope/vim-rhubarb' -Plug 'tpope/vim-commentary' -Plug 'tpope/vim-surround' -Plug 'preservim/tagbar' -Plug 'autozimu/LanguageClient-neovim', { - \ 'branch': 'next', - \ 'do': 'bash install.sh', - \ } - -Plug 'junegunn/fzf' -call plug#end() - -" Coc extensions -let g:coc_global_extensions = ['coc-json', 'coc-git', 'coc-html', 'coc-html-css-support', 'coc-markdownlint', 'coc-sh', 'coc-css'] - syntax on -"set nu + set rnu -set autoindent -set tabstop=4 +set mouse=a +set clipboard=unnamedplus +set title +set hidden set smarttab -set softtabstop=4 -set shiftwidth=4 +set autoindent set expandtab set noswapfile set nocursorline -set noshowmode -set hidden -set mouse=a -set undolevels=1000 -set clipboard=unnamedplus -set title -filetype plugin indent on -let &t_8f = "\[38;2;%lu;%lu;%lum" -let &t_8b = "\[48;2;%lu;%lu;%lum" -colorscheme wal +set undolevels=10000 +set softtabstop=4 +set shiftwidth=4 +set tabstop=4 -let g:airline_theme='wal' - -" true color +set termguicolors set t_Co=256 set t_ut= -let g:airline_theme = 'codedark' -colorscheme codedark set background=dark + +autocmd BufReadPre *.md set spell +autocmd BufWritePre * %s/\s\+$//e +autocmd BufWritePre * %s/\t/ /e + highlight Normal ctermfg=grey ctermbg=lightgray -highlight StartifyBracket ctermfg=240 -highlight StartifyFooter ctermfg=240 -highlight StartifyHeader ctermfg=114 -highlight StartifyNumber ctermfg=215 -highlight StartifyPath ctermfg=245 -highlight StartifySlash ctermfg=240 -highlight StartifySpecial ctermfg=240 -set termguicolors +hi SpellBad guisp=red gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=undercurl +hi SpellCap guisp=yellow gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=undercurl -" Mappings -map ZX :w -map F :Vifm -map ZF :!$BROWSER % -map ZC :!/bin/sh -c % -map T :%norm I -map W :!make -map Q :!gcc % -o %\.out - -nnoremap ciq ci" -nnoremap diq di" -nnoremap yiq yi" -nnoremap cip ci) -nnoremap dip di) -nnoremap yip yi) - -" git integration -nnoremap gP :![ -d ".git" ] && git push -nnoremap gV :Magit -nnoremap gB :Git blame -nnoremap gA :Git add * -nnoremap gC :Git commit -a -nnoremap gn :GitGutterNextHunk -nnoremap gp :GitGutterPrevHunk -nnoremap :e ~/.config/nvim/config - -nnoremap ZA :Startify -nnoremap :AirlineToggle - -nnoremap :call Markdownlenshorten() - -vmap c :%norm $ -vmap C :%norm I - -nnoremap :term - -nnoremap :NERDTreeFind -nnoremap :NERDTreeToggle - -nnoremap :bnext -nnoremap :bprevious -nnoremap :badd New file -nnoremap :bdelete! - -nnoremap f :TagbarToggle - -nnoremap :split -nnoremap :vsplit -nnoremap :only - -nnoremap :CtrlP - -nnoremap fl :SLoad -nnoremap fs :SSave -nnoremap fd :SDelete -nnoremap fc :SClose +filetype plugin indent on nnoremap h nnoremap j nnoremap k nnoremap l +nnoremap :split +nnoremap :vsplit +nnoremap :only +nnoremap :term nnoremap H :vertical resize -10 nnoremap J :resize -10 nnoremap K :resize +10 nnoremap L :vertical resize +10 -nnoremap mci :!if [ -x "$(command -v doas)" ]; then; doas make clean install; else; sudo make clean install; fi -nnoremap mci :!if [ -x "$(command -v doas)" ]; then; doas make clean install; else; sudo make clean install; fi - -nmap j (accelerated_jk_gj) -nmap k (accelerated_jk_gk) - -let &t_Cs = "\e[4:3m" -let &t_Ce = "\e[4:0m" - -let g:LanguageClient_serverCommands = { - \ 'sh': ['bash-language-server', 'start'] - \ } - -" Airline -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif - -let g:startify_custom_header = startify#pad(split(system('[ -e "$HOME/.config/nvim/header.sh" ] && $HOME/.config/nvim/header.sh'), '\n')) -let g:startify_custom_footer = startify#pad(split(system('[ -e "$HOME/.config/nvim/footer.sh" ] && $HOME/.config/nvim/footer.sh'), '\n')) - -let g:airline_powerline_fonts = 0 -let g:airline#extensions#tabline#enabled = 1 -let g:airline_left_sep = '' -"let g:airline_left_sep = '▶' -let g:airline_right_sep = '' -"let g:airline_right_sep = '◀' -let g:airline_symbols.linenr = ' ␊ ' -let g:airline_symbols.linenr = ' ␤ ' -let g:airline_symbols.linenr = ' ¶ ' -let g:airline_symbols.branch = '⎇ ' -let g:airline_symbols.paste = 'ρ ' -let g:airline_symbols.paste = ' Þ ' -let g:airline_symbols.paste = ' ∥ ' -let g:airline_symbols.whitespace = ' Ξ ' -"let g:airline_left_sep = '' -let g:airline_left_alt_sep = '' -"let g:airline_right_sep = '' -let g:airline_right_alt_sep = '' -let g:airline_symbols.branch = '  ' -let g:airline_symbols.readonly = '  ' -let g:airline_symbols.linenr = '  ' - -let g:netrw_banner=0 -let g:netrw_liststyle=0 -let g:netrw_browse_split=4 -let g:netrw_altv=1 -let g:netrw_winsize=25 -let g:netrw_keepdir=0 -let g:netrw_localcopydircmd='cp -r' - -let NERDTreeShowHidden=1 -let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] - nnoremap d "_d xnoremap d "_d xnoremap p "_dP nnoremap c "_c -hi CocErrorHighlight gui=undercurl guisp=red -hi SpellBad guisp=red gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=undercurl -hi SpellCap guisp=yellow gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=undercurl - -autocmd VimEnter :lcd %:p:h -autocmd FileType scss setl iskeyword+=@-@ -autocmd BufWritePre * %s/\s\+$//e - -autocmd User StartifyReady :AirlineToggle -autocmd User StartifyBufferOpened :AirlineToggle -"autocmd BufWritePost options.h !command -v sudo > /dev/null && sudo make clean install || doas make clean install - -function! Markdownlenshorten() - while (len(getline(".")) > 80) - normal! 0 - " Find the first white-space character before the 81st character. - call search('\(\%81v.*\)\@" - " If the next line has words, join it to avoid weird raph breaks. - if (getline(line('.')+1) =~ '\w') - normal! J - endif - endwhile - " Trim any accidental trailing whitespace - :s/\s\+$//e -endfunction +let &t_8f = "\[38;2;%lu;%lu;%lum" +let &t_8b = "\[48;2;%lu;%lu;%lum" diff --git a/.config/nvim/footer.sh b/.config/nvim/footer.sh deleted file mode 100755 index e69de29..0000000 diff --git a/.config/nvim/header.sh b/.config/nvim/header.sh deleted file mode 100755 index 4fc62d2..0000000 --- a/.config/nvim/header.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# neovim start page -# -# The output of this shell script will be displayed on startup. -# -# -- Function map -- -# -# main(); - The first function that gets called. It calls all the other functions so you don't need to touch it for most things. -# prepare(); - This function sets basic variables. -# print_text(); - Prints text helpful to new users. You can change anything there. -# drw_ascii(); - Creates ASCII art from an image, or if it's a text file it will print it out. - -print_text() { - # text that will be printed - printf -- "\ - - Run ':h' for help.\n\ - - Press CTRL+E to configure.\n\ - - Edit ~/.config/nvim/start.sh to customize this start page.\n\ -" - - # if there is no image - [ "$no_image" = "true" ] && printf -- "\ - - Add an image or text file to ~/.config/nvim/images and it will be displayed on startup.\n\ -" - -} - -drw_ascii() { - file="$(find $dir/images -type f | shuf | head -n 1 | grep -E "png|txt")" - [ ! -f "$file" ] && printf "neovim %s\n" "$(nvim -v | awk '{ print $2 }' | head -n 1)" && no_image="true" - printf "$file" | grep -q txt && cat "$file" - printf "$file" | grep -q png && jp2a "$file" --size="80x20" - printf "\n" -} - -prepare() { - dir="$(dirname $0)" - [ -d "$dir/images" ] || mkdir -p $dir/images -} - -main() { - prepare - [ -x $(command -v jp2a) ] && drw_ascii - print_text -} - -main diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim old mode 100755 new mode 100644 diff --git a/.config/nvim/setup.sh b/.config/nvim/setup.sh deleted file mode 100755 index 1b42f08..0000000 --- a/.config/nvim/setup.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -[ "$(whoami)" != "root" ] && printf "Run me as root.\n" && exit 1 -command -v npm > /dev/null && npm i -g bash-language-server || printf "npm not available, won't install bash-language-server\n"