Created
September 3, 2023 20:24
-
-
Save niksaak/e88f990de4f40fe42d98881f7f952fed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
set background=dark | |
set encoding=utf-8 | |
scriptencoding utf-8 | |
call plug#begin('~/.vim/plugged') | |
Plug 'mileszs/ack.vim' | |
Plug 'sjl/badwolf' | |
Plug 'vim-scripts/camelcasemotion' | |
Plug 'ctrlpvim/ctrlp.vim' | |
Plug 'mattn/invader-vim', {'on': 'Invader'} | |
Plug 'vim-scripts/lawrencium' | |
Plug 'arcticicestudio/nord-vim' | |
Plug 'rust-lang/rust.vim' | |
Plug 'luochen1990/rainbow' | |
Plug 'jaxbot/semantic-highlight.vim', {'on': ['SemanticHighlight', 'SemanticHighlightToggle']} | |
Plug 'mtth/scratch.vim' | |
Plug 'Rigellute/shades-of-purple.vim' | |
Plug 'vim-scripts/Sorcerer' | |
Plug 'sjl/splice.vim', {'on': 'SpliceInit'} | |
Plug 'godlygeek/tabular', {'on': 'Tabularize'} | |
Plug 'majutsushi/tagbar' | |
Plug 'vim-scripts/taglist.vim', {'on': ['TlistOpen', 'TlistToggle']} | |
Plug 'mbbill/undotree', {'on': ['UndotreeShow', 'UndotreeToggle']} | |
Plug 'vim-scripts/unimpaired.vim' | |
Plug 'bling/vim-airline' | |
Plug 'haya14busa/vim-asterisk' | |
Plug 'altercation/vim-colors-solarized' | |
Plug 'Olical/vim-enmasse', {'on': 'EnMasse'} | |
Plug 'chrisbra/vim-diff-enhanced' | |
Plug 'nblock/vim-dokuwiki' | |
Plug 'tpope/vim-fugitive' | |
Plug 'terryma/vim-multiple-cursors', {'on': 'MultipleCursorsFind'} | |
Plug 'tpope/vim-repeat' | |
Plug 'kshenoy/vim-signature' | |
Plug 'tpope/vim-surround' | |
Plug 'tpope/vim-vinegar' | |
Plug 'racer-rust/vim-racer' | |
Plug 'jnurmine/Zenburn' | |
Plug 'powerman/vim-plugin-ruscmd' | |
Plug 'prabirshrestha/async.vim' | |
Plug 'prabirshrestha/vim-lsp' | |
Plug 'ron-rs/ron.vim' | |
Plug 'tpope/vim-dispatch' | |
Plug 'tomasiser/vim-code-dark' | |
Plug 'neomake/neomake' | |
Plug 'vim-erlang/vim-erlang-runtime' | |
Plug 'tomlion/vim-solidity' | |
Plug 'vlime/vlime', { 'rtp': 'vim/' } | |
Plug 'fatih/vim-go' | |
call plug#end() | |
"colorscheme sorcerer | |
colorscheme codedark | |
" indent | |
syntax on | |
set autoindent | |
set smartindent | |
" editor | |
set fileformats=unix,dos,mac | |
set hidden | |
set number | |
set ruler | |
set colorcolumn=80 | |
set backspace=indent,eol,start | |
set ignorecase | |
set smartcase | |
set nohlsearch | |
set omnifunc=syntaxcomplete#Complete | |
set incsearch | |
set linebreak | |
set encoding=utf-8 | |
set fileencodings=ucs-bom,utf-8,cp1252,cp1251,default,latin1 | |
set autoread | |
set wildignore+=*.exe,*.pdb,*.lib,*.dll,*.ogg,*.ogv | |
set wildignore+=*/Debug-iphoneos/*,*/Debug-iphonesimulator/* | |
set wildignore+=*/Release-iphoneos/*,*/Release-iphonesimulator/* | |
set breakindent | |
set showbreak=>>> | |
set laststatus=2 | |
set showtabline=2 | |
set noshowmode | |
set scrolloff=0 | |
set sidescrolloff=9001 | |
"set listchars=trail:•,extends:»,precedes:«,nbsp:¬,tab:>-,eol:¶ | |
set listchars=trail:.,extends:>,precedes:<,nbsp:.,tab:>-,eol:$ | |
set wildmenu | |
set foldlevelstart=0 | |
set shortmess+=AI | |
set tabstop=4 " tabs | |
set shiftwidth=4 | |
set softtabstop=4 | |
set expandtab | |
" get visual selection helper | |
function! s:get_visual_selection() | |
" Why is this not a built-in Vim script function?! | |
let [lnum1, col1] = getpos("'<")[1:2] | |
let [lnum2, col2] = getpos("'>")[1:2] | |
let lines = getline(lnum1, lnum2) | |
let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)] | |
let lines[0] = lines[0][col1 - 1:] | |
return join(lines, "\n") | |
endfunction | |
function! s:match_selected_text() | |
let command = "" | |
if mode() ==# 'v' | |
let command = printf('2match IncSearch /\V%s/', escape(Asterisk#GetSelectedText(), '/\')) | |
else | |
let command = printf('%s', '2match none') | |
endif | |
exe command | |
endfunction | |
" folds - space to toggle, zO to recursively open toplevel fold | |
nnoremap <Space> za | |
vnoremap <Space> za | |
nnoremap zO zCzO | |
"let g:rust_fold = 1 | |
" multiple cursors | |
nnoremap <Leader>/ :MultipleCursorsFind<Space> | |
vnoremap <Leader>/ :MultipleCursorsFind<Space> | |
" nishtyaks | |
"autocmd CursorMoved * call s:match_selected_text() | |
nnoremap <silent> } /\v^\s*$<CR>:call histdel("/", -1)<CR>:let @/ = histget("search", -1)<CR> | |
nnoremap <silent> { ?\v^\s*$<CR>:call histdel("/", -1)<CR>:let @/ = histget("search", -1)<CR> | |
" gui | |
set guioptions=cigt | |
"set guifont=Liberation_Mono:h9 | |
"set guifont=OpenDyslexicMono:h8 | |
"set guifont=Courier_New:h11 | |
set guifont=Iosevka_Fixed_Slab_Extended:h10 | |
" project | |
set grepprg=grep\ -n\ -r\ $* | |
" middle mouse | |
map <MiddleMouse> /\<<C-r><C-w>\><C-M> | |
map <X2Mouse> N | |
map <X1Mouse> n | |
" swapfiles | |
set backupdir=~/.vim/backup// | |
set directory=~/.vim/swp// | |
" ack / ag | |
if executable('ag') | |
let g:ackprg = 'ag --nocolor --vimgrep' | |
endif | |
let g:ack_use_dispatch = 1 | |
cnoreabbrev Ack Ack! | |
nmap <F4> :Ack <C-r><C-w> | |
vmap <F4> <Esc> :execute 'Ack ' . <SID>:get_visual_selection() . ' \| bo cw'<CR> | |
" CtrlP | |
nnoremap <Leader><C-P> :CtrlPTag<CR> | |
let g:ctrlp_follow_symlinks = 1 | |
let g:ctrlp_working_path_mode = 'wra' | |
"let g:ctrlp_user_command = 'ag --nocolor -Ug "." %s | ag --nocolor -v "(png|jpg|exe|vcxproj|util|ogv|cfg|icns|ogg|dll|psi|cur|zip|link|save|pak|bak)$" | ag --nocolor -v "\.bak\/"' | |
"let g:ctrlp_lazy_update = 100 | |
let g:ctrlp_match_window = 'results:128' | |
" Airline | |
let g:airline_powerline_fonts=0 | |
"let g:airline_theme = 'codedark' | |
" Tabular for commas | |
vnoremap <Leader>, :Tabularize argument_list<CR> | |
vnoremap <Leader>= :Tabularize assignment<CR> | |
" Semantic highlight | |
nnoremap <Leader>s :SemanticHighlightToggle<CR> | |
let g:semanticTermColors = [28,29,30,31,32,33, 64,65,66,67,68,69, 100,101,102,103,104,105, 136,137,138,139,140,141, 172,173,174,175,176,177, 208,209,210,211,212,213] | |
" UndoTree | |
let g:undotree_WindowLayout = 3 | |
let g:undotree_TreeNodeShape = '•' | |
" Scratch | |
let g:scratch_insert_autohide = 0 | |
" Asterisk | |
map * <Plug>(asterisk-*) | |
map # <Plug>(asterisk-#) | |
map g* <Plug>(asterisk-g*) | |
map g# <Plug>(asterisk-g#) | |
map z* <Plug>(asterisk-z*) | |
map gz* <Plug>(asterisk-gz*) | |
map z# <Plug>(asterisk-z#) | |
map gz# <Plug>(asterisk-gz#) | |
" Rainbow | |
let g:rainbow_active = 0 | |
" Racer | |
"augroup Racer | |
" autocmd! | |
" autocmd FileType rust nmap <buffer> gd <Plug>(rust-def) | |
" autocmd FileType rust nmap <buffer> gs <Plug>(rust-def-split) | |
" autocmd FileType rust nmap <buffer> gx <Plug>(rust-def-vertical) | |
" autocmd FileType rust nmap <buffer> <leader>gd <Plug>(rust-doc) | |
" autocmd FileType rust nmap <buffer> <leader>gD <Plug>(rust-doc-tab) | |
"augroup END | |
" LSP | |
if executable("/home/ai/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer") | |
au User lsp_setup call lsp#register_server({ | |
\ 'name': 'Rust Language Server', | |
\ 'cmd': {server_info->['/home/ai/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer']}, | |
\ 'whitelist': ['rust'], | |
\ 'initialization_options': { | |
\ 'cargo': { | |
\ 'loadOutDirsFromCheck': v:true, | |
\ }, | |
\ 'checkOnSave': { | |
\ 'enable': v:false, | |
\ }, | |
\ 'procMacro': { | |
\ 'enable': v:true, | |
\ }, | |
\ 'diagnostics': { | |
\ 'enable': v:false, | |
\ 'enableExperimental': v:false, | |
\ }, | |
\ }, | |
\ }) | |
au User lsp_setup call lsp#register_server({ | |
\ 'name': 'Go Language Server', | |
\ 'cmd': {server_info->['/home/ai/go/bin/gopls']}, | |
\ 'whitelist': ['go'], | |
\ }) | |
endif | |
function! s:on_lsp_buffer_enabled() abort | |
setlocal omnifunc=lsp#complete | |
setlocal signcolumn=yes | |
if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif | |
nmap <buffer> gd <plug>(lsp-definition) | |
nmap <buffer> gs <plug>(lsp-document-symbol-search) | |
nmap <buffer> gS <plug>(lsp-workspace-symbol-search) | |
nmap <buffer> gr <plug>(lsp-references) | |
nmap <buffer> gi <plug>(lsp-implementation) | |
nmap <buffer> gt <plug>(lsp-type-definition) | |
nmap <buffer> <leader>rn <plug>(lsp-rename) | |
nmap <buffer> <leader>ga <plug>(lsp-code-action) | |
nmap <buffer> K <plug>(lsp-hover) | |
inoremap <buffer> <expr><c-f> lsp#scroll(+4) | |
inoremap <buffer> <expr><c-d> lsp#scroll(-4) | |
let g:lsp_format_sync_timeout = 1000 | |
endfunction | |
augroup lsp_install | |
au! | |
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() | |
augroup END | |
let g:lsp_diagnostics_enabled = 0 | |
" Go | |
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 | |
let g:go_term_enabled=1 | |
let g:go_term_close_on_exit=0 | |
let g:go_term_reuse = 1 | |
" WSL yank support | |
set clipboard+=unnamedplus | |
let g:clipboard = { | |
\ 'name': 'win32yank-wsl', | |
\ 'copy': { | |
\ '+': 'win32yank.exe -i --crlf', | |
\ '*': 'win32yank.exe -i --crlf', | |
\ }, | |
\ 'paste': { | |
\ '+': 'win32yank.exe -o --lf', | |
\ '*': 'win32yank.exe -o --lf', | |
\ }, | |
\ 'cache_enabled': 0, | |
\ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment