From 54452a6c069a412bcd3bf3a64a51d24ea04ffd6f Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 13 May 2023 17:35:09 -0300 Subject: quick 2023 update --- .vimrc | 236 ++++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 146 insertions(+), 90 deletions(-) mode change 100644 => 100755 .vimrc (limited to '.vimrc') diff --git a/.vimrc b/.vimrc old mode 100644 new mode 100755 index 867eebf..7039c60 --- a/.vimrc +++ b/.vimrc @@ -1,107 +1,163 @@ -" vim-sublime - A minimal Sublime Text - like vim experience bundle -" http://github.com/grigio/vim-sublime -" Best view with a 256 color terminal and Powerline fonts -" Updated by Dorian Neto (https://github.com/dorianneto)" +" ~nebula/.vimrc (2018-2023, public domain) +" table of contents: +" setup +" vim settings +" plugins +" language-specific behavior + +" setup ------------------------------------ + +" initialization stuff set nocompatible +set encoding=utf-8 +" plugin management execute pathogen#infect() - -filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' Plugin 'vim-airline/vim-airline' Plugin 'vim-airline/vim-airline-themes' Plugin 'airblade/vim-gitgutter' -Plugin 'chrisbra/NrrwRgn' -Plugin 'colors' +Plugin 'tpope/vim-sleuth' +Plugin 'eslint/eslint' call vundle#end() -filetype plugin indent on -set background=dark +" vim settings ----------------------------- + +" indentation & wrapping +set tabstop=4 shiftwidth=4 expandtab +set autoindent +set nosmartindent " also overridden per language +set smarttab shiftround +set nowrap +set linebreak +set breakindent +set showbreak=\ ↳\ " + +" editor behavior +filetype indent off +set autoread +set hidden +set backspace=indent,eol,start +set mouse=a ttymouse=xterm2 +set ttimeout ttimeoutlen=50 + +" editor appearance colorscheme molokai -let g:airline_theme='badwolf' -syntax on - -" Use :help 'option' to see the documentation for the given option. -set autoindent -set backspace=indent,eol,start -set showmatch -set showmode -set smarttab -set shiftround -set ttimeout -set ttimeoutlen=50 -set nois -set laststatus=2 -set ruler -set showcmd -set wildmenu -set autoread -set encoding=utf-8 -set tabstop=2 shiftwidth=2 expandtab -set listchars=tab:▒░,trail:▓ -set list -set number -set hlsearch -set ignorecase -set smartcase - -if has('mouse') - set mouse=a -endif - -set hidden -set nobackup -set nowritebackup -set noswapfile -set fileformats=unix,dos,mac -set completeopt=longest - -" -" Plugins config -" - -" NERDTree -nnoremap :NERDTreeToggle - -" vim-airline -let g:airline#extensions#tabline#enabled = 1 -let g:airline_powerline_fonts = 1 +syntax off +set background=dark +set colorcolumn=+1 +set cursorline +set laststatus=2 +set list listchars=trail:▓ +set number +set scrolloff=5 sidescrolloff=8 +set showcmd +set noshowmode " airline shows mode already +set wildmenu -" -" Basic shortcuts definitions -" most in visual mode / selection (v or ⇧ v) -" - -" Find -map / -" indent / deindent after selecting the text with (⇧ v), (.) to repeat. -vnoremap > -vnoremap < -" Text wrap simpler, then type the open tag or '," -vmap S -" Tabs -let g:airline#extensions#tabline#enabled = 1 -nnoremap :tabprevious -inoremap :tabpreviousi -nnoremap :tabnext -inoremap :tabnexti -nnoremap :tabnew -inoremap :tabnewi - -set ttymouse=xterm2 -set mouse=a -set encoding=utf-8 -nnoremap :let _s=@/:%s/\s\+$//e:let @/=_s -inoremap :w +" search +set hlsearch +set ignorecase smartcase +set noincsearch + +" writing behavior +set nobackup nowritebackup noswapfile +set fileformats=unix,dos,mac + +" keyboard shortcuts +nnoremap / nnoremap :w -command! -range=% Paste ,!tee /tmp/paste /dev/stdout; curl -s --data-binary @/tmp/paste https://paste.safe.moe/documents | sed -r 's$.*".*".*"(.*)".*$https://paste.safe.moe/raw/\1$g' | xclip -sel clip +inoremap :w + +" restore previous scroll position +autocmd BufReadPost * silent! normal! g`"zv + +" disable default language-specific indentation behavior +" (this doesn't actually work as an autocmd, instead copy-paste +" this into ~/.vim/indent/.vim files) +" let b:did_indent = 1 + +" only allow a few syntax highlighting colors +hi NonText ctermbg=NONE ctermfg=NONE cterm=NONE +hi Visual ctermbg=fg ctermfg=bg cterm=NONE +hi Boolean ctermbg=NONE ctermfg=NONE cterm=NONE +hi Character ctermbg=NONE ctermfg=NONE cterm=NONE +hi Comment ctermbg=NONE ctermfg=45 cterm=NONE +hi Conditional ctermbg=NONE ctermfg=NONE cterm=NONE +hi Constant ctermbg=NONE ctermfg=NONE cterm=NONE +hi Delimiter ctermbg=NONE ctermfg=NONE cterm=NONE +hi Error ctermbg=NONE ctermfg=NONE cterm=reverse +hi Exception ctermbg=NONE ctermfg=NONE cterm=NONE +hi Float ctermbg=NONE ctermfg=NONE cterm=NONE +hi Function ctermbg=NONE ctermfg=NONE cterm=NONE +hi Identifier ctermbg=NONE ctermfg=NONE cterm=NONE +hi Ignore ctermbg=NONE ctermfg=NONE cterm=NONE +hi Keyword ctermbg=NONE ctermfg=NONE cterm=NONE +hi Label ctermbg=NONE ctermfg=NONE cterm=NONE +hi Number ctermbg=NONE ctermfg=NONE cterm=NONE +hi Operator ctermbg=NONE ctermfg=NONE cterm=NONE +hi PreProc ctermbg=NONE ctermfg=NONE cterm=NONE +hi Repeat ctermbg=NONE ctermfg=NONE cterm=NONE +hi Special ctermbg=NONE ctermfg=NONE cterm=NONE +hi SpecialChar ctermbg=NONE ctermfg=NONE cterm=NONE +hi Statement ctermbg=NONE ctermfg=NONE cterm=NONE +hi StorageClass ctermbg=NONE ctermfg=NONE cterm=NONE +hi String ctermbg=NONE ctermfg=NONE cterm=NONE +hi Title ctermbg=NONE ctermfg=NONE cterm=NONE +hi Todo ctermbg=NONE ctermfg=DarkGray cterm=underline +hi Type ctermbg=NONE ctermfg=NONE cterm=NONE +hi Underlined ctermbg=NONE ctermfg=DarkGray cterm=underline +hi Search ctermbg=DarkGray ctermfg=white cterm=NONE +hi link gitcommitOverflow Error +hi htmlItalic ctermbg=NONE ctermfg=NONE cterm=underline + +" plugin settings -------------------------- + +" airline +" let g:airline_theme='minimalist' +let g:airline_theme='zenburn' +" distinguished (grey yellow) +" peaksea (grey) +" molokai (molokai) +" minimalist (nice) +" luna (wof) +" zenburn (grey good contrast) +let g:airline_powerline_fonts = 1 +let g:airline#extensions#tabline#enabled = 1 + +" ale + +" Only lint if .eslintrc is present +autocmd BufEnter,BufNew *.js let g:ale_linters = FindGlob('.eslintrc.*', expand('%:p:h')) ? {'javascript': ['eslint']} : {'javascript': ['']} + +function! g:FindGlob(pattern, path) + let fullpattern = a:path . "/" . a:pattern + if strlen(glob(fullpattern)) + return 1 + else + let parts = split(a:path, "/") + if len(parts) + let newpath = "/" . join(parts[0:-2], "/") + return FindGlob(a:pattern, newpath) + else + return 0 + endif + endif +endfunction + +" language specific behavior --------------- + +" indent options for particular languages +autocmd FileType javascript set smartindent +autocmd FileType c,cpp,h,hpp set smartindent +" word wrap javascript comments +autocmd BufEnter,BufNew *.js autocmd CursorMoved,CursorMovedI * :if match(getline('.'), '^\s*//') == 0 | :setlocal textwidth=80 | :else | :setlocal textwidth=0 | :endif -" AAAAAAAAAAAAAAAAAA todo highlighting -highlight TodoDone ctermfg=13 -highlight TodoNotDone ctermfg=15 -highlight TodoStringDone ctermfg=3 -highlight TodoStringNotDone ctermfg=2 cterm=bold +" yaml overrides +au FileType yaml setlocal indentexpr= +au FileType yaml nmap { ?---\+ +au FileType yaml nmap } /---\+ -- cgit 1.3.0-6-gf8a5