Compare commits
No commits in common. "main" and "a5acc941691c919b8d8c062972ec10bd77b2c7fa" have entirely different histories.
main
...
a5acc94169
24 changed files with 319 additions and 423 deletions
|
@ -1 +0,0 @@
|
||||||
vim.g.rustfmt_autosave = 1
|
|
16
ftplugin/java.vim
Normal file
16
ftplugin/java.vim
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
let g:JavaImpDataDir = $HOME . "/.vim/JavaImp"
|
||||||
|
|
||||||
|
" F7 to call clean redundant Java imports and sort them
|
||||||
|
function JavaImpClean()
|
||||||
|
%!~/bin/clean_imports.sh %
|
||||||
|
:JavaImpSort
|
||||||
|
endfunction
|
||||||
|
:command JavaImpClean exec JavaImpClean()
|
||||||
|
:nnoremap <F7> :JavaImpClean<CR>
|
||||||
|
|
||||||
|
"let makeprg = 'java -cp /opt/boxen/homebrew/opt/checkstyle/libexec/checkstyle-6.0-all.jar -c '. vimrc_git . '/checkstyle.xml %:p'
|
||||||
|
let makeprg = 'checkstyle -c '. vimrc_git . '/checkstyle.xml ./%'
|
||||||
|
|
||||||
|
let &makeprg=escape(makeprg, ' ')
|
||||||
|
setlocal errorformat=%f:%l:\ %m,%f:%l:%v:\ %m,%-G%.%#
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
vim.cmd('setlocal fdm=indent')
|
|
||||||
vim.cmd('setlocal smartindent')
|
|
||||||
vim.cmd('setlocal list')
|
|
3
ftplugin/javascript.vim
Normal file
3
ftplugin/javascript.vim
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
setlocal fdm=indent
|
||||||
|
setlocal smartindent
|
||||||
|
setlocal list
|
|
@ -1,16 +0,0 @@
|
||||||
-- set a smaller indent
|
|
||||||
local indent = 2
|
|
||||||
vim.opt.tabstop = indent
|
|
||||||
vim.opt.shiftwidth = indent
|
|
||||||
vim.opt.softtabstop = indent
|
|
||||||
|
|
||||||
-- don't hard break text
|
|
||||||
vim.opt.textwidth = 0
|
|
||||||
-- keep soft breaks between words
|
|
||||||
vim.cmd('setlocal linebreak')
|
|
||||||
-- turn list off as it interferes with soft wrapping
|
|
||||||
vim.cmd('setlocal nolist')
|
|
||||||
-- turn off breaking when typing new text
|
|
||||||
vim.cmd('setlocal formatoptions-=t')
|
|
||||||
-- turn off line width hint
|
|
||||||
vim.cmd('setlocal colorcolumn=0')
|
|
8
ftplugin/markdown.vim
Normal file
8
ftplugin/markdown.vim
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
" set a smaller indent
|
||||||
|
setlocal ts=2
|
||||||
|
|
||||||
|
" and set up the buffer just like a text file
|
||||||
|
let oldwd = getcwd()
|
||||||
|
exec "cd ~/.config/nvim/ftplugin"
|
||||||
|
source text.vim
|
||||||
|
exec "cd " . oldwd
|
1
ftplugin/rust.vim
Normal file
1
ftplugin/rust.vim
Normal file
|
@ -0,0 +1 @@
|
||||||
|
let g:rustfmt_autosave = 1
|
1
ftplugin/scala.vim
Normal file
1
ftplugin/scala.vim
Normal file
|
@ -0,0 +1 @@
|
||||||
|
au BufWrite * :Autoformat
|
|
@ -1,10 +0,0 @@
|
||||||
-- don't hard break text
|
|
||||||
vim.opt.textwidth = 0
|
|
||||||
-- keep soft breaks between words
|
|
||||||
vim.cmd('setlocal linebreak')
|
|
||||||
-- turn list off as it interferes with soft wrapping
|
|
||||||
vim.cmd('setlocal nolist')
|
|
||||||
-- turn off breaking when typing new text
|
|
||||||
vim.cmd('setlocal formatoptions-=t')
|
|
||||||
-- turn off line width hint
|
|
||||||
vim.cmd('setlocal colorcolumn=0')
|
|
10
ftplugin/text.vim
Normal file
10
ftplugin/text.vim
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
" don't hard break text
|
||||||
|
setlocal tw=0
|
||||||
|
" keep soft breaks between words
|
||||||
|
setlocal linebreak
|
||||||
|
" turn list off as it interferes with soft wrapping
|
||||||
|
setlocal nolist
|
||||||
|
" turn off breaking when typing new text
|
||||||
|
setlocal formatoptions-=t
|
||||||
|
" turn off line width hint
|
||||||
|
setlocal colorcolumn=0
|
|
@ -1,11 +0,0 @@
|
||||||
vim.g.neoformat_try_node_exe = 1
|
|
||||||
|
|
||||||
-- set a smaller indent
|
|
||||||
local indent = 2
|
|
||||||
vim.opt.tabstop = indent
|
|
||||||
vim.opt.shiftwidth = indent
|
|
||||||
vim.opt.softtabstop = indent
|
|
||||||
|
|
||||||
vim.cmd('setlocal fdm=indent')
|
|
||||||
vim.cmd('setlocal smartindent')
|
|
||||||
vim.cmd('setlocal list')
|
|
1
ftplugin/typescript.vim
Normal file
1
ftplugin/typescript.vim
Normal file
|
@ -0,0 +1 @@
|
||||||
|
au BufWrite * :Autoformat
|
|
@ -1 +0,0 @@
|
||||||
markdown.vim
|
|
141
init.lua
141
init.lua
|
@ -1,141 +0,0 @@
|
||||||
local vimrc_git = os.getenv("HOME") .. "/src/vimrc"
|
|
||||||
-- add to package path to allow use of require() for lua modules
|
|
||||||
package.path = string.format("%s;%s?.lua", package.path, vimrc_git.."/")
|
|
||||||
|
|
||||||
-- it is a big fat key, after all
|
|
||||||
-- N.B. should come before plugins and plugin specific settings
|
|
||||||
vim.g.mapleader = ' '
|
|
||||||
|
|
||||||
require("plug")
|
|
||||||
--vim.cmd("source " .. vimrc_git .. "/plug.lua")
|
|
||||||
vim.cmd("source " .. vimrc_git .. "/airline.vim")
|
|
||||||
vim.cmd("source " .. vimrc_git .. "/lsp.vim")
|
|
||||||
require("mapping")
|
|
||||||
--vim.cmd("source " .. vimrc_git .. "/mapping.lua")
|
|
||||||
vim.cmd("source " .. vimrc_git .. "/fzf.vim")
|
|
||||||
vim.cmd("source " .. vimrc_git .. "/jsonnet.vim")
|
|
||||||
vim.cmd("source " .. vimrc_git .. "/nerdtree.vim")
|
|
||||||
vim.cmd("source " .. vimrc_git .. "/wiki.vim")
|
|
||||||
|
|
||||||
if vim.g.neovide then
|
|
||||||
require("size-matters")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- set up a line number on the current line but relative above and below to
|
|
||||||
-- help with motion commands
|
|
||||||
vim.opt.number = true
|
|
||||||
vim.opt.numberwidth = 2
|
|
||||||
vim.opt.relativenumber = true
|
|
||||||
|
|
||||||
-- even with the nice space/tab autodetect, prefer 4 for tab stops but let file
|
|
||||||
-- type specifics override (for instance a setting of 2 for markdown
|
|
||||||
vim.opt.tabstop = 4
|
|
||||||
-- default to folding on syntax
|
|
||||||
vim.opt.foldmethod = "syntax"
|
|
||||||
-- disable automatic line breaks, rely on visual wrapping instead
|
|
||||||
vim.opt.textwidth = 0
|
|
||||||
-- make white space visible, where that matters
|
|
||||||
vim.opt.list = true
|
|
||||||
|
|
||||||
local function nolist()
|
|
||||||
vim.opt.list = false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- make white space invisible only in help text
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
pattern = "help",
|
|
||||||
callback = nolist,
|
|
||||||
})
|
|
||||||
-- set up folding preferences
|
|
||||||
vim.opt.fde = "1"
|
|
||||||
-- vim's spelling is smart enough for code, to only check comments
|
|
||||||
vim.opt.spell = true
|
|
||||||
-- add a hint for long lines
|
|
||||||
vim.opt.colorcolumn = "120"
|
|
||||||
-- default to expanding tabs, I'm not insane
|
|
||||||
vim.opt.expandtab = true
|
|
||||||
|
|
||||||
-- change buffer behaviors to no longer require changes when hiding a buffer
|
|
||||||
vim.opt.hidden = true
|
|
||||||
|
|
||||||
-- look for vimrc in the current directory as well as $MYVIMRC
|
|
||||||
-- e.g. place .init.lua at the root of a project directory for project specific settings
|
|
||||||
vim.opt.exrc = true
|
|
||||||
-- make looking for local changes secure
|
|
||||||
vim.opt.secure = true
|
|
||||||
-- more secure
|
|
||||||
vim.opt.modelines = 0
|
|
||||||
-- preserve some context
|
|
||||||
vim.opt.scrolloff = 3
|
|
||||||
-- make the cursor a bit easier to follows
|
|
||||||
vim.opt.cursorline = true
|
|
||||||
-- make search work a bit more like tab completion in bash
|
|
||||||
vim.opt.incsearch = true
|
|
||||||
vim.opt.wildmode = "longest:full"
|
|
||||||
vim.opt. wildmenu = true
|
|
||||||
-- line break handling
|
|
||||||
vim.opt.linebreak = true
|
|
||||||
vim.opt.showbreak = "+"
|
|
||||||
-- always on status line
|
|
||||||
vim.opt.laststatus = 2
|
|
||||||
|
|
||||||
-- let backspace work more naturally
|
|
||||||
vim.opt.backspace = "start,indent,eol"
|
|
||||||
-- favor modern encoding
|
|
||||||
vim.opt.enc = "utf-8"
|
|
||||||
-- more readable config for list mode
|
|
||||||
vim.opt.listchars = {nbsp = '¬', tab = '»·', trail = '·'}
|
|
||||||
-- smarter handling of case during search
|
|
||||||
vim.opt.ignorecase = true
|
|
||||||
vim.opt.smartcase = true
|
|
||||||
-- centralize swap to have backup without clutter
|
|
||||||
vim.opt.directory = os.getenv("HOME") .. "/.var/nvim/swp//"
|
|
||||||
-- and undo
|
|
||||||
vim.opt.undofile = true
|
|
||||||
vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir"
|
|
||||||
|
|
||||||
-- save when moving away
|
|
||||||
vim.api.nvim_create_autocmd("FocusLost", {pattern = "*", command = "wa"})
|
|
||||||
|
|
||||||
-- make sure to set TERM to xterm-256color in terminal program or app
|
|
||||||
vim.opt.background = "dark"
|
|
||||||
vim.opt.termguicolors = true
|
|
||||||
vim.cmd("colorscheme breezy")
|
|
||||||
vim.g.airline_theme = "breezy"
|
|
||||||
|
|
||||||
-- ensure autoread works, to detect file changes outside the editor
|
|
||||||
vim.opt.autoread = true
|
|
||||||
vim.api.nvim_create_autocmd("CursorHold", {pattern = "*", command = "checktime"})
|
|
||||||
|
|
||||||
-- for gui, make it easier to tell different instances apart
|
|
||||||
vim.opt.title = true
|
|
||||||
|
|
||||||
-- keep nvim from resetting font back to default from terminal config
|
|
||||||
vim.opt.guicursor = nil
|
|
||||||
|
|
||||||
local guiopts = vim.g.guioptions
|
|
||||||
if guiopts == nil then
|
|
||||||
guiopts = ""
|
|
||||||
end
|
|
||||||
guiopts = guiopts:gsub("r", "")
|
|
||||||
guiopts = guiopts:gsub("b", "")
|
|
||||||
guiopts = guiopts:gsub("T", "")
|
|
||||||
guiopts = guiopts:gsub("m", "")
|
|
||||||
|
|
||||||
vim.g.guioptions = guiopts
|
|
||||||
|
|
||||||
vim.opt.mouse = "nv"
|
|
||||||
|
|
||||||
if vim.loop.os_uname().sysname == 'Linux' then
|
|
||||||
vim.opt.gfn = "FiraCode Nerd Font Mono:h12"
|
|
||||||
require('nvim-projectconfig').setup({autocmd=true})
|
|
||||||
else
|
|
||||||
vim.opt.gfn = "FiraCode Nerd Font Mono:h16"
|
|
||||||
require('nvim-projectconfig').setup()
|
|
||||||
end
|
|
||||||
|
|
||||||
require("trouble").setup {
|
|
||||||
-- your configuration comes here
|
|
||||||
-- or leave it empty to use the default settings
|
|
||||||
-- refer to the configuration section below
|
|
||||||
}
|
|
129
init.vim
Normal file
129
init.vim
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
" set the directory where vimrc git project is located
|
||||||
|
let vimrc_git=$HOME . "/src/vimrc"
|
||||||
|
|
||||||
|
" it is a big fat key, after all
|
||||||
|
" N.B. should come before plugins and plugin specific settings
|
||||||
|
let mapleader = "\<Space>"
|
||||||
|
|
||||||
|
" source aux files also under git control
|
||||||
|
let oldwd = getcwd()
|
||||||
|
exec "cd " . vimrc_git
|
||||||
|
source plug.vim
|
||||||
|
source airline.vim
|
||||||
|
source syntastic.vim
|
||||||
|
source fzf.vim
|
||||||
|
source rust.vim
|
||||||
|
source mapping.vim
|
||||||
|
source jsonnet.vim
|
||||||
|
source nerdtree.vim
|
||||||
|
exec "cd " . oldwd
|
||||||
|
|
||||||
|
" set up a line number on the current line but relative above and below to help
|
||||||
|
" with motion commands
|
||||||
|
set number
|
||||||
|
set relativenumber
|
||||||
|
|
||||||
|
" even with the nice space/tab autodetect, prefer 4 for tab stops
|
||||||
|
" but let file type specifics override (for instance a setting of 2 for markdown
|
||||||
|
set tabstop=4
|
||||||
|
" default to folding on syntax
|
||||||
|
set foldmethod=syntax
|
||||||
|
" disable automatic line breaks, rely on visual wrapping instead
|
||||||
|
set textwidth=0
|
||||||
|
" make white space visible, where that matters
|
||||||
|
set list!
|
||||||
|
" except for help
|
||||||
|
autocmd FileType help setlocal nolist
|
||||||
|
" set up folding preferences
|
||||||
|
set fde=1
|
||||||
|
" vim's spelling is smart enough for code, to only check comments
|
||||||
|
set spell
|
||||||
|
" add a hint for long lines
|
||||||
|
set colorcolumn=120
|
||||||
|
" default to expanding tabs, I'm not insane
|
||||||
|
set expandtab
|
||||||
|
|
||||||
|
" change buffer behaviors to no longer require changes when hiding a buffer
|
||||||
|
set hidden
|
||||||
|
|
||||||
|
" look for vimrc in the current director as well as $MYVIMRC
|
||||||
|
set exrc
|
||||||
|
" make looking for local changes secure
|
||||||
|
set secure
|
||||||
|
" more secure
|
||||||
|
set modelines=0
|
||||||
|
" preserve some context
|
||||||
|
set scrolloff=3
|
||||||
|
" make the cursor a bit easier to follows
|
||||||
|
set cursorline
|
||||||
|
" make search work a bit more like tab completion in bash
|
||||||
|
set incsearch
|
||||||
|
set wildmode=longest:full
|
||||||
|
set wildmenu
|
||||||
|
" line break handling
|
||||||
|
set linebreak
|
||||||
|
set showbreak=+
|
||||||
|
" always on status line
|
||||||
|
set laststatus=2
|
||||||
|
|
||||||
|
" let backspace work more naturally
|
||||||
|
set backspace=start,indent,eol
|
||||||
|
" favor modern encoding
|
||||||
|
set enc=utf-8
|
||||||
|
" more readable config for list mode
|
||||||
|
set listchars+=nbsp:¬,tab:»·,trail:·
|
||||||
|
set listchars-=eol:$
|
||||||
|
" smarter handling of case during search
|
||||||
|
set ignorecase
|
||||||
|
set smartcase
|
||||||
|
" centralize swap to have backup without clutter
|
||||||
|
set directory=$HOME/.var/nvim/swp//
|
||||||
|
" and undo
|
||||||
|
set undofile
|
||||||
|
set undodir=$HOME/.nvim/undodir
|
||||||
|
" make pastemode more accessible
|
||||||
|
set pastetoggle=<F2>
|
||||||
|
" save when moving away
|
||||||
|
au FocusLost * :wa
|
||||||
|
|
||||||
|
" make sure to set TERM to xterm-256color in terminal program or app
|
||||||
|
colorscheme breezy
|
||||||
|
set background=light
|
||||||
|
set termguicolors
|
||||||
|
|
||||||
|
" ensure autoread works, to detect file changes outside the editor
|
||||||
|
set autoread
|
||||||
|
au CursorHold * checktime
|
||||||
|
|
||||||
|
" for gui, make it easier to tell different instances apart
|
||||||
|
set title
|
||||||
|
|
||||||
|
" keep nvim from resetting font back to default from terminal config
|
||||||
|
set guicursor=
|
||||||
|
|
||||||
|
set guioptions-=r
|
||||||
|
set guioptions-=b
|
||||||
|
set guioptions-=T
|
||||||
|
set guioptions-=m
|
||||||
|
|
||||||
|
set gfn=DejaVu\ Sans\ Mono\ for\ Powerline:h13
|
||||||
|
" from https://stackoverflow.com/a/51424640
|
||||||
|
let s:fontsize = 13
|
||||||
|
function! AdjustFontSize(amount)
|
||||||
|
let s:fontsize = s:fontsize+a:amount
|
||||||
|
:execute "set gfn=DejaVu\\ Sans\\ Mono\\ for\\ Powerline:h" . s:fontsize
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
noremap <C-Up> :call AdjustFontSize(1)<CR>
|
||||||
|
noremap <C-Down> :call AdjustFontSize(-1)<CR>
|
||||||
|
inoremap <C-Up> <Esc>:call AdjustFontSize(1)<CR>a
|
||||||
|
inoremap <C-Down> <Esc>:call AdjustFontSize(-1)<CR>a
|
||||||
|
|
||||||
|
" override the default location of vimwiki and change to markdown
|
||||||
|
let g:vimwiki_list = [{'path': '~/Documents/Wiki', 'syntax': 'markdown', 'ext': '.md'}]
|
||||||
|
let g:vimwiki_dir_link = 'index'
|
||||||
|
|
||||||
|
let g:LanguageClient_serverCommands = {
|
||||||
|
\ 'rust': ['rust-analyzer'],
|
||||||
|
\ }
|
||||||
|
|
74
mapping.lua
74
mapping.lua
|
@ -1,74 +0,0 @@
|
||||||
-- from: https://sharksforarms.dev/posts/neovim-rust/
|
|
||||||
-- Set completeopt to have a better completion experience
|
|
||||||
-- :help completeopt
|
|
||||||
-- menuone: popup even when there's only one match
|
|
||||||
-- noinsert: Do not insert text until a selection is made
|
|
||||||
-- noselect: Do not select, force user to select one from the menu
|
|
||||||
vim.opt.completeopt = "menuone,noinsert,noselect"
|
|
||||||
|
|
||||||
-- Avoid showing extra messages when using completion
|
|
||||||
vim.opt.shortmess:append('c')
|
|
||||||
|
|
||||||
-- extend timeout to allow time for three character shortcuts
|
|
||||||
vim.opt.timeoutlen = 2500
|
|
||||||
|
|
||||||
local opts = { noremap = true, silent = true }
|
|
||||||
|
|
||||||
-- toggle gundo's display
|
|
||||||
vim.keymap.set('n', '<F5>', vim.cmd.UndotreeToggle)
|
|
||||||
-- quickly toggle a left, vsplit for an insanely powerful file explorer
|
|
||||||
vim.keymap.set('n', '<F8>', vim.cmd.NERDTreeToggle)
|
|
||||||
vim.keymap.set('n', '<F9>', vim.cmd.NERDTreeFind)
|
|
||||||
-- use similar key, esc, to exit terminal mode
|
|
||||||
vim.cmd("tnoremap <C-Space><Esc> <C-\\><C-n>")
|
|
||||||
|
|
||||||
-- Code navigation shortcuts
|
|
||||||
-- from https://github.com/neovim/nvim-lspconfig/blob/master/test/minimal_init.lua#L34
|
|
||||||
vim.keymap.set('n', '<Leader>ga', vim.lsp.buf.code_action)
|
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration)
|
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition)
|
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover)
|
|
||||||
vim.keymap.set('n', '<Leader>gi', vim.lsp.buf.implementation)
|
|
||||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help)
|
|
||||||
-- vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
|
||||||
-- vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>D', vim.lsp.buf.type_definition)
|
|
||||||
vim.keymap.set('n', '<Leader>nr', vim.lsp.buf.rename)
|
|
||||||
vim.keymap.set('n', '<Leader>gr', vim.lsp.buf.references)
|
|
||||||
vim.keymap.set('n', '<Leader>e', vim.diagnostic.open_float)
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>q', vim.diagnostic.setloclist)
|
|
||||||
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<Leader>xx', vim.cmd.TroubleToggle, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>xw', function()
|
|
||||||
vim.cmd("TroubleToggle workspace_diagnostics")
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>xd', function()
|
|
||||||
vim.cmd("TroubleToggle workspace_diagnostics")
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>xq', function()
|
|
||||||
vim.cmd("TroubleToggle quickfix")
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>xl', function()
|
|
||||||
vim.cmd("TroubleToggle loclist")
|
|
||||||
end, opts)
|
|
||||||
-- work with Trouble to view lists of diagnostic warnings/errors
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<Leader>wt', function()
|
|
||||||
vim.cmd("e ~/Documents/Wiki/tags.md")
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>tr', vim.cmd.VimwikiRebuildTags, opts)
|
|
||||||
vim.keymap.set('n', '<Leader>tg', vim.cmd.VimwikiGenerateTagLinks, opts)
|
|
||||||
|
|
||||||
-- TODO translate to lua
|
|
||||||
--function! VimwikiFindAllIncompleteTasks()
|
|
||||||
-- lvimgrep /- \[ \]/ *
|
|
||||||
-- lopen
|
|
||||||
--endfunction
|
|
||||||
|
|
||||||
--nmap <Leader>wa :call VimwikiFindAllIncompleteTasks()<CR>
|
|
31
mapping.vim
Normal file
31
mapping.vim
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
" quickly clear Syntastic info
|
||||||
|
nmap <F4> :SyntasticReset<CR>
|
||||||
|
" toggle gundo's display
|
||||||
|
nmap <F5> :UndotreeToggle<CR>
|
||||||
|
" quickly toggle a right, vsplit for viewing, navigating whatever structure easy
|
||||||
|
" tags/tagbar can figure out for the current buffer
|
||||||
|
nmap <F9> :TagbarToggle<CR>
|
||||||
|
" quickly toggle a left, vsplit for an insanely powerful file explorer
|
||||||
|
nmap <F8> :NERDTreeToggle<CR>
|
||||||
|
" open tree to current buffer
|
||||||
|
nmap <S-F8> :NERDTreeFind<CR>
|
||||||
|
" use similar key, esc, to exit terminal mode
|
||||||
|
tnoremap <C-Space><Esc> <C-\><C-n>
|
||||||
|
|
||||||
|
" from: https://sharksforarms.dev/posts/neovim-rust/
|
||||||
|
" Code navigation shortcuts
|
||||||
|
nnoremap <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR>
|
||||||
|
nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
|
||||||
|
nnoremap <silent> gD <cmd>lua vim.lsp.buf.implementation()<CR>
|
||||||
|
nnoremap <silent> <c-k> <cmd>lua vim.lsp.buf.signature_help()<CR>
|
||||||
|
nnoremap <silent> 1gD <cmd>lua vim.lsp.buf.type_definition()<CR>
|
||||||
|
nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>
|
||||||
|
nnoremap <silent> g0 <cmd>lua vim.lsp.buf.document_symbol()<CR>
|
||||||
|
nnoremap <silent> gW <cmd>lua vim.lsp.buf.workspace_symbol()<CR>
|
||||||
|
nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>
|
||||||
|
nnoremap <silent> ga <cmd>lua vim.lsp.buf.code_action()<CR>
|
||||||
|
nnoremap <silent> <Leader>rn <cmd>lua vim.lsp.buf.rename()<CR>
|
||||||
|
|
||||||
|
" Goto previous/next diagnostic warning/error
|
||||||
|
nnoremap <silent> g[ <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
|
||||||
|
nnoremap <silent> g] <cmd>lua vim.lsp.diagnostic.goto_next()<CR>
|
108
plug.lua
108
plug.lua
|
@ -1,108 +0,0 @@
|
||||||
local vim = vim
|
|
||||||
local Plug = vim.fn['plug#']
|
|
||||||
|
|
||||||
vim.call('plug#begin')
|
|
||||||
|
|
||||||
-- I try to keep these to a minimum and to understand what each plugin does and
|
|
||||||
-- adds to my existing(set up. I try to capture the value, at least to me, each
|
|
||||||
-- plugin adds. I've tried to logically group them, as well, to spot overlap
|
|
||||||
-- and redundancy.
|
|
||||||
|
|
||||||
-- dynamic font resizing(using ctl and arrow keys
|
|
||||||
Plug('tenxsoydev/size-matters.nvim')
|
|
||||||
|
|
||||||
-- custom colorscheme
|
|
||||||
Plug('fneu/breezy')
|
|
||||||
|
|
||||||
|
|
||||||
-- informational
|
|
||||||
-- lightweight but sophisticated status line
|
|
||||||
Plug('vim-airline/vim-airline')
|
|
||||||
Plug('vim-airline/vim-airline-themes')
|
|
||||||
-- visualize vim's undo tree
|
|
||||||
Plug('mbbill/undotree')
|
|
||||||
-- diagnostics display
|
|
||||||
Plug('folke/trouble.nvim')
|
|
||||||
-- icons for Trouble
|
|
||||||
Plug('kyazdani42/nvim-web-devicons')
|
|
||||||
|
|
||||||
|
|
||||||
-- files, folders, projects, etc.
|
|
||||||
-- file and dir browser
|
|
||||||
Plug('preservim/nerdtree')
|
|
||||||
-- integrate ripgrep, especially to be able to open matches, hugely useful for
|
|
||||||
-- code aware search
|
|
||||||
Plug('jremmen/vim-ripgrep')
|
|
||||||
-- Support for the cd replacement, zoxide
|
|
||||||
Plug('nanotee/zoxide.vim')
|
|
||||||
-- taskwarrior
|
|
||||||
Plug('xarthurx/taskwarrior.vim')
|
|
||||||
-- Wiki support - my life is in vimwiki
|
|
||||||
Plug('vimwiki/vimwiki', { ['branch'] = 'dev' })
|
|
||||||
|
|
||||||
|
|
||||||
-- git integration
|
|
||||||
Plug('tpope/vim-fugitive')
|
|
||||||
Plug('tpope/vim-rhubarb')
|
|
||||||
Plug('mhinz/vim-signify')
|
|
||||||
-- git support for nerdtree
|
|
||||||
Plug('Xuyuanp/nerdtree-git-plugin')
|
|
||||||
-- better support for JS
|
|
||||||
Plug('pangloss/vim-javascript')
|
|
||||||
-- find, complete, etc. on steroids
|
|
||||||
-- fast fuzzy finder
|
|
||||||
Plug('junegunn/fzf', { ['dir'] = '~/.fzf', ['do'] = function()
|
|
||||||
vim.fn['fzf#install']()
|
|
||||||
end })
|
|
||||||
Plug('junegunn/fzf.vim')
|
|
||||||
-- auto detect tab and space handling(rather than setting per project
|
|
||||||
Plug('tpope/vim-sleuth')
|
|
||||||
|
|
||||||
|
|
||||||
-- tools - all languages
|
|
||||||
-- look for .editorconfig(and merge into vim settings
|
|
||||||
Plug('editorconfig/editorconfig-vim')
|
|
||||||
-- auto format all the things
|
|
||||||
Plug('sbdchd/neoformat')
|
|
||||||
-- load config(from $CWD/.config/init.vim
|
|
||||||
Plug('windwp/nvim-projectconfig')
|
|
||||||
|
|
||||||
-- Collection of common configurations for the Nvim LSP client
|
|
||||||
Plug('neovim/nvim-lspconfig')
|
|
||||||
-- Add commands to add and manage lsp plugins
|
|
||||||
Plug('williamboman/nvim-lsp-installer')
|
|
||||||
|
|
||||||
-- Completion framework
|
|
||||||
-- I found these when updating(my lsp configuration and after using the
|
|
||||||
-- additional sources for a while, find them super useful for general editing
|
|
||||||
-- too
|
|
||||||
-- See hrsh7th's other plugins for more completion sources!
|
|
||||||
Plug('hrsh7th/nvim-cmp')
|
|
||||||
-- LSP completion source for nvim-cmp
|
|
||||||
Plug('hrsh7th/cmp-nvim-lsp')
|
|
||||||
-- Snippet completion source for nvim-cmp
|
|
||||||
Plug('hrsh7th/cmp-vsnip')
|
|
||||||
-- Other useful completion sources
|
|
||||||
Plug('hrsh7th/cmp-path')
|
|
||||||
Plug('hrsh7th/cmp-buffer')
|
|
||||||
-- Snippet engine
|
|
||||||
Plug('hrsh7th/vim-vsnip')
|
|
||||||
|
|
||||||
-- allows other programs and scripts to hook into NeoVim's language server
|
|
||||||
-- protocol support; adopted as a pre-requisite for prettier integration
|
|
||||||
Plug('jose-elias-alvarez/null-ls.nvim')
|
|
||||||
|
|
||||||
-- specific languages, programming(and otherwise
|
|
||||||
|
|
||||||
-- support for the Rust programming(language
|
|
||||||
Plug('rust-lang/rust.vim')
|
|
||||||
-- handles Rust configuration for LSP
|
|
||||||
Plug('mrcjkb/rustaceanvim')
|
|
||||||
|
|
||||||
-- support for jsonnet
|
|
||||||
Plug('google/vim-jsonnet')
|
|
||||||
|
|
||||||
-- nvm to make JS/TS/Node easier to work with
|
|
||||||
Plug('marene/nvm.vim')
|
|
||||||
|
|
||||||
vim.call('plug#end')
|
|
80
plug.vim
Normal file
80
plug.vim
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
call plug#begin("~/.config/nvim/plugged")
|
||||||
|
|
||||||
|
" look for .editorconfig and merge into vim settings
|
||||||
|
Plug 'editorconfig/editorconfig-vim'
|
||||||
|
" file and dir browser
|
||||||
|
Plug 'preservim/nerdtree'
|
||||||
|
" git support for nerdtree
|
||||||
|
Plug 'Xuyuanp/nerdtree-git-plugin'
|
||||||
|
" syntax checking on steroids
|
||||||
|
Plug 'scrooloose/syntastic'
|
||||||
|
" integrate ripgrep, especially to be able to open matches, hugely useful for
|
||||||
|
" code aware search
|
||||||
|
Plug 'jremmen/vim-ripgrep'
|
||||||
|
" lightweight but sophisticated status line
|
||||||
|
Plug 'vim-airline/vim-airline'
|
||||||
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
|
" git integration
|
||||||
|
Plug 'tpope/vim-fugitive'
|
||||||
|
Plug 'tpope/vim-rhubarb'
|
||||||
|
Plug 'mhinz/vim-signify'
|
||||||
|
" visualize vim's undo tree
|
||||||
|
Plug 'mbbill/undotree'
|
||||||
|
" better support for JS
|
||||||
|
Plug 'pangloss/vim-javascript'
|
||||||
|
" find, complete, etc. on steroids
|
||||||
|
" fast fuzzy finder
|
||||||
|
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||||
|
Plug 'junegunn/fzf.vim'
|
||||||
|
" auto detect tab and space handling rather than setting per project
|
||||||
|
Plug 'tpope/vim-sleuth'
|
||||||
|
|
||||||
|
|
||||||
|
" support for the Rust programming language
|
||||||
|
Plug 'rust-lang/rust.vim'
|
||||||
|
|
||||||
|
" the rest of the rust config came from: https://sharksforarms.dev/posts/neovim-rust/
|
||||||
|
" Collection of common configurations for the Nvim LSP client
|
||||||
|
Plug 'neovim/nvim-lspconfig'
|
||||||
|
|
||||||
|
" Completion framework
|
||||||
|
Plug 'hrsh7th/nvim-cmp'
|
||||||
|
|
||||||
|
" LSP completion source for nvim-cmp
|
||||||
|
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||||
|
|
||||||
|
" Snippet completion source for nvim-cmp
|
||||||
|
Plug 'hrsh7th/cmp-vsnip'
|
||||||
|
|
||||||
|
" Other usefull completion sources
|
||||||
|
Plug 'hrsh7th/cmp-path'
|
||||||
|
Plug 'hrsh7th/cmp-buffer'
|
||||||
|
|
||||||
|
" See hrsh7th's other plugins for more completion sources!
|
||||||
|
|
||||||
|
" To enable more of the features of rust-analyzer, such as inlay hints and more!
|
||||||
|
Plug 'simrat39/rust-tools.nvim'
|
||||||
|
|
||||||
|
" Snippet engine
|
||||||
|
Plug 'hrsh7th/vim-vsnip'
|
||||||
|
|
||||||
|
|
||||||
|
" support for jsonnet
|
||||||
|
Plug 'google/vim-jsonnet'
|
||||||
|
" groovy syntax and indent
|
||||||
|
Plug 'vim-scripts/groovy.vim'
|
||||||
|
Plug 'vim-scripts/groovyindent-unix'
|
||||||
|
" auto format all the things
|
||||||
|
" https://github.com/Chiel92/vim-autoformat
|
||||||
|
Plug 'Chiel92/vim-autoformat'
|
||||||
|
" taskwarrior
|
||||||
|
Plug 'xarthurx/taskwarrior.vim'
|
||||||
|
" Wiki support
|
||||||
|
Plug 'vimwiki/vimwiki', { 'branch': 'dev' }
|
||||||
|
" integrating taskwarrior and vimwiki
|
||||||
|
Plug 'tools-life/taskwiki'
|
||||||
|
" Preferred color scheme
|
||||||
|
Plug 'fneu/breezy'
|
||||||
|
|
||||||
|
" All of your Plugins must be added before the following line
|
||||||
|
call plug#end() " required
|
|
@ -1,18 +0,0 @@
|
||||||
vim.g.rustaceanvim = {
|
|
||||||
server = {
|
|
||||||
default_settings = {
|
|
||||||
['rust-analyzer'] = {
|
|
||||||
cargo = {
|
|
||||||
features = {
|
|
||||||
"ssr"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rustfmt = {
|
|
||||||
overrideCommand = {
|
|
||||||
"leptosfmt", "--stdin", "--rustfmt"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
vim.cmd('colorscheme quiet')
|
|
||||||
vim.opt.background = "light"
|
|
||||||
vim.opt.termguicolors = true
|
|
|
@ -9,8 +9,31 @@ set completeopt=menuone,noinsert,noselect
|
||||||
" Avoid showing extra messages when using completion
|
" Avoid showing extra messages when using completion
|
||||||
set shortmess+=c
|
set shortmess+=c
|
||||||
|
|
||||||
" Recognize slint files
|
" Configure LSP through rust-tools.nvim plugin.
|
||||||
autocmd BufEnter *.slint :setlocal filetype=slint
|
" rust-tools will configure and enable certain LSP features for us.
|
||||||
|
" See https://github.com/simrat39/rust-tools.nvim#configuration
|
||||||
|
lua <<EOF
|
||||||
|
local nvim_lsp = require'lspconfig'
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
tools = { -- rust-tools options
|
||||||
|
autoSetHints = true,
|
||||||
|
hover_with_actions = true,
|
||||||
|
inlay_hints = {
|
||||||
|
show_parameter_hints = false,
|
||||||
|
parameter_hints_prefix = "",
|
||||||
|
other_hints_prefix = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- all the opts to send to nvim-lspconfig
|
||||||
|
-- these override the defaults set by rust-tools.nvim
|
||||||
|
-- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
|
||||||
|
server = {}, -- rust-analyer options
|
||||||
|
}
|
||||||
|
|
||||||
|
require('rust-tools').setup(opts)
|
||||||
|
EOF
|
||||||
|
|
||||||
" Setup Completion
|
" Setup Completion
|
||||||
" See https://github.com/hrsh7th/nvim-cmp#basic-configuration
|
" See https://github.com/hrsh7th/nvim-cmp#basic-configuration
|
||||||
|
@ -50,38 +73,10 @@ cmp.setup({
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
" Set updatetime for CursorHold
|
" Set updatetime for CursorHold
|
||||||
" ms of no cursor movement to trigger CursorHold
|
" 300ms of no cursor movement to trigger CursorHold
|
||||||
set updatetime=3000
|
set updatetime=750
|
||||||
" Show diagnostic popup on cursor hold
|
" Show diagnostic popup on cursor hold
|
||||||
autocmd CursorHold * lua vim.diagnostic.open_float()
|
autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics()
|
||||||
" have a fixed column for the diagnostics to appear in
|
" have a fixed column for the diagnostics to appear in
|
||||||
" this removes the jitter when warnings/errors flow in
|
" this removes the jitter when warnings/errors flow in
|
||||||
set signcolumn=yes
|
set signcolumn=yes
|
||||||
|
|
||||||
let g:LanguageClient_serverCommands = {
|
|
||||||
\ 'rust': ['rust-analyzer'],
|
|
||||||
\ }
|
|
||||||
|
|
||||||
lua<<EOF
|
|
||||||
vim.g.markdown_fenced_languages = {
|
|
||||||
"ts=typescript"
|
|
||||||
}
|
|
||||||
require("nvim-lsp-installer").setup {}
|
|
||||||
local lspconfig = require('lspconfig')
|
|
||||||
local util = require('lspconfig.util')
|
|
||||||
|
|
||||||
lspconfig.denols.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
root_dir = util.root_pattern("deno.json", "deno.jsonc"),
|
|
||||||
init_options = {
|
|
||||||
enabled = true,
|
|
||||||
unstable = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lspconfig.ts_ls.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
root_dir = util.root_pattern("package.json"),
|
|
||||||
single_file_support = false
|
|
||||||
}
|
|
||||||
EOF
|
|
11
syntastic.vim
Normal file
11
syntastic.vim
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
" configure syntastic, advanced syntax checker, with some reasonable behaviors
|
||||||
|
"
|
||||||
|
" always stick detected errors in the location list
|
||||||
|
let g:syntastic_always_populate_loc_list = 1
|
||||||
|
" open but only when errors are detected; default closes when errors are cleared
|
||||||
|
" but doesn't open the list automatically
|
||||||
|
let g:syntastic_auto_loc_list = 0
|
||||||
|
" check when first opening a file
|
||||||
|
let g:syntastic_check_on_open = 0
|
||||||
|
" don't check on writing and quitting
|
||||||
|
let g:syntastic_check_on_wq = 0
|
4
wiki.vim
4
wiki.vim
|
@ -1,4 +0,0 @@
|
||||||
" override the default location of vimwiki and change to markdown
|
|
||||||
let g:vimwiki_list = [{'path': '~/Documents/Wiki', 'syntax': 'markdown', 'ext': '.md'}]
|
|
||||||
let g:vimwiki_dir_link = 'index'
|
|
||||||
let g:vimwiki_global_ext = 0
|
|
Loading…
Reference in a new issue