" Set the encoding to UTF-8 scriptencoding utf-8 set encoding=utf8 set shada="NONE" " Run :PlugInstall to install plugins " Plugins call plug#begin() " UI Plug 'ctrlpvim/ctrlp.vim' " Formatting helpers Plug 'tpope/vim-commentary' " Language specific Plug 'neovim/nvim-lspconfig' Plug 'fatih/vim-go' Plug 'exu/pgsql.vim' " Git helpers Plug 'tpope/vim-fugitive' call plug#end() " Set the vertical split character set fillchars+=vert:\| set inccommand=split " Prevent useless redraws set lazyredraw " Set colors set termguicolors set t_Co=256 colorscheme Tomorrow-Night " Syntax syntax on set showmatch " Set backspace to work everywhere set backspace=start,eol,indent set laststatus=1 " Show indents and trailing whitespace set list listchars=trail:·,tab:»\ ,eol:¬ " Set indent settings set tabstop=4 shiftwidth=4 noexpandtab autocmd BufRead,BufNewFile *.py set tabstop=4 shiftwidth=4 noexpandtab autocmd BufRead,BufNewFile *.yml set tabstop=2 shiftwidth=2 expandtab autocmd BufRead,BufNewFile *.yaml set tabstop=2 shiftwidth=2 expandtab autocmd BufRead,BufNewFile *.ts set tabstop=2 shiftwidth=2 expandtab autocmd BufRead,BufNewFile *.vue set tabstop=2 shiftwidth=2 expandtab " Disable auto newlines set wrap set textwidth=0 set wrapmargin=0 set formatoptions=l " GUI options set mouse=a set clipboard=unnamedplus " Line numbers set number set numberwidth=6 highlight LineNr ctermfg=darkgrey set relativenumber set ruler set showtabline=1 set completeopt=menuone,noinsert " Configure CtrlP let g:ctrlp_working_path_mode = 'r' let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] let g:netrw_dirhistmax=0 let g:netrw_liststyle=3 set shortmess+=c let g:cm_auto_popup = 0 let g:cm_sources_override = { \ 'cm-tags': {'enable':0} \ } " echodoc "let g:echodoc_enable_at_startup = 1 "set noshowmode au FileType go nmap :GoAlternate " Go let g:go_fmt_command = "gofumpt" let g:go_fmt_fail_silently = 1 let g:go_highlight_functions = 1 let g:go_highlight_methods = 1 let g:go_highlight_types = 1 let g:go_highlight_structs = 1 let g:go_highlight_interfaces = 1 let g:go_highlight_operators = 1 let g:go_highlight_build_constraints = 1 let g:go_highlight_generate_tags = 1 let g:go_metalinter_autosave = 0 let g:go_template_autocreate = 0 au BufNewFile,BufRead *.gohtml setf gohtmltmpl au BufNewFile,BufRead *.tmpl setf gohtmltmpl " Rust autocmd BufRead,BufNewFile *.rs set tabstop=4 shiftwidth=4 expandtab autocmd BufRead,BufNewFile *.wgsl set tabstop=4 shiftwidth=4 expandtab syntax=rust " Set keybindings nnoremap ^ vnoremap ^ inoremap ^ map :nohl inoremap " Disable copying on delete nnoremap d "_d vnoremap d "_d nnoremap D "_D " Disable annoying typo bindings map q: map Q " LSP lua << EOF vim.diagnostic.config({ virtual_text = false, }) local on_attach = function(client, bufnr) vim.opt.updatetime = 200 vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) -- Show diagnostic popup on cursor hover local diag_float_grp = vim.api.nvim_create_augroup("DiagnosticFloat", { clear = true }) vim.api.nvim_create_autocmd("CursorHold", { callback = function() vim.diagnostic.open_float(nil, { focusable = false }) end, group = diag_float_grp, }) local format_sync_grp = vim.api.nvim_create_augroup("Format", {}) vim.api.nvim_create_autocmd("BufWritePre", { pattern = "*.rs", callback = function() vim.lsp.buf.format({ timeout_ms = 200 }) end, group = format_sync_grp, }) end require'lspconfig'.rust_analyzer.setup{ on_attach=on_attach, settings = { ["rust-analyzer"] = { checkOnSave = { command = "clippy", }, }, }, } require'lspconfig'.gopls.setup{ on_attach=on_attach, } EOF