"line numbers set nu "unix newlines set ff=unix "set the highlight column at 80 set colorcolumn=80 " displace spaces, tabs, and newlines set list set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:» set noexpandtab " Set wrap set wrap "2 lines of cmd, needed for echodoc set cmdheight=2 if has('win32') source $VIMRUNTIME/mswin.vim endif let g:python3_host_prog='python3' call plug#begin('~/.vim/plugged') "Formatting and navigation Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'scrooloose/nerdcommenter' Plug 'godlygeek/tabular' " " "Git Plug 'xuyuanp/nerdtree-git-plugin' Plug 'tpope/vim-fugitive' " " "Fuzzy file search Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' " " "tab completion Plug 'Shougo/denite.nvim' Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'Shougo/echodoc.vim' Plug 'deoplete-plugins/deoplete-jedi' Plug 'raimon49/requirements.txt.vim' " Scala tab completion Plug 'nvim-lua/plenary.nvim' "Plug 'scalameta/nvim-metals' " CSV formatting Plug 'chrisbra/csv.vim' " Lua, Moonscript, Teal Plug 'xolox/vim-misc' Plug 'xolox/vim-lua-ftplugin' Plug 'VaiN474/vim-etlua' Plug 'leafo/moonscript-vim' Plug 'teal-language/vim-teal' Plug 'neovim/nvim-lspconfig' " Treesitter, higlihting Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " Coq Plug 'whonore/Coqtail' " GLSL Plug 'tikhomirov/vim-glsl' " Supercollider Plug 'davidgranstrom/scnvim' "Color schemes Plug 'mhartington/oceanic-next' Plug 'vim-scripts/Wombat' Plug 'zeis/vim-kolor' Plug 'alessandroyorba/despacio' Plug 'alessandroyorba/alduin' Plug 'tomasr/molokai' Plug 'sainnhe/vim-color-forest-night' Plug 'sts10/vim-pink-moon' Plug 'severij/vadelma' Plug 'kkpmw/sacredforest-vim' Plug 'jsit/toast.vim' Plug 'henrynewcomer/vim-theme-papaya' Plug 'sainnhe/edge' Plug 'kjssad/quantum.vim' Plug 'kyoz/purify' Plug 'jonathanfilip/vim-lucius' Plug 'joshdick/onedark.vim' Plug 'cocopon/iceberg.vim' Plug 'wolf-dog/sceaduhelm.vim' Plug 'danilo-augusto/vim-afterglow' Plug 'kamwitsta/mythos' Plug 'softmotions/vim-dark-frost-theme' Plug 'ghifarit53/tokyonight-vim' "Icons, requires a nerd font Plug 'ryanoasis/vim-devicons' "AI, requires ollama, curl, and plenary "on Plug 'nomnivore/ollama.nvim' " Terraform "Plug 'hashivim/vim-terraform' call plug#end() colorscheme onedark "deoplete let g:deoplete#enable_at_startup = 1 inoremap pumvisible() ? "\" : check_back_space() ? "\" : deoplete#mappings#manual_complete() function s:check_back_space() abort "{{{ let col = col('.') - 1 return !col || getline('.')[col-1] =~ '\s' endfunction "}}} autocmd CompleteDone * if pumvisible() == 0 | silent! pclose | endif " echodoc let g:echodoc#enable_at_startup=1 let g:echodoc#type="floating" highlight link EchoDocFloat Pmenu "python let g:deoplete#sources#jedi#python_path='python3' let g:deoplete#sources#jedi#enable_short_types=1 let g:deoplete#sources#jedi#show_docstring=1 call deoplete#custom#source('jedi','max_info_width',0) set completeopt-=preview "lua let g:lua_compiler_name='lua' "let g:lua_compiler_name='lua' let g:lua_complete_dynamic=1 let g:lua_complete_keywords=0 au BufReadPost *.busted set syntax=lua au BufReadPost *.spec set syntax=lua au BufReadPost *.etlua set syntax=html "Overwrite xolox:ftplugin's "Help" with shift-k au BufReadPost *.lua nunmap K " GLSL au BufReadPost *.vs,*.fs set ft=glsl "scala augroup lsp au! au FileType java,scala,sbt lua m=require("metals"); mc=m.bare_config(); mc.init_options.statusBarProvider="on"; m.initialize_or_attach(mc) augroup end "NERDTree config autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | \ quit | endif nnoremap :NERDTreeToggle nnoremap :NERDTreeFind let NERDTreeMapHelp='y' let NERDTreeMapJumpLastChild='y' let NERDTreeMapJumpFirstChild='y' "NERDCommenter config "nnoremap :call nerdcommenter#Comment('x', 'toggle') "vnoremap :call nerdcommenter#Comment('x', 'toggle') "Fuzzy file search let g:fzf_layout = { 'window': {'width': 0.9, 'height': 0.6} } noremap :call fzf#run(fzf#wrap({'sink': 'tabe', 'left': '20%', 'source': 'git ls-files'})) noremap :call fzf#run(fzf#wrap({'sink': 'vsplit', 'left': '50%', 'source': 'git ls-files'})) "Fuzzy git checkout branch noremap c :call fzf#run(fzf#wrap({'sink': 'Git checkout', 'left':'20%', 'source': 'git branch --format "%(refname:short)"'})) noremap a :call fzf#run(fzf#wrap({'sink': 'Git checkout', 'left':'50%', 'source': 'ag --nogroup --column --color --', 'preview-window':'up','preview':expand(':p:h:h:h').'/bin/preview.sh'})) "Fuzzy sbt function! s:VTerm(command) vsplit termopen(a:command) endfunction "ctrl+s saves nmap :w "For some reason this is different between linux and windows if has('win32') vmap c else vmap c endif "Set leader let mapleader=";" "Shortcut to modify vim config nnoremap ec :tabe $MYVIMRC "Move around quickly nnoremap J 5j nnoremap K 5k nnoremap H 5h nnoremap L 5l vnoremap J 5j vnoremap K 5k vnoremap H 5h vnoremap L 5l "Navigate splits tnoremap h tnoremap j tnoremap k tnoremap l nnoremap h nnoremap j nnoremap k nnoremap l "Resize splits "noremap :vertical resize -5 "noremap :vertical resize +5 "noremap :res +5 "noremap :res -5 function! s:HasNeighbor(direction) return winnr() != winnr(a:direction) endfunction function! s:PushResize(direction, amount) if a:direction == 'l' || a:direction == 'h' let l:cmd = 'vertical resize' else let l:cmd = 'resize' endif if s:HasNeighbor(a:direction) let l:amount = '+'.a:amount else let l:amount = '-'.a:amount endif echo l:cmd . ' ' . l:amount execute l:cmd . ' ' . l:amount set cmdheight=2 endfunction nnoremap :call PushResize('h',5) nnoremap :call PushResize('j',5) nnoremap :call PushResize('k',5) nnoremap :call PushResize('l',5) "Navigate tabs noremap gt noremap gT "Add a semicolon at the end of the line vnoremap :'<,'>s/\([^;]\)$/\1;/g "Vertical split and make noremap :vsplit term://make all "Start a terminal noremap :vsplit:terminal "Find and open in a new tab noremap :Ag "Restart vim (alt+1) noremap :source $MYVIMRC \| :PlugInstall filetype plugin indent on syntax enable "Unmap a bunch of stuff set by lunarvim if has_key(environ(), "LUNARVIM_BASE_DIR") lua if lvim then lvim.builtin.which_key.mappings.e = nil end lua if lvim then lvim.lsp.buffer_mappings.normal_mode.K = nil end lua if lvim then lvim.builtin.bufferline.active = false end let $MYVIMRC=$LUNARVIM_BASE_DIR . "\\vimrc.vim" "nmap :NvimTreeToggle "vunmap "vmap :call nerdcommenter#NERDComment('x', 'toggle') "nnoremap :call nerdcommenter#Comment('x', 'toggle') endif " ollama.nvim - ai code assist lua require("ollama").config.model = "codestral" vnoremap gg :lua require("ollama").prompt("fgen") vnoremap gh :lua require("ollama").prompt("Explain_Code") vnoremap gG :lua require("ollama").prompt("extend") nnoremap gt :lua require("ollama").prompt("Raw") lua << EOF vim.api.nvim_create_autocmd('FileType', { -- This handler will fire when the buffer's 'filetype' is "lua" pattern = 'lua', callback = function(ev) vim.lsp.start({ name = 'lua-lsp', cmd = {'lua-language-server'}, -- Set the "root directory" to the parent directory of the file in the -- current buffer (`ev.buf`) that contains either a "setup.py" or a -- "pyproject.toml" file. Files that share a root directory will reuse -- the connection to the same LSP server. root_dir = "data" }) end, }) EOF lua << EOF require("lspconfig").lua_ls.setup{ settings={ Lua={ runtime={ version="LuaJIT", path="data/?.lua" } } } } EOF