diff --git a/neovim/after/plugin/nvim-lint.vim b/neovim/after/plugin/nvim-lint.vim new file mode 100644 index 0000000..0407708 --- /dev/null +++ b/neovim/after/plugin/nvim-lint.vim @@ -0,0 +1,11 @@ +lua << EOF +require('lint').linters_by_ft = { + markdown = {'vale',}, + html = {'tidy',}, + vim = {'vint',}, + yaml = {'yamllint'}, +} +EOF + +" Run linting after buffer write +au BufWritePost lua require('lint').try_lint() diff --git a/neovim/after/plugin/nvim-web-devicons.vim b/neovim/after/plugin/nvim-web-devicons.vim new file mode 100644 index 0000000..a016a64 --- /dev/null +++ b/neovim/after/plugin/nvim-web-devicons.vim @@ -0,0 +1,5 @@ +lua << EOF +require'nvim-web-devicons'.setup { + default = true; +} +EOF diff --git a/neovim/after/plugin/telescope.nvim.vim b/neovim/after/plugin/telescope.nvim.vim new file mode 100644 index 0000000..ceef32d --- /dev/null +++ b/neovim/after/plugin/telescope.nvim.vim @@ -0,0 +1,14 @@ +lua << EOF +local actions = require("telescope.actions") +local trouble = require("trouble.providers.telescope") +require('telescope').setup { + defaults = { + mappings = { + i = { [""] = trouble.open_with_trouble }, + n = { [""] = trouble.open_with_trouble }, + }, + }, +} + +require('telescope').load_extension('fzf') +EOF diff --git a/neovim/after/plugin/trouble.nvim.vim b/neovim/after/plugin/trouble.nvim.vim new file mode 100644 index 0000000..3da9c2a --- /dev/null +++ b/neovim/after/plugin/trouble.nvim.vim @@ -0,0 +1,5 @@ +lua << EOF +require("trouble").setup { + -- empty = default settings +} +EOF diff --git a/neovim/after/plugin/vim-gitgutter.vim b/neovim/after/plugin/vim-gitgutter.vim new file mode 100644 index 0000000..df6c702 --- /dev/null +++ b/neovim/after/plugin/vim-gitgutter.vim @@ -0,0 +1,2 @@ +" Let other signs (e.g. linter errors) take precedence over gitgutter +let g:gitgutter_sign_allow_clobber = 0 diff --git a/neovim/after/plugin/vimtex.vim b/neovim/after/plugin/vimtex.vim new file mode 100644 index 0000000..d45a0ea --- /dev/null +++ b/neovim/after/plugin/vimtex.vim @@ -0,0 +1,3 @@ +" If the format cannot be determined, use this. +let g:tex_flavor = "latex" +let g:vimtex_view_method = 'zathura' diff --git a/neovim/init.vim b/neovim/init.vim index e231136..cff2a31 100644 --- a/neovim/init.vim +++ b/neovim/init.vim @@ -4,28 +4,46 @@ call plug#begin('~/.local/share/nvim/plugged') " Key usability plugins " ============================================================================= -" FZF Fuzzy Search -Plug 'junegunn/fzf', { 'dir': '~/.fzf' } -Plug 'junegunn/fzf.vim' +" FZF Native for Telescope +Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } " Floating terminal support for Neovim Plug 'voldikss/vim-floaterm' -" Neovim LSP -Plug 'neovim/nvim-lspconfig' - -" Treesitter -Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} - " Plenary - lua components used by other plugins Plug 'nvim-lua/plenary.nvim' +" Neovim LSP +Plug 'neovim/nvim-lspconfig' + " Completion Plug 'hrsh7th/cmp-nvim-lsp' " Builtin LSP as a completion source Plug 'hrsh7th/cmp-path' " Support for path as a completion source Plug 'hrsh7th/cmp-buffer' " Support for loaded buffers as completion source Plug 'hrsh7th/nvim-cmp' " Primary plugin +" Treesitter +Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + +" telescope.nvim +" Gaze deeply into unknown regions using the power of the moon. +Plug 'nvim-telescope/telescope.nvim' + +" trouble.nvim +" A pretty list for showing diagnostics, references, telescope results, quickfix +" and location lists to help you solve all the trouble your code is causing. +Plug 'folke/trouble.nvim' + +" nvim-lint (compatible with Neovim LSP) +" nvim-lint is meant to fill the gaps for languages where either no language +" server exists, or where standalone linters provide better results than the +" available language server do. +Plug 'mfussenegger/nvim-lint' + +" vim-gitgutter +" A Vim plugin which shows a git diff in the sign column. +Plug 'airblade/vim-gitgutter' + " ============================================================================= " Languages and project type support. " ============================================================================= @@ -46,6 +64,9 @@ Plug 'ziglang/zig.vim', { 'for': ['zig'] } " Note: Metals should not be configured with the other LSP items. Plug 'scalameta/nvim-metals', { 'for': ['scala', 'sbt'] } +" LaTeX Support +Plug 'lervag/vimtex', { 'for': ['tex'] } + " ============================================================================= " Visual enhancements " ============================================================================= @@ -53,14 +74,22 @@ Plug 'scalameta/nvim-metals', { 'for': ['scala', 'sbt'] } Plug 'sainnhe/gruvbox-material' " Plug 'rebelot/kanagawa.nvim' +Plug 'kyazdani42/nvim-web-devicons' +Plug 'folke/lsp-colors.nvim' + call plug#end() " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ filetype plugin indent on -syntax on -let mapleader="," -let maplocalleader="," + +" Only allow syntax to be set once. +if !exists('g:syntax_on') + syntax enable +endif + +let mapleader=',' +let maplocalleader=',' " === Color Scheme === {{ set termguicolors @@ -80,7 +109,6 @@ set undodir=~/.config/nvim/undo " === Assorted Core Settings === {{ set noswapfile -set nocompatible set modelines=0 set hidden " Hide buffers set encoding=utf-8 " Always use UTF-8 explicitly @@ -100,6 +128,8 @@ set colorcolumn=80 " Right margin display set shortmess-=F " Ensure audocmd works for filetype set shortmess+=c " Avoid showing extra message when using completion set spelllang=en_us +set signcolumn=yes +set updatetime=200 " }} " === Basic Completion Settings === {{ @@ -135,10 +165,6 @@ set wildignore+=*/.metals/*,*/.bloop/*,*/.bsp/* set wildignore+=*/node_modules/* " }} -" === FZF Configuration === {{ -let $FZF_DEFAULT_COMMAND='rg --files --no-messages "" .' -" }} - " === Key Mappings === {{ " Use Tab and Shift+Tab to navigate popup menus @@ -166,8 +192,23 @@ nmap ; :Buffers " Press Ctrl+P to show a list of files (+ fuzzy search) nmap :Files -" Press + f to use ripgrep for search -nmap f :Rg +" Telescope Bindings (e.g. file and buffer search) +nnoremap Telescope find_files +nnoremap ; Telescope buffers +nnoremap fg Telescope live_grep +nnoremap fh Telescope help_tags + +" Trouble bindings +nnoremap xx TroubleToggle +nnoremap xw TroubleToggle workspace_diagnostics +nnoremap xd TroubleToggle document_diagnostics +nnoremap xq TroubleToggle quickfix +nnoremap xl TroubleToggle loclist +nnoremap gR TroubleToggle lsp_references + +" gitgutter bindings +nmap ]h (GitGutterNextHunk) +nmap [h (GitGutterPrevHunk) " LSP key bindings nnoremap K lua vim.lsp.buf.hover() @@ -191,13 +232,6 @@ map h map l " }} -" === JSON Support === {{ - -" Properly handle comments in JSON. -autocmd FileType json syntax match Comment +\/\/.\+$+ - -" }} - " === netrw === {{ let g:netrw_banner = 0 let g:netrw_liststyle = 3 @@ -260,6 +294,7 @@ end local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) +-- zls = zig language server lsp.zls.setup { on_attach = on_attach, flags = { @@ -268,6 +303,9 @@ lsp.zls.setup { capabilities = capabilities } +-- texlab = latex language server +lsp.texlab.setup{} + -- Note that metals is totally separate. -- It's also absurdly slow on a Raspberry Pi, it's only viable for somewhat -- powerful machines (as is Scala dev in general). diff --git a/neovim/json.vim b/neovim/json.vim new file mode 100644 index 0000000..545e3a0 --- /dev/null +++ b/neovim/json.vim @@ -0,0 +1,6 @@ +" === JSON Support === {{ + +" Properly handle comments in JSON. +autocmd FileType json syntax match Comment +\/\/.\+$+ + +" }} diff --git a/neovim/tex.vim b/neovim/tex.vim new file mode 100644 index 0000000..e0e3c72 --- /dev/null +++ b/neovim/tex.vim @@ -0,0 +1,9 @@ +" === Tex / LaTeX Support === {{ + +" Default tex flavor to use if not detected. +let g:tex_flavor = "latex" + +" Zathura is a minimal PDF viewer with Vim bindings. +let g:vimtex_view_method = 'zathura' + +" }} diff --git a/shell/bashrc b/shell/bashrc index f4a480f..245b398 100644 --- a/shell/bashrc +++ b/shell/bashrc @@ -48,6 +48,11 @@ else fi fi +# ============================================================================= +# Common Environment Configuration +# ============================================================================= +export EDITOR=vim + # ============================================================================= # PATH # ============================================================================= @@ -55,6 +60,10 @@ if [ -d "$HOME/bin" ]; then export PATH="$HOME/bin:$PATH" fi +if [ -d "$HOME/.local/bin" ]; then + export PATH="$HOME/.local/bin:$PATH" +fi + if [ -f "$HOME/.cargo/env" ]; then source "$HOME/.cargo/env" fi @@ -120,3 +129,10 @@ else echo "[warn] Neovim is not setup! Using the system vim" >> $log_file fi fi + +# ============================================================================= +# Scala/SBT Setup +# ============================================================================= +if command -v sbt > /dev/null 2>&1; then + export SBT_OPTS="-XX:+UseG1GC -Xmx2048m" +fi diff --git a/xresources/Xresources b/xresources/Xresources index 3157c5c..4112546 100644 --- a/xresources/Xresources +++ b/xresources/Xresources @@ -1,7 +1,7 @@ -*.font: xft:Iosevka Term:style=Regular:size=13 -*.boldFont: xft:Iosevka Term:style=Bold:size=13 -*.italicFont: xft:Iosevka Term:style=Italic:size=13 -*.boldItalicFont: xft:Iosevka Term:style=Bold Italic:size=13 +*.font: xft:Iosevka Nerd Font Mono:style=Regular:size=13 +*.boldFont: xft:Iosevka Nerd Font Mono:style=Bold:size=13 +*.italicFont: xft:Iosevka Nerd Font Mono:style=Italic:size=13 +*.boldItalicFont: xft:Iosevka Nerd Font Mono:style=Bold Italic:size=13 ! Colors ! hard contrast: *background: #1d2021