let g:loaded_netrw = 1 let g:loaded_netrwPlugin = 1 if filereadable('/etc/hostname') let hostname=join(readfile('/etc/hostname')) else let hostname='unknown' endif let g:vsnip_snippet_dir = "~/.config/nvim/snippets" let g:vsnip_snippet_dirs = ["~/.config/nvim/local/snippets"] call plug#begin() if filereadable(printf('%s/.config/nvim/local-plug.vim', $HOME)) exec "source " . printf('%s/.config/nvim/local-plug.vim', $HOME) endif Plug 'lukas-reineke/virt-column.nvim' Plug 'dylnmc/synstack.vim' Plug 'folke/trouble.nvim' Plug 'git@git.josher.dev:bulletjava.vim.git' Plug 'git@git.josher.dev:nvim-warp.git' Plug 'git@git.josher.dev:fieldmarshal.vim.git' Plug 'git@git.josher.dev:nvim-color-picker.git' Plug 'google/vim-codefmt' Plug 'google/vim-glaive' Plug 'google/vim-maktaba' Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-nvim-lua' Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-vsnip' Plug 'hrsh7th/nvim-cmp' Plug 'hrsh7th/vim-vsnip' Plug 'kyazdani42/nvim-web-devicons' Plug 'linrongbin16/lsp-progress.nvim' Plug 'nanozuki/tabby.nvim' Plug 'nanozuki/tabby.nvim' Plug 'neovim/nvim-lspconfig' Plug 'nvim-lua/plenary.nvim' Plug 'nvim-lualine/lualine.nvim' Plug 'nvim-telescope/telescope.nvim' Plug 'nvim-tree/nvim-tree.lua' Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} Plug 'nvim-treesitter/nvim-treesitter-textobjects' Plug 'nvim-treesitter/playground' Plug 'onsails/lspkind.nvim' Plug 'tpope/vim-surround' if has('rneovim') Plug 'git@git.josher.dev:rneovim-userregs.git' endif Plug 'git@git.josher.dev:config.vim.git', \ { 'dir': g:plug_home . '/config.vim', \ 'do': ':UpdateInitVimHook' } call plug#end() command! UpdateInitVimHook source ~/.config/nvim/init.vim PlugInstall set termguicolors set shiftwidth=2 set tabstop=2 set expandtab set nowrap set splitright set splitbelow set wildmode=longest,list,full set scrolloff=8 set number set relativenumber set pumheight=20 let mapleader=" " " Make splitting more congruent with how Tmux does it. noremap % v noremap " s " Open a terminal in a split below the current file. noremap sterm " Opens a terminal in the directory the current file is in. noremap sTERM " Fix the yank behavior. noremap Y y$ " Format code. This is noremap ú FormatCode " Synstack to help profile syntax highlighting issues. noremap p (SynStack) " Way to find files. noremap ff Telescope find_files noremap Telescope find_files function! s:find_in_dir() exec "Telescope find_files search_dirs={\"" . escape(expand('%:h'), ' ') . "\"}" endfunction noremap call find_in_dir() inoremap (vsnip-expand) " When navigating to the beginning of a line, I want to always reset the screen " to the leftmost position. noremap ^ ^zH noremap t TroubleToggle function! HighlightColorColumns() abort hi MyColorColumn guifg=#644141 guibg=none gui=None endfunction call HighlightColorColumns() augroup InitVim au! au ColorScheme * call HighlightColorColumns() autocmd BufRead *.java,*.c,*.cpp,*.cxx,*.hs TSBufEnable highlight " Automatically stop highligting things when leaving insert mode. If I want " the highlight back, I can just hit 'n' and it will come back. " " I don't know why it can't just be 'noh' and why I have to do this feedkeys " nonsense, but there appears to be a bug of some kind. autocmd InsertLeave * call feedkeys("\noh\") autocmd TextYankPost * \ lua require'vim.highlight'.on_yank( \ { higroup = "IncSearch", timeout = 100 }); augroup END " Local configuration that can be set by hostname or just a local configuration. " Local files are ignored by .gitignore so they won't be added to the repo, " allowing local (*cough* work) configuration to be separate from general " configuration. if isdirectory(printf('%s/.config/nvim/%s', $HOME, hostname)) exec "set rtp+=" . printf('%s/.config/nvim/%s', $HOME, hostname) endif if isdirectory(printf('%s/.config/nvim/local', $HOME)) exec "set rtp+=" . printf('%s/.config/nvim/local', $HOME) endif if filereadable(printf('%s/.config/nvim/%s.vim', $HOME, hostname)) exec "source " . printf('%s/.config/nvim/%s.vim', $HOME, hostname) endif if filereadable(printf('%s/.config/nvim/local.vim', $HOME)) exec "source " . printf('%s/.config/nvim/local.vim', $HOME) endif if isdirectory(printf('%s/.config/nvim/after', $HOME)) exec "set rtp+=" . printf('%s/.config/nvim/after', $HOME) endif noremap nt NvimTreeToggle noremap :e =escape(expand('%:h'), ' \')/ noremap . lua require('windownav').goto_terminal() noremap I lua require('windownav').goto_initvim() noremap ' lua require('windownav').goto_lastwin() nnoremap termstartinsert nnoremap TERMstartinsert nnoremap nnoremap Telescope buffers nnoremap bnext nnoremap bprev noremap lua vim.diagnostic.open_float() noremap WarpGrid onoremap vWarpGrid noremap w WarpWords onoremap w vWarpWords noremap lua require('warp').run(require('warp.strategy.words').words_strategy) onoremap vlua require('warp').run(require('warp.strategy.words').words_strategy) nmap œ k nmap ï j omap œ k omap ï j omap aœ ak omap aï aj omap iœ ik omap iï ij vmap œ k vmap ï j " test a thing here ααααααααααααααβααααααααααααααααααααααααααααααααααααααα noremap TSNodeUnderCursor noremap TSCaptureUnderCursor " Greek capital tau (τ) noremap Τ Inspect command! Config edit $HOME/.config/nvim/init.vim command! Configl edit $HOME/.config/nvim/local.vim cnoreabbrev _config expand("$HOME/.config/nvim") cnoreabbrev _plugged expand("$HOME/.local/share/nvim/plugged") cnoreabbrev _fm expand("$HOME/.local/share/nvim/plugged/fieldmarshal.vim") cnoreabbrev _home expand("$HOME/.local/share/nvim") cnoreabbrev _projects expand("$HOME/Projects") cnoreabbrev _ escape(expand('%:h'), ' \') set textwidth=80 set colorcolumn=+1 if has('rneovim') " call HighlightColorColumns() " " Grey color column right after text width is grey and in the background and " " a red one after the text width which is red and in the foreground. " set colorcolumn=+1/│/MyColorColumn/b,+20/│/MyRedColorColumn/f endif " Opens a terminal in the directory of the current file. command! TERM exec "term sh -c " . shellescape(printf("cd %s && exec ", shellescape(expand('%:p:h')))) . '$SHELL' " W = w. I often click when typing :w command! W w augroup lualine_augroup autocmd! autocmd User LspProgressStatusUpdated lua require("lualine").refresh() augroup END lua << EOF function remove_package(str) for k, v in pairs(package.loaded) do if string.match(k, "^" .. str) then package.loaded[k] = nil end end end function reload_package(str) remove_package(str) return require(str) end -- CiderLSP vim.opt.completeopt = { "menu", "menuone", "noselect" } require("lualine").setup({ sections = { lualine_a = { "mode" }, lualine_b = { "filename" }, lualine_c = { } } }) require("lsp") require("lspconfig") require("tabby") -- Diagnostics require("diagnostics") require("nvim-tree").setup() require("treesitter-textobjects-setup") require('telescope').setup({ defaults = { title = "", borderchars = { " ", " ", " ", " ", " ", " ", " ", " " }, prompt_prefix = '🞂 ', selection_caret = '🞂 ', layout_strategy = "center", results_title = false, sorting_strategy = "ascending", -- path_display = "shorten", layout_config = { center = { width = 0.5, height = 0.5, }, -- other layout configuration here }, -- other defaults configuration here }, -- other configuration values here }) require("virt-column").setup({ char = '│', highlight = "MyColorColumn" }) vim.fn.HighlightColorColumns() EOF