source ~/vimconfigbase.vim " Automate plug.vim installation: let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' 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 call plug#begin(expand('~/.config/nvim/plugged')) nnoremap let mapleader = "\" let g:mapleader = "\" let maplocalleader = "\" " nerdtree Plug 'scrooloose/nerdtree' Plug 'jistr/vim-nerdtree-tabs' Plug 'scrooloose/nerdcommenter' " vim-airline Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " vim-ripgrep Plug 'jremmen/vim-ripgrep' Plug 'airblade/vim-gitgutter' Plug 'Raimondi/delimitMate' Plug 'majutsushi/tagbar' " rainbow parentheses Plug 'luochen1990/rainbow' " git Plug 'tpope/vim-fugitive' " gitlink Plug 'mazubieta/gitlink-vim' " go Plug 'fatih/vim-go' " Amazing combination of features. Plug 'godoctor/godoctor.vim' " Some refactoring tools " rust Plug 'rust-lang/rust.vim' " set hidden let g:rustfmt_fail_silently = 0 let g:rustfmt_autosave = 1 " Lean Plug 'Julian/lean.nvim' " let g:lean_config = {'mappings' = v:true} let g:lean_config = { \ 'mappings': v:true, \ } " javascript Plug 'jelera/vim-javascript-syntax' " python (disabled as puts conceallevel=2, which forces markdown " previsualization :S) " Plug 'davidhalter/jedi-vim' " Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'} " solidity Plug 'tomlion/vim-solidity' " circom Plug 'iden3/vim-circom-syntax' " Cairo " Plug 'miguelmota/cairo.vim' " LaTeX support. It needs latexmk & zathura Plug 'lervag/vimtex' " Coq/Rocq Plug 'whonore/Coqtail' " completion and native LSP support. v1 while v2 is unstable Plug 'saghen/blink.cmp', { 'tag': 'v1.*' } Plug 'neovim/nvim-lspconfig' " automatically adjust shiftwidth and expand tab based on current file Plug 'tpope/vim-sleuth' " errors Plug 'Valloric/ListToggle' " focus mode Plug 'junegunn/goyo.vim' Plug 'szw/vim-maximizer' " use `CTRL+w; m` to maximize panel " vimwiki Plug 'vimwiki/vimwiki' " vim calendar Plug 'mattn/calendar-vim' " colors Plug 'tomasr/molokai' Plug 'srcery-colors/srcery-vim' Plug 'rakr/vim-one' Plug 'morhetz/gruvbox' Plug 'noahfrederick/vim-hemisu' Plug 'JaySandhu/xcode-vim' call plug#end() lua << EOF require('blink.cmp').setup({ keymap = { preset = 'default' }, completion = { documentation = { auto_show = true } }, sources = { default = { 'lsp', 'path', 'snippets', 'buffer' } }, fuzzy = { implementation = 'prefer_rust_with_warning' }, }) -- nvim-lspconfig supplies these server definitions to Neovim's native LSP. local capabilities = require('blink.cmp').get_lsp_capabilities() vim.lsp.config('gopls', { capabilities = capabilities }) vim.lsp.config('rust_analyzer', { capabilities = capabilities }) vim.lsp.enable({ 'gopls', 'rust_analyzer' }) -- Show diagnostic messages beside affected lines, with full details on demand. vim.diagnostic.config({ virtual_text = true }) vim.keymap.set('n', 'e', function() vim.diagnostic.open_float({ scope = 'line' }) end, { desc = 'Show line diagnostics' }) vim.keymap.set('n', '', vim.lsp.buf.code_action) vim.keymap.set('n', 'K', vim.lsp.buf.hover) vim.keymap.set('n', 'KK', vim.lsp.buf.hover) vim.keymap.set('n', 'gd', vim.lsp.buf.definition) vim.keymap.set('n', '', vim.lsp.buf.rename) EOF let $NVIM_TUI_ENABLE_TRUE_COLOR=1 set termguicolors if $COLORTERM == 'gnome-terminal' set term=gnome-256color else if $TERM == 'xterm' set term=xterm-256color endif endif set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\ " NERDTree let NERDTreeShowHidden=1 autocmd vimenter * NERDTree map :NERDTreeToggle " NERDCommenter let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region) "" go config function! s:build_go_files() let l:file = expand('%') if l:file =~# '^\f\+\.go$' call go#cmd#Build(0) endif endfunction let g:go_list_type = "quickfix" let g:go_fmt_command = "goimports" let g:go_fmt_fail_silently = 1 let g:go_highlight_types = 1 let g:go_highlight_fields = 1 let g:go_highlight_functions = 1 let g:go_highlight_methods = 1 let g:go_highlight_operators = 1 let g:go_highlight_build_constraints = 1 let g:go_highlight_structs = 1 let g:go_highlight_generate_tags = 1 let g:go_highlight_space_tab_error = 0 let g:go_highlight_array_whitespace_error = 0 let g:go_highlight_trailing_whitespace_error = 0 let g:go_highlight_extra_types = 1 " vim-airline "" let g:airline_theme = 'powerlineish' let g:airline_theme='one' " let g:airline#extensions#syntastic#enabled = 1 let g:airline#extensions#branch#enabled = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#buffer_nr_show = 1 let g:airline#extensions#tagbar#enabled = 1 let g:airline_skip_empty_sections = 1 " errors "" native LSP requires gopls and rust-analyzer to be available on PATH. let g:lt_location_list_toggle_map = 'l' let g:lt_quickfix_list_toggle_map = 's' noremap :cn " next 3 lines are needed for vimwiki set nocompatible filetype plugin on syntax on " vimwiki with markdown let g:vimwiki_list = [{'path': '~/vimwiki/', \ 'syntax': 'markdown', 'ext': '.md'}] " prevent vimwiki of setting conceallevel=2: let g:vimwiki_conceallevel=0 " rainbowparentheses let g:rainbow_active = 1 "" circom syntax au BufRead,BufNewFile *.circom set filetype=circom au BufRead,BufNewFile *.circuit set filetype=go-snark-circuit "" LaTeX vimtex config: " Important: This config needs latexmk & zathura to be installed. " " This is necessary for VimTeX to load properly. The "indent" is optional. " Note that most plugin managers will do this automatically. filetype plugin indent on " This enables Vim's and neovim's syntax-related features. Without this, some " VimTeX features will not work (see ":help vimtex-requirements" for more " info). syntax enable " Viewer options: One may configure the viewer either by specifying a built-in " viewer method: let g:vimtex_view_method = 'zathura' "" gitlink function! CopyGitLink(...) range redir @+ silent echo gitlink#GitLink(get(a:, 1, 0)) redir END endfunction nmap gl :call CopyGitLink() vmap gl :call CopyGitLink(1) "" sage syntax augroup filetypedetect au! BufRead,BufNewFile *.sage,*.spyx,*.pyx setfiletype python augroup END "" wat (wasm) syntax autocmd BufNewFile,BufReadPost *.wat setlocal filetype=wast " maximize current split or return to previous noremap m :MaximizerToggle " for file watching set backupcopy=yes " copy&paste from system clipboard vnoremap y "+y vnoremap p "+p " shortcut for theme change nnoremap :colorscheme gruvbox \| set background=dark \| highlight normal ctermbg=0 guibg=#000000 nnoremap :colorscheme one \| set background=light \| highlight normal guibg=#ffffff " colorscheme let g:gruvbox_contrast_dark = 'hard' let g:gruvbox_contrast_light = 'hard' let g:srcery_italic = 1 set colorcolumn=80 set textwidth=80 set background=dark " colorscheme molokai colorscheme gruvbox set conceallevel=0 highlight normal ctermbg=0 guibg=#000000