nvim: Switch from vimL to lua setup
Switched to a lua setup. Moved from `init.vim` to `init.lua`. Moved to a lua-based plugin manager (packer.nvim). Moved some plugins to neovim (i.e. lua) versions instead of vimL (notably fzf and indentLine). Enabled lsp, treesitter and similar plugins by default. Modularized plugins a little by invoking them in separate files. This should provide a base to build on, and allow me to more fully integrate lua into my workflow. More detailed changes follow: nvim: Replace completion-nvim with nvim-compe Replaced completion-nvim since compe comes with more things working out of the box (especially buffer completion and treesitter save me two plugin installations), and seems to be overall a bit better supported. It's fast, it works well, and I can add custom completion sources so that should be good enough for me. Changed around a couple of other things for lsp settings and treesitter, and moved the files around a bit. This is somewhat in preparation for a move to a lua-based configuration, since I have long wanted to make the switch. nvim: Add treesitter-enabled rainbow brackets Added rainbow brackets to the editor, using the treesitter AST detection. I am not sure yet if I will keep them, or if they confuse me more than they help by coloring *everything* *everywhere* and being a bit too much for my tired eyes. nvim: Add vim-terminator to enable repl style dev Added vim-terminator and included some basic keybindings. The plugin allows sending code over to a terminal window, or repl for those languages where it's enabled (python, R, bash somewhat). The basic workflow for me right now is: From e.g. a python file 1. Open a repl with <leader>rr 2. Send over code with 2a. <leader>rt sending (selected part or whole of) file over 2b. <leader>rd sending (selected part or whole of) delimited area over A delimited area in option 2b looks for certain patterns and sends everything up-to the next instance of that pattern. Currently, the enabled patterns are `In[n]:` with n being a number, emulating the way jupyter blocks are coded; and `^```` (three back-ticks at the beginning of a line), to enable sending code fences from (R)markdown files. Since it uses the filetype to determine which repl/interpreter to send code to, it is still a little unwieldy in markdown files (which in this editor get handled as `pandoc` filetype.) FIXME: There are two options going forward, either finding a way to correctly identify the interpreter without filetype (should be done in vim-terminator and seems inelegant) or correctly setting the filetype for code fences in (R)Markdown *only* (seems more feasible and may already be enabled in RMarkdown plugins for vim). nvim: Fix simultaneous opening alacritty and nvim When opening both (e.g. `alacritty -e nvim file`), neovim would open with the wrong size (usually way smaller than the resulting terminal size) and stay that way until you resized the terminal window. This simply sends a 'resize' kill command to vim whenever the user enters it to circumvent the bug until it's fixed. nvim: Simplify lua plugin setup, Add indentLine Added indent line plugin to show where and how indentations occur using neovims virtual text. Can be toggled with `:IndentBlanklineToggle`. Simplified lua setup a little by naming settings after intent instead of per plugin -- everything lsp-y now resides in `lsp.lua`, everything treesitter in `treesitter.lua`, everything indentation in its respective file. Should, as long as plugins don't get too many, be perhaps a little simpler to reason about. nvim: Switch to packer as plugin manager Switched to packer -- the plugins move to lua and so will I. Packer seems basically like `vim-plug` in a dress (which is awesome, since vim-plug is also awesome!) and it is extremely fast. So, no real complaints but still a little switch to get that little bit further away from vimscript. nvim: Add telescope plugin and configuration Added telescope as fzf replacement. Fzf served me well, but the configuration is somewhat difficult (not least owing to the fact it's written in vimscript), and telescope has a burgeoning ecosystem growing around it. I could basically drop-in replace all of my mappings and then some. Refined some options and changed some defaults and I am fairly happy for now. nvim: Switch to zettelkasten plugin over wiki.vim
This commit is contained in:
parent
f7350756d0
commit
7bdf9ff8d2
24 changed files with 737 additions and 577 deletions
|
@ -415,22 +415,22 @@
|
|||
# set_stack_tag = "volume"
|
||||
#
|
||||
# vim: ft=cfg
|
||||
# Base16 tomorrow-night - dunst color config
|
||||
frame_color = "#c5c8c6"
|
||||
separator_color = "#c5c8c6"
|
||||
# Base16 bespin - dunst color config
|
||||
frame_color = "#8a8986"
|
||||
separator_color = "#8a8986"
|
||||
|
||||
[base16_low]
|
||||
msg_urgency = low
|
||||
background = "#282a2e"
|
||||
foreground = "#969896"
|
||||
background = "#36312e"
|
||||
foreground = "#666666"
|
||||
|
||||
[base16_normal]
|
||||
msg_urgency = normal
|
||||
background = "#373b41"
|
||||
foreground = "#c5c8c6"
|
||||
background = "#5e5d5c"
|
||||
foreground = "#8a8986"
|
||||
|
||||
[base16_critical]
|
||||
msg_urgency = critical
|
||||
background = "#cc6666"
|
||||
foreground = "#e0e0e0"
|
||||
# Base16End tomorrow-night - dunst color config
|
||||
background = "#cf6a4c"
|
||||
foreground = "#9d9b97"
|
||||
# Base16End bespin - dunst color config
|
||||
|
|
15
nvim/.config/nvim/abbrev.vim
Normal file
15
nvim/.config/nvim/abbrev.vim
Normal file
|
@ -0,0 +1,15 @@
|
|||
" Typos
|
||||
iabbrev adn and
|
||||
iabbrev waht what
|
||||
iabbrev tehn then
|
||||
iabbrev whit with
|
||||
iabbrev whith with
|
||||
iabbrev grwoth growth
|
||||
iabbrev Grwoth Growth
|
||||
iabbrev teh the
|
||||
iabbrev projcets projects
|
||||
|
||||
" Text expansion
|
||||
iabbrev mo@ marty.oehme@gmail.com
|
||||
iabbrev mo.me@ <https://martyoeh.me/>
|
||||
iabbrev mcc@ Copyright 2020 Marty Oehme, all rights reserved.
|
|
@ -1,10 +1,9 @@
|
|||
" PROSE: function to automatically enables markdown plugins for md & txt files
|
||||
function! s:Prose()
|
||||
call plug#load('goyo.vim')
|
||||
call plug#load('limelight.vim')
|
||||
" PLUGIN: vim-textobj-sentence
|
||||
" enable extended sentence textobject use on md and plaintext files
|
||||
call textobj#sentence#init()
|
||||
IndentBlanklineDisable
|
||||
" hide the markdown cruft
|
||||
setlocal conceallevel=2
|
||||
setlocal foldlevel=3
|
||||
|
|
38
nvim/.config/nvim/init.lua
Normal file
38
nvim/.config/nvim/init.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
-- much of this config comes from
|
||||
-- https://github.com/elianiva/dotfiles/ - with much gratitude
|
||||
local augroup = require("helpers.augroup")
|
||||
local api = vim.api
|
||||
|
||||
require('base.settings')
|
||||
require('base.look')
|
||||
require('base.plugins')
|
||||
|
||||
-- Special setting for editing gopass files - make sure nothing leaks outside the directories it is supposed to
|
||||
augroup({
|
||||
{ 'BufNewFile,BufRead', '/dev/shm/gopass.*', 'setlocal noswapfile nobackup noundofile nowritebackup viminfo=' },
|
||||
{ 'BufNewFile,BufRead', '/dev/shm/pass.?*/?*.txt', 'setlocal noswapfile nobackup noundofile nowritebackup viminfo=' },
|
||||
{ 'BufNewFile,BufRead', '$TMPDIR/pass.?*/?*.txt', 'setlocal noswapfile nobackup noundofile nowritebackup viminfo=' },
|
||||
{ 'BufNewFile,BufRead', '/tmp/pass.?*/?*.txt', 'setlocal noswapfile nobackup noundofile nowritebackup viminfo=' }
|
||||
}, 'passnoleak')
|
||||
|
||||
-- fixing neovim opening up at same moment as alacritty (see https://github.com/neovim/neovim/issues/11330)
|
||||
augroup({
|
||||
{ 'VimEnter', '*', 'silent exec "!kill -s SIGWINCH $PPID"' }
|
||||
}, 'fixsize')
|
||||
|
||||
|
||||
-- TODO from here on starts stuff we want to convert into new settings format as well
|
||||
api.nvim_exec('runtime! keys/*.vim', false)
|
||||
api.nvim_exec('runtime colorscheme.vim', false)
|
||||
api.nvim_exec('runtime abbrev.vim', false)
|
||||
|
||||
local plugin_configs = {
|
||||
'_lsp',
|
||||
'_treesitter',
|
||||
'_indentation',
|
||||
'_telescope'
|
||||
}
|
||||
-- load lua plugin configurations
|
||||
for _, f in ipairs(plugin_configs) do
|
||||
require(f)
|
||||
end
|
|
@ -1,146 +0,0 @@
|
|||
" vim: set foldmethod=marker foldlevel=0 nomodeline:
|
||||
" ================================================================================
|
||||
" .init.vim / .vimrc of Marty Oehme {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" - stolen from many different sources including
|
||||
" Steve Losh
|
||||
" Junegunn Choi
|
||||
" Tim Pope
|
||||
|
||||
|
||||
" }}}
|
||||
" VIM SETTINGS {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" set truecolor (neovim)
|
||||
set termguicolors
|
||||
|
||||
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
" one press of backspace.
|
||||
" great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set expandtab
|
||||
augroup LUAtabs
|
||||
autocmd Filetype lua setlocal tabstop=4
|
||||
autocmd Filetype lua setlocal shiftwidth=4
|
||||
autocmd Filetype lua setlocal softtabstop=4
|
||||
autocmd Filetype lua setlocal expandtab
|
||||
augroup END
|
||||
|
||||
" make jumplist behave more like browser, when jumping back
|
||||
" and then adding a new jump discards all the previous
|
||||
" 'future-jump' tree, making more sense for wiki-like movement
|
||||
set jumpoptions=stack
|
||||
|
||||
" set cursor line highlighting, esp useful when using with bracket
|
||||
" highlighting and you don't know which side of the brace the cursor is on
|
||||
set cursorline
|
||||
|
||||
" shows linenumbers relative to the one you are on, for easy movement and
|
||||
" dNUMBERd deletions
|
||||
set number relativenumber
|
||||
|
||||
" keeps an undofile next to files so that you can even undo if vim is closed
|
||||
" in between
|
||||
set undofile
|
||||
|
||||
" ignores case by default but will use case when search is specifically not
|
||||
" all lowercased
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" shows previews of what substitute command will do (and a couple others)
|
||||
set inccommand=split
|
||||
|
||||
" disables showing us the current mode in the command line since airline takes
|
||||
" care of it
|
||||
set noshowmode
|
||||
" turn off modeline, to ensure security observation
|
||||
set nomodeline
|
||||
|
||||
" i feel foldlevel 2 is generally pretty usable, for headlines and similar
|
||||
set foldlevel=2
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
||||
" pump all clippings into the system clipboard
|
||||
set clipboard+=unnamedplus
|
||||
|
||||
" Special setting for editing gopass files - make sure nothing leaks outside
|
||||
" the directories it is supposed to
|
||||
au BufNewFile,BufRead /dev/shm/gopass.* setlocal noswapfile nobackup noundofile nowritebackup viminfo=
|
||||
au BufNewFile,BufRead /dev/shm/pass.?*/?*.txt setlocal noswapfile nobackup noundofile nowritebackup viminfo=
|
||||
au BufNewFile,BufRead $TMPDIR/pass.?*/?*.txt setlocal noswapfile nobackup noundofile nowritebackup viminfo=
|
||||
au BufNewFile,BufRead /tmp/pass.?*/?*.txt setlocal noswapfile nobackup noundofile nowritebackup viminfo=
|
||||
|
||||
" from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/init.vim
|
||||
if has('nvim-0.4')
|
||||
" make completion menu slightly transparent
|
||||
set pumblend=17
|
||||
set wildmode=longest:full
|
||||
|
||||
" Makes floating PopUpMenu for completing stuff on the command line.
|
||||
" Very similar to completing in insert mode.
|
||||
set wildoptions+=pum
|
||||
else
|
||||
set wildmode=longest,list,full
|
||||
" Vim Galore recommended mappings
|
||||
" Make next and previous use smart history
|
||||
cnoremap <C-N> <Up>
|
||||
cnoremap <C-P> <Down>
|
||||
end
|
||||
|
||||
" turn of automatic resizing of individual splits
|
||||
set noequalalways
|
||||
|
||||
" make sure there's always *some* context below cursor
|
||||
set scrolloff=4
|
||||
|
||||
" in .tex files, default to latex over plaintext/context as syntax
|
||||
let g:tex_flavor = "latex"
|
||||
|
||||
" }}}
|
||||
" EXTERNAL FILES {{{
|
||||
" ================================================================================
|
||||
"
|
||||
|
||||
" Load vim-plug plugins
|
||||
runtime plugins.vim
|
||||
" Begin mapping definitions
|
||||
runtime! keys/*.vim
|
||||
|
||||
" load colorscheme from dynamic file
|
||||
" first one is here to make airline behave correctly without reload
|
||||
runtime colorscheme.vim
|
||||
" this one is here to override anything set by default in colorscheme plugin
|
||||
" loading
|
||||
autocmd VimEnter * runtime colorscheme.vim
|
||||
|
||||
" }}}
|
||||
" ABBREVIATIONS {{{
|
||||
|
||||
" Typos
|
||||
iabbrev adn and
|
||||
iabbrev waht what
|
||||
iabbrev tehn then
|
||||
iabbrev whit with
|
||||
iabbrev whith with
|
||||
iabbrev grwoth growth
|
||||
iabbrev Grwoth Growth
|
||||
iabbrev teh the
|
||||
iabbrev projcets projects
|
||||
|
||||
" Text expansion
|
||||
iabbrev mo@ marty.oehme@gmail.com
|
||||
iabbrev mo.me@ <https://martyoeh.me/>
|
||||
iabbrev mcc@ Copyright 2020 Marty Oehme, all rights reserved.
|
||||
|
||||
"
|
||||
" }}}
|
||||
" END
|
||||
" ================================================================================
|
|
@ -131,47 +131,34 @@ nnoremap <leader>e :Vifm getcwd()<CR>
|
|||
" open current file tree with current file directory
|
||||
nnoremap <leader>E :Vifm<CR>
|
||||
|
||||
" PLUGIN: FZF GLOBAL FUZZY FINDING
|
||||
" FZF buffers and files in current workdir
|
||||
noremap <leader>s :FzfBuffers<cr>
|
||||
" FZF most recently used / MRU, bound to S since it is essentially a larger
|
||||
" PLUGIN: Telescope GLOBAL FUZZY FINDING
|
||||
" buffers and files in current workdir
|
||||
noremap <leader>s :lua require 'telescope.builtin'.buffers(require 'telescope.themes'.get_ivy())<cr>
|
||||
" most recently used / MRU, bound to S since it is essentially a larger
|
||||
" go-back intention than just buffers
|
||||
noremap <leader>S :FzfHistory<cr>
|
||||
noremap <leader>S :lua require 'telescope.builtin'.oldfiles(require 'telescope.themes'.get_ivy())<cr>
|
||||
" fuzzy find files in cwd
|
||||
noremap <leader>f :FzfFiles<cr>
|
||||
" FZF general full-text search in cwd with rg
|
||||
noremap <leader>F :FzfRgHidden<cr>
|
||||
noremap <leader>f :lua require 'telescope.builtin'.find_files({follow=true, hidden=true})<cr>
|
||||
" general full-text search in cwd with rg
|
||||
noremap <leader>F :lua require 'telescope.builtin'.live_grep()<cr>
|
||||
|
||||
" FZF git status
|
||||
noremap <leader>gs :FzfGFiles?<cr>
|
||||
" FZF git buffercommits
|
||||
noremap <leader>gb :FzfBCommits<cr>
|
||||
" FZF git commitlog
|
||||
noremap <leader>gl :FzfCommits<cr>
|
||||
" git status
|
||||
noremap <leader>gs :lua require 'telescope.builtin'.git_status()<cr>
|
||||
" git buffercommits
|
||||
noremap <leader>gb :lua require 'telescope.builtin'.git_bcommits()<cr>
|
||||
" git commitlog
|
||||
noremap <leader>gl :lua require 'telescope.builtin'.git_commits()<cr>
|
||||
|
||||
" FZF helptags
|
||||
noremap <leader><F1> :FzfHelptags<cr>
|
||||
" helptags
|
||||
noremap <leader><F1> :lua require 'telescope.builtin'.help_tags()<cr>
|
||||
" manpages
|
||||
noremap <leader><F2> :lua require 'telescope.builtin'.man_pages()<cr>
|
||||
|
||||
" FZF colorschemes
|
||||
nnoremap <leader><F8> :FzfColors<cr>
|
||||
" colorschemes
|
||||
nnoremap <leader><F8> :lua require 'telescope.builtin'.colorscheme(require 'telescope.themes'.get_ivy())<cr>
|
||||
|
||||
" PLUGIN: vim-go
|
||||
" vim-go mappings - will only activate in go files
|
||||
" most of this credit to https://hackernoon.com/my-neovim-setup-for-go-7f7b6e805876
|
||||
" switch between test file and function
|
||||
au Filetype go nnoremap <localleader>ga <Plug>(go-alternate-edit)
|
||||
" switch between test file and function - in a horizontal/vertical split
|
||||
au Filetype go nnoremap <localleader>gah <Plug>(go-alternate-split)
|
||||
au Filetype go nnoremap <localleader>gav <Plug>(go-alternate-vertical)
|
||||
" run a test (but run it as short version, in case tests are tagged
|
||||
" accordingly)
|
||||
au FileType go nnoremap <F10> :GoTest -short<cr>
|
||||
" show/hide code coverage of go file
|
||||
au FileType go nnoremap <F9> :GoCoverageToggle -short<cr>
|
||||
" To get the documentation of whatever you are hovering over press K (to go
|
||||
" back C-t) -- this is enabled by default and needs no bind
|
||||
" go to the definition of whatever you hover over
|
||||
au FileType go nnoremap <F12> <Plug>(go-def)
|
||||
" spell suggestions
|
||||
nnoremap z= :lua require 'telescope.builtin'.spell_suggest(require 'telescope.themes'.get_ivy())<cr>
|
||||
|
||||
" Note Searching
|
||||
" PLUGIN: Notational-FZF
|
||||
|
@ -197,7 +184,7 @@ nnoremap <leader>wF :execute(":call SearchNotes()")<cr>
|
|||
" leader is used when it is callable from anywhere
|
||||
" localleader is used when it is specific to the local file
|
||||
nnoremap <leader>wf :WikiFzfPages<cr>
|
||||
nnoremap <leader>l :WikiFzfTags<cr>
|
||||
nnoremap <leader>wt :WikiFzfTags<cr>
|
||||
" use default TOC shortcut for viewing wikitoc if in correct filetype
|
||||
augroup wikitoc
|
||||
autocmd!
|
||||
|
@ -207,7 +194,6 @@ augroup END
|
|||
" overwrites some default mappings I don't use, or that interfere with my own
|
||||
" mappings TODO: currently this just assigns bogus shortcuts, since the plugin grumbles
|
||||
" when setting to an empty string
|
||||
|
||||
let g:wiki_mappings_local = {
|
||||
\ '<plug>(wiki-link-next)' : '<tab>',
|
||||
\ '<plug>(wiki-link-prev)' : '<s-tab>',
|
||||
|
@ -220,7 +206,8 @@ let g:wiki_mappings_local = {
|
|||
" additional zettelkasten mapping
|
||||
augroup zettelkasten
|
||||
autocmd!
|
||||
autocmd Filetype markdown,pandoc nnoremap <cr> :ZettelOpenAtCursor<cr>
|
||||
autocmd Filetype markdown,pandoc nnoremap <cr> :lua require 'zettelkasten'.open_or_make_link()<cr>
|
||||
autocmd Filetype markdown,pandoc vnoremap <cr> :lua require 'zettelkasten'.open_or_make_link(true)<cr>
|
||||
augroup END
|
||||
|
||||
" Mostly dealing with Prose writing from here on out
|
||||
|
|
21
nvim/.config/nvim/lua/_indentation.lua
Normal file
21
nvim/.config/nvim/lua/_indentation.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
-- Settings for indentBlankline
|
||||
-- turn off for diff views since we want to compare directly
|
||||
if vim.wo.diff then
|
||||
vim.g["indent_blakline_enabled"] = false
|
||||
end
|
||||
|
||||
vim.g.indent_blankline_char = "▏"
|
||||
|
||||
vim.g.indent_blankline_filetype_exclude = {
|
||||
"help", "undotree",
|
||||
"markdown", "text", "pandoc",
|
||||
"vim-plug"
|
||||
}
|
||||
vim.g.indent_blankline_buftype_exclude = {"terminal"}
|
||||
|
||||
vim.g.indent_blankline_use_treesitter = true
|
||||
vim.g.indent_blankline_show_first_indent_level = false
|
||||
|
||||
vim.g.indent_blankline_show_current_context = true
|
||||
vim.g.indent_blankline_context_highlight = "Function"
|
||||
vim.g.indent_blankline_context_patterns = {"function", "class", "method"}
|
133
nvim/.config/nvim/lua/_lsp.lua
Normal file
133
nvim/.config/nvim/lua/_lsp.lua
Normal file
|
@ -0,0 +1,133 @@
|
|||
local api = vim.api
|
||||
|
||||
local saga = require 'lspsaga'
|
||||
local lspcfg = require 'lspconfig'
|
||||
local compe = require 'compe'
|
||||
|
||||
-- Enable the following language servers
|
||||
local servers = {
|
||||
'bashls',
|
||||
'gopls',
|
||||
'texlab',
|
||||
'pyright',
|
||||
'rust_analyzer',
|
||||
'tsserver',
|
||||
'vimls',
|
||||
-- sumneko_lua further down, needs more setup
|
||||
}
|
||||
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
-- completion sources, higher priority = closer to the top?
|
||||
compe.setup({
|
||||
source = {
|
||||
nvim_lsp = true,
|
||||
nvim_treesitter = true,
|
||||
buffer = true,
|
||||
path = true,
|
||||
calc = true,
|
||||
nvim_lua = true,
|
||||
emoji = true,
|
||||
spell = {
|
||||
priority = 0,
|
||||
},
|
||||
-- vsnip = true,
|
||||
},
|
||||
})
|
||||
|
||||
local on_attach = function(_, _)
|
||||
-- Keybindings for LSPs
|
||||
-- Note these are in on_attach so that they don't override bindings in a non-LSP setting
|
||||
api.nvim_set_keymap("n", "gh", "<cmd>lua require 'lspsaga.provider'.lsp_finder()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
api.nvim_set_keymap("n", "gd", "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
api.nvim_set_keymap("n", "gE", "<cmd>lua require 'lspsaga.codeaction'.code_action()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
api.nvim_set_keymap("v", "gE", "<cmd>'<,'>lua require 'lspsaga.codeaction'.range_code_action()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
api.nvim_set_keymap("n", "K", "<cmd>lua require('lspsaga.hover').render_hover_doc()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
api.nvim_set_keymap("n", "gK", "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
api.nvim_set_keymap("n", "gr", "<cmd>lua require('lspsaga.rename').rename()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
|
||||
api.nvim_set_keymap("n", "ge", "<cmd>lua require('lspsaga.diagnostic').show_line_diagnostics()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
api.nvim_set_keymap("n", "]e", "<cmd>lua require('lspsaga.diagnostic').lsp_jump_diagnostic_next()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
api.nvim_set_keymap("n", "[e", "<cmd>lua require('lspsaga.diagnostic').lsp_jump_diagnostic_prev()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
|
||||
api.nvim_set_keymap("n", "C-f", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>",
|
||||
{noremap = true, silent = true})
|
||||
api.nvim_set_keymap("n", "C-b", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>",
|
||||
{noremap = true, silent = true})
|
||||
|
||||
require("lspsaga").init_lsp_saga {
|
||||
error_sign = 'X',
|
||||
warn_sign = '⚠️',
|
||||
hint_sign = '⚡',
|
||||
infor_sign = 'ℹ️',
|
||||
code_action_icon = '●',
|
||||
finder_definition_icon = '📖 ',
|
||||
finder_reference_icon = '🔖 ',
|
||||
definition_preview_icon = '📖 ',
|
||||
finder_action_keys = {
|
||||
open = '<cr>',
|
||||
split = 's',
|
||||
vsplit = 'v',
|
||||
quit = '<esc>',
|
||||
scroll_down = '<c-f>',
|
||||
scroll_up = '<c-b>'
|
||||
},
|
||||
code_action_keys = {
|
||||
quit = '<esc>',
|
||||
exec = '<cr>'
|
||||
},
|
||||
rename_action_keys = {
|
||||
quit = '<esc>',
|
||||
exec = '<cr>'
|
||||
},
|
||||
}
|
||||
print('LSP ready')
|
||||
end
|
||||
|
||||
-- set up simple servers
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspcfg[lsp].setup { on_attach = on_attach }
|
||||
end
|
||||
|
||||
-- requires the lua-language-server package to be installed
|
||||
-- The arch package defaults to the following directory
|
||||
local sumneko_root_path = "/usr/share/lua-language-server"
|
||||
lspcfg.sumneko_lua.setup {
|
||||
cmd = { "lua-language-server", "-E", sumneko_root_path .. "/main.lua"};
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
-- Setup your lua path
|
||||
path = vim.split(package.path, ';'),
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim', 'before_each', 'after_each', 'describe', 'it', 'mock', 'stub'},
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = {
|
||||
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
|
||||
["/usr/share/lua/5.1/busted/"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
on_attach = on_attach,
|
||||
}
|
||||
|
||||
saga.init_lsp_saga()
|
||||
|
||||
api.nvim_set_keymap("i", "<C-Space>", "compe#complete()", {expr = true, silent = true})
|
12
nvim/.config/nvim/lua/_telescope.lua
Normal file
12
nvim/.config/nvim/lua/_telescope.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
require("telescope").setup {
|
||||
defaults = {
|
||||
file_sorter = require("telescope.sorters").get_fzy_sorter
|
||||
},
|
||||
extensions = {
|
||||
fzy_native = {
|
||||
override_generic_sorter = false,
|
||||
override_file_sorter = true
|
||||
}
|
||||
}
|
||||
}
|
||||
require("telescope").load_extension("fzy_native")
|
|
@ -5,4 +5,9 @@ require'nvim-treesitter.configs'.setup {
|
|||
incremental_selection = { enable = true },
|
||||
textobjects = { enable = true },
|
||||
indent = { enable = true },
|
||||
|
||||
-- enable rainbow brackets, needs p00f/nvim-ts-rainbow
|
||||
rainbow = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
|
|
19
nvim/.config/nvim/lua/base/look.lua
Normal file
19
nvim/.config/nvim/lua/base/look.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local set_hl = require("helpers.highlight")
|
||||
local augroup = require("helpers.augroup")
|
||||
|
||||
set_hl("Comment", { gui = "italic" })
|
||||
|
||||
-- local function override_hl_colors()
|
||||
-- vim.api.nvim_exec(
|
||||
-- [[
|
||||
-- hi LspDiagnosticsVirtualTextError guifg=blue gui=bold,italic,underline
|
||||
-- hi LspDiagnosticsVirtualTextWarning guifg=pink gui=bold,italic,underline
|
||||
-- hi LspDiagnosticsVirtualTextInformation guifg=yellow gui=bold,italic,underline
|
||||
-- hi LspDiagnosticsVirtualTextHint guifg=green gui=bold,italic,underline
|
||||
-- ]], false)
|
||||
-- end
|
||||
|
||||
|
||||
augroup({
|
||||
{ 'ColorScheme', 'lua require("base.look").override_hl_colors()' }
|
||||
}, 'override_highlights')
|
92
nvim/.config/nvim/lua/base/plugins.lua
Normal file
92
nvim/.config/nvim/lua/base/plugins.lua
Normal file
|
@ -0,0 +1,92 @@
|
|||
local install_path = vim.fn.stdpath("data") .. "/pack/packer/start/packer.nvim"
|
||||
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
|
||||
end
|
||||
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
augroup Packer
|
||||
autocmd!
|
||||
autocmd BufWritePost plugins.lua PackerCompile
|
||||
augroup END
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
local use = require("packer").use
|
||||
require("packer").startup(
|
||||
function()
|
||||
-- packer manages itself
|
||||
use "wbthomason/packer.nvim"
|
||||
|
||||
--
|
||||
-- vim plugs
|
||||
-- essential
|
||||
use 'christoomey/vim-tmux-navigator' -- allow seamless navigation between vim buffers and tmux splits
|
||||
use 'jeffkreeftmeijer/vim-numbertoggle' -- toggles numbers to absolute for all buffers but the current which is relative
|
||||
use 'justinmk/vim-sneak' -- jump between letters with improved fFtT quicksearch
|
||||
use 'RRethy/vim-illuminate' -- highlight other occurences of the word under cursor
|
||||
|
||||
-- files
|
||||
use 'vifm/vifm.vim'
|
||||
|
||||
-- editing
|
||||
use 'tpope/vim-commentary' -- easily toggle comments for lines, paragraphs etc with gc
|
||||
use 'tpope/vim-surround' -- lets you change surrounding things with cs (or ds to del, ys to add)
|
||||
use 'tommcdo/vim-exchange' -- adds exchange operator with cx. common use: cxiw . on 2 words to switch
|
||||
use 'jiangmiao/auto-pairs' -- Auto close brackets and ''
|
||||
use 'junegunn/vim-easy-align' -- Align tables and other alignable things
|
||||
use 'junegunn/vim-peekaboo' -- Show the contents of regiseters on pasting from '', @, <C-R>
|
||||
|
||||
-- fuzzy
|
||||
use {"nvim-telescope/telescope.nvim", requires = {{"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"}}}
|
||||
use "nvim-telescope/telescope-fzy-native.nvim"
|
||||
|
||||
-- linting
|
||||
use 'desmap/ale-sensible'
|
||||
use 'w0rp/ale' -- asynchronous linting - might be superseded by lsp or coc.nvim at some point
|
||||
|
||||
-- statusline
|
||||
use 'vim-airline/vim-airline'
|
||||
use 'vim-airline/vim-airline-themes'
|
||||
use 'edkolev/tmuxline.vim'
|
||||
|
||||
-- colorschemes
|
||||
use 'chriskempson/base16-vim'
|
||||
use 'reedes/vim-colors-pencil'
|
||||
|
||||
-- writing
|
||||
use 'vim-pandoc/vim-pandoc-syntax'
|
||||
use 'vim-pandoc/vim-pandoc'
|
||||
use 'micarmst/vim-spellsync' -- personal dict improvements for git sync
|
||||
use 'ron89/thesaurus_query.vim' -- find thesaurus backed synonyms for word under cursor
|
||||
use 'kana/vim-textobj-user' -- dependency for most other textobj plugins
|
||||
use 'reedes/vim-textobj-sentence' -- extends the capabilities of sentence detection
|
||||
use 'junegunn/goyo.vim' -- provide distraction free writing
|
||||
use 'junegunn/limelight.vim' -- provide even distraction free-er writing (lowlight paragraphs)
|
||||
use 'lervag/wiki.vim' -- foundational wiki system, allowing links between plaintext files
|
||||
use 'dyng/ctrlsf.vim' -- search-and-edit of many wiki files at once
|
||||
use 'alok/notational-fzf-vim' -- quickly search through the wiki
|
||||
|
||||
-- languages
|
||||
use 'euclidianAce/BetterLua.vim' -- better syntax highlighting for lua
|
||||
|
||||
--
|
||||
-- nvim plugs
|
||||
|
||||
use 'erietz/vim-terminator' -- interactive code sending and repl-ing from vim
|
||||
use {"lukas-reineke/indent-blankline.nvim", branch = "lua"} -- show a vertical line for each indentation
|
||||
|
||||
-- lsp
|
||||
use 'neovim/nvim-lspconfig' -- some commong language server configurations
|
||||
use 'glepnir/lspsaga.nvim' -- nice and fast ui for lsp actions
|
||||
use 'hrsh7th/nvim-compe' -- simple completion engine built specifically for nvim and lsp
|
||||
|
||||
-- treesitter
|
||||
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'}
|
||||
use 'p00f/nvim-ts-rainbow' -- rainbow brackets using treesitter
|
||||
|
||||
use 'marty-oehme/zettelkasten.nvim'
|
||||
end
|
||||
)
|
72
nvim/.config/nvim/lua/base/settings.lua
Normal file
72
nvim/.config/nvim/lua/base/settings.lua
Normal file
|
@ -0,0 +1,72 @@
|
|||
require("helpers.vimoptions")
|
||||
|
||||
|
||||
local apply_options = function(opts)
|
||||
for k, v in pairs(opts) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
local o = {
|
||||
termguicolors = true,
|
||||
-- sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
-- one press of backspace.
|
||||
-- great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
tabstop = 4,
|
||||
shiftwidth = 4,
|
||||
softtabstop = 4,
|
||||
expandtab = true,
|
||||
|
||||
-- make jumplist behave more like browser, when jumping back
|
||||
-- and then adding a new jump discards all the previous
|
||||
-- 'future-jump' tree, making more sense for wiki-like movement
|
||||
jumpoptions = 'stack',
|
||||
|
||||
-- set cursor line highlighting, esp useful when using with bracket
|
||||
-- highlighting and you don't know which side of the brace the cursor is on
|
||||
cursorline = true,
|
||||
|
||||
-- shows linenumbers relative to the one you are on, for easy movement and
|
||||
-- dNUMBERd deletions
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
|
||||
-- keeps an undofile next to files so that you can even undo if vim is closed
|
||||
-- in between
|
||||
undofile = true,
|
||||
-- TODO o.undodir = '~/.cache/nvim/undodir'
|
||||
|
||||
-- ignores case by default but will use case when search is specifically not
|
||||
-- all lowercased
|
||||
ignorecase = true,
|
||||
smartcase = true,
|
||||
|
||||
-- shows previews of what substitute command will do (and a couple others)
|
||||
inccommand = 'split',
|
||||
|
||||
-- disables showing us the current mode in the command line since airline takes
|
||||
-- care of it
|
||||
showmode = false,
|
||||
-- turn off modeline, to ensure security observation
|
||||
modeline = false,
|
||||
|
||||
-- i feel foldlevel 2 is generally pretty usable, for headlines and similar
|
||||
foldlevel = 2,
|
||||
conceallevel = 2,
|
||||
|
||||
-- enable mouse, doesn't bug me and might come in useful at some point
|
||||
mouse = 'a',
|
||||
|
||||
-- pump all clippings into the system clipboard
|
||||
clipboard='unnamedplus',
|
||||
|
||||
-- turn of automatic resizing of individual splits
|
||||
equalalways = false,
|
||||
|
||||
-- make sure there's always *some* context below cursor
|
||||
scrolloff=4,
|
||||
|
||||
}
|
||||
|
||||
vim.api.nvim_set_var('tex_flavor', 'latex')
|
||||
apply_options(o)
|
27
nvim/.config/nvim/lua/helpers/augroup.lua
Normal file
27
nvim/.config/nvim/lua/helpers/augroup.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
-- augroup utility function
|
||||
--
|
||||
-- Let's you create and use autogroups through lua
|
||||
-- which (as of now) is not possible through official nvim api
|
||||
--
|
||||
-- Cribbed from the very helpful https://icyphox.sh/blog/nvim-lua - Thank you!
|
||||
--
|
||||
-- Example usage settings.lua
|
||||
-- local cmd = vim.cmd
|
||||
-- local u = require('utils')
|
||||
-- u.create_augroup({
|
||||
-- { 'BufRead,BufNewFile', '/tmp/nail-*', 'setlocal', 'ft=mail' },
|
||||
-- { 'BufRead,BufNewFile', '*s-nail-*', 'setlocal', 'ft=mail' },
|
||||
-- }, 'ftmail')
|
||||
-- cmd('au BufNewFile,BufRead * if &ft == "" | set ft=text | endif')
|
||||
|
||||
local cmd = vim.cmd
|
||||
|
||||
|
||||
return function(cmds, groupname)
|
||||
cmd('augroup ' .. groupname)
|
||||
cmd('autocmd!')
|
||||
for _, autocmd in ipairs(cmds) do
|
||||
cmd('autocmd ' .. table.concat(autocmd, ' '))
|
||||
end
|
||||
cmd('augroup END')
|
||||
end
|
17
nvim/.config/nvim/lua/helpers/highlight.lua
Normal file
17
nvim/.config/nvim/lua/helpers/highlight.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
-- helper for easily defining highlight groups
|
||||
--
|
||||
-- usage example - italicize comments:
|
||||
-- set_hl("Comment", { gui = "italic" })
|
||||
return function(group, options)
|
||||
local bg = options.bg == nil and "" or "guibg=" .. options.bg
|
||||
local fg = options.fg == nil and "" or "guifg=" .. options.fg
|
||||
local gui = options.gui == nil and "" or "gui=" .. options.gui
|
||||
local link = options.link or false
|
||||
local target = options.target
|
||||
|
||||
if not link then
|
||||
vim.cmd(string.format("hi %s %s %s %s", group, bg, fg, gui))
|
||||
else
|
||||
vim.cmd(string.format("hi! link", group, target))
|
||||
end
|
||||
end
|
230
nvim/.config/nvim/lua/helpers/vimoptions.lua
Normal file
230
nvim/.config/nvim/lua/helpers/vimoptions.lua
Normal file
|
@ -0,0 +1,230 @@
|
|||
--{{{
|
||||
-- remove this when vim.opt got merged
|
||||
local if_nil = function(a, b)
|
||||
if a == nil then
|
||||
return b
|
||||
end
|
||||
return a
|
||||
end
|
||||
|
||||
local singular_values = {
|
||||
['boolean'] = true,
|
||||
['number'] = true,
|
||||
['nil'] = true,
|
||||
}
|
||||
|
||||
local set_key_value = function(t, key_value_str)
|
||||
assert(string.find(key_value_str, ":"), "Must have a :" .. tostring(key_value_str))
|
||||
|
||||
local key, value = unpack(vim.split(key_value_str, ":"))
|
||||
key = vim.trim(key)
|
||||
value = vim.trim(value)
|
||||
|
||||
t[key] = value
|
||||
end
|
||||
|
||||
local convert_vimoption_to_lua = function(_, val)
|
||||
-- Short circuit if we've already converted!
|
||||
if type(val) == 'table' then
|
||||
return val
|
||||
end
|
||||
|
||||
if singular_values[type(val)] then
|
||||
return val
|
||||
end
|
||||
|
||||
if type(val) == "string" then
|
||||
-- TODO: Bad hax I think
|
||||
if string.find(val, ":") then
|
||||
local result = {}
|
||||
local items = vim.split(val, ",")
|
||||
for _, item in ipairs(items) do
|
||||
set_key_value(result, item)
|
||||
end
|
||||
|
||||
return result
|
||||
else
|
||||
return vim.split(val, ",")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- local concat_keys = function(t, sep)
|
||||
-- return table.concat(vim.tbl_keys(t), sep)
|
||||
-- end
|
||||
|
||||
local concat_key_values = function(t, sep, divider)
|
||||
local final = {}
|
||||
for k, v in pairs(t) do
|
||||
table.insert(final, string.format('%s%s%s', k, divider, v))
|
||||
end
|
||||
|
||||
table.sort(final)
|
||||
return table.concat(final, sep)
|
||||
end
|
||||
|
||||
local remove_duplicate_values = function(t)
|
||||
local result = {}
|
||||
for _, v in ipairs(t) do
|
||||
result[v] = true
|
||||
end
|
||||
|
||||
return vim.tbl_keys(result)
|
||||
end
|
||||
|
||||
local remove_value = function(t, val)
|
||||
if vim.tbl_islist(t) then
|
||||
local remove_index = nil
|
||||
for i, v in ipairs(t) do
|
||||
if v == val then
|
||||
remove_index = i
|
||||
end
|
||||
end
|
||||
|
||||
if remove_index then
|
||||
table.remove(t, remove_index)
|
||||
end
|
||||
else
|
||||
t[val] = nil
|
||||
end
|
||||
|
||||
return t
|
||||
end
|
||||
|
||||
local add_value = function(current, new)
|
||||
if singular_values[type(current)] then
|
||||
error(
|
||||
"This is not possible to do. Please do something different: "
|
||||
.. tostring(current)
|
||||
.. " // "
|
||||
.. tostring(new)
|
||||
)
|
||||
end
|
||||
|
||||
if type(new) == 'string' then
|
||||
if vim.tbl_islist(current) then
|
||||
table.insert(current, new)
|
||||
else
|
||||
set_key_value(current, new)
|
||||
end
|
||||
|
||||
return current
|
||||
elseif type(new) == 'table' then
|
||||
if vim.tbl_islist(current) then
|
||||
assert(vim.tbl_islist(new))
|
||||
vim.list_extend(current, new)
|
||||
else
|
||||
assert(not vim.tbl_islist(new), vim.inspect(new) .. vim.inspect(current))
|
||||
current = vim.tbl_extend("force", current, new)
|
||||
end
|
||||
|
||||
return current
|
||||
else
|
||||
error("Unknown type")
|
||||
end
|
||||
end
|
||||
|
||||
local convert_lua_to_vimoption = function(t)
|
||||
if vim.tbl_islist(t) then
|
||||
t = remove_duplicate_values(t)
|
||||
|
||||
table.sort(t)
|
||||
return table.concat(t, ',')
|
||||
else
|
||||
return concat_key_values(t, ',', ':')
|
||||
end
|
||||
end
|
||||
|
||||
local clean_value = function(v)
|
||||
if singular_values[type(v)] then
|
||||
return v
|
||||
end
|
||||
|
||||
local result = v:gsub('^,', '')
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local opt_mt
|
||||
|
||||
opt_mt = {
|
||||
__index = function(t, k)
|
||||
if k == '_value' then
|
||||
return rawget(t, k)
|
||||
end
|
||||
|
||||
return setmetatable({ _option = k, }, opt_mt)
|
||||
end,
|
||||
|
||||
__newindex = function(t, k, v)
|
||||
if k == '_value' then
|
||||
return rawset(t, k, v)
|
||||
end
|
||||
|
||||
if type(v) == 'table' then
|
||||
local new_value
|
||||
if getmetatable(v) ~= opt_mt then
|
||||
new_value = v
|
||||
else
|
||||
assert(v._value, "Must have a value to set this")
|
||||
new_value = v._value
|
||||
end
|
||||
|
||||
vim.o[k] = convert_lua_to_vimoption(new_value)
|
||||
return
|
||||
end
|
||||
|
||||
if v == nil then
|
||||
v = ''
|
||||
end
|
||||
|
||||
-- TODO: Figure out why nvim_set_option doesn't override values the same way.
|
||||
-- @bfredl said he will fix this for me, so I can just use nvim_set_option
|
||||
if type(v) == 'boolean' then
|
||||
vim.o[k] = clean_value(v)
|
||||
if v then
|
||||
vim.cmd(string.format("set %s", k))
|
||||
else
|
||||
vim.cmd(string.format("set no%s", k))
|
||||
end
|
||||
else
|
||||
vim.cmd(string.format("set %s=%s", k, clean_value(v)))
|
||||
end
|
||||
end,
|
||||
|
||||
__add = function(left, right)
|
||||
--[[
|
||||
set.wildignore = set.wildignore + 'hello'
|
||||
set.wildignore = set.wildignore + { '*.o', '*~', }
|
||||
--]]
|
||||
|
||||
assert(left._option, "must have an option key")
|
||||
if left._option == 'foldcolumn' then
|
||||
error("not implemented for foldcolumn.. use a string")
|
||||
end
|
||||
|
||||
local existing = if_nil(left._value, vim.o[left._option])
|
||||
local current = convert_vimoption_to_lua(left._option, existing)
|
||||
if not current then
|
||||
left._value = convert_vimoption_to_lua(right)
|
||||
end
|
||||
|
||||
left._value = add_value(current, right)
|
||||
return left
|
||||
end,
|
||||
|
||||
__sub = function(left, right)
|
||||
assert(left._option, "must have an option key")
|
||||
|
||||
local existing = if_nil(left._value, vim.o[left._option])
|
||||
local current = convert_vimoption_to_lua(left._option, existing)
|
||||
if not current then
|
||||
return left
|
||||
end
|
||||
|
||||
left._value = remove_value(current, right)
|
||||
return left
|
||||
end
|
||||
}
|
||||
|
||||
vim.opt = setmetatable({}, opt_mt)--}}}
|
|
@ -1,96 +0,0 @@
|
|||
local saga = require 'lspsaga'
|
||||
|
||||
|
||||
local on_attach = function(_, _)
|
||||
-- Keybindings for LSPs
|
||||
-- Note these are in on_attach so that they don't override bindings in a non-LSP setting
|
||||
vim.api.nvim_set_keymap("n", "gh", "<cmd>lua require 'lspsaga.provider'.lsp_finder()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap("n", "gd", "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap("n", "ca", "<cmd>lua require 'lspsaga.codeaction'.code_action()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap("v", "ca", "<cmd>'<,'>lua require 'lspsaga.codeaction'.range_code_action()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap("n", "K", "<cmd>lua require('lspsaga.hover').render_hover_doc()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap("n", "gK", "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap("n", "gr", "<cmd>lua require('lspsaga.rename').rename()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
|
||||
vim.api.nvim_set_keymap("n", "ge", "<cmd>lua require('lspsaga.diagnostic').show_line_diagnostics()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap("n", "[e", "<cmd>lua require('lspsaga.diagnostic').lsp_jump_diagnostic_next()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap("n", "]e", "<cmd>lua require('lspsaga.diagnostic').lsp_jump_diagnostic_prev()<CR>",
|
||||
{noremap = true, silent = true})
|
||||
|
||||
vim.api.nvim_set_keymap("n", "C-f", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>",
|
||||
{noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap("n", "C-b", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>",
|
||||
{noremap = true, silent = true})
|
||||
|
||||
require("lspsaga").init_lsp_saga {
|
||||
error_sign = 'X',
|
||||
warn_sign = '⚠️',
|
||||
hint_sign = '⚡',
|
||||
infor_sign = 'ℹ️',
|
||||
code_action_icon = '💡',
|
||||
finder_definition_icon = '📖 ',
|
||||
finder_reference_icon = '🔖 ',
|
||||
finder_action_keys = {
|
||||
open = '<cr>',
|
||||
split = 's',
|
||||
vsplit = 'v',
|
||||
quit = '<esc>',
|
||||
scroll_down = '<c-f>',
|
||||
scroll_up = '<c-b>'
|
||||
},
|
||||
code_action_keys = {
|
||||
quit = '<esc>',
|
||||
exec = '<cr>'
|
||||
},
|
||||
rename_action_keys = {
|
||||
quit = '<esc>',
|
||||
exec = '<cr>'
|
||||
},
|
||||
definition_preview_icon = '📖 '
|
||||
}
|
||||
end
|
||||
|
||||
require'lspconfig'.pyls.setup {on_attach = on_attach}
|
||||
require'lspconfig'.vimls.setup {on_attach = on_attach}
|
||||
require'lspconfig'.bashls.setup {on_attach = on_attach}
|
||||
require'lspconfig'.gopls.setup {on_attach = on_attach}
|
||||
require'lspconfig'.texlab.setup {on_attach = on_attach}
|
||||
|
||||
-- requires the lua-language-server package to be installed
|
||||
-- The arch package defaults to the following directory
|
||||
local sumneko_root_path = "/usr/share/lua-language-server"
|
||||
require'lspconfig'.sumneko_lua.setup {
|
||||
cmd = { "lua-language-server", "-E", sumneko_root_path .. "/main.lua"};
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
-- Setup your lua path
|
||||
path = vim.split(package.path, ';'),
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim'},
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = {
|
||||
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
on_attach = on_attach,
|
||||
}
|
||||
saga.init_lsp_saga()
|
|
@ -1,117 +0,0 @@
|
|||
" vim: set foldmethod=marker foldlevel=1 nomodeline:
|
||||
" ================================================================================
|
||||
" .init.vim / .vimrc of Marty Oehme {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" - stolen from many different sources including
|
||||
" Steve Losh
|
||||
" Junegunn Choi
|
||||
" Tim Pope
|
||||
|
||||
" this config does not set nocompatible - neovim does this automatically
|
||||
" this config does not set filetype plugin - vim-sensible does this
|
||||
" }}}
|
||||
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" automatically install vim-plug if it does not exist
|
||||
" Note: this installs it in the neovim folder, not the vim folder
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source academia.vim | q
|
||||
endif
|
||||
|
||||
" automatically install any missing plugins
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
"
|
||||
" set truecolor (neovim)
|
||||
set termguicolors
|
||||
|
||||
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
" one press of backspace.
|
||||
" great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set expandtab
|
||||
|
||||
" set cursor line highlighting, esp useful when using with bracket
|
||||
" highlighting and you don't know which side of the brace the cursor is on
|
||||
set cursorline
|
||||
|
||||
" shows linenumbers relative to the one you are on, for easy movement and
|
||||
" dNUMBERd deletions
|
||||
set number relativenumber
|
||||
|
||||
" keeps an undofile next to files so that you can even undo if vim is closed
|
||||
" in between
|
||||
set undofile
|
||||
|
||||
" ignores case by default but will use case when search is specifically not
|
||||
" all lowercased
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" whenever vim loses focus, save
|
||||
au FocusLost * :wa
|
||||
|
||||
" disables showing us the current mode in the command line since airline takes
|
||||
" care of it
|
||||
set noshowmode
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings (e.g. vim-waikiki for files under
|
||||
" the root dir to the same key -- might lead to incompatibilities, will have
|
||||
" to test)
|
||||
let maplocalleader = "\<Space>"
|
||||
" set jk to escape, in case capslock is not mapped to escape on the system
|
||||
inoremap jk <ESC>
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp academia.vim<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source academia.vim<cr>
|
||||
|
||||
|
||||
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" stronger versions of left,right - move all the way
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
|
||||
" }}}
|
||||
" CUSTOMIZATION {{{
|
||||
|
||||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
" automatically switch between relative and absolute numbers as buffers move
|
||||
" into / out of focus (requires number & relativenumber to be set)
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
||||
Plug 'rakr/vim-one'
|
||||
|
||||
call plug#end()
|
||||
endif
|
||||
|
||||
" }}}
|
||||
colo one
|
|
@ -1,73 +0,0 @@
|
|||
" use completion-nvim for all buffers (not just lsp)
|
||||
autocmd BufEnter * lua require'completion'.on_attach()
|
||||
|
||||
"map <c-p> to manually trigger completion
|
||||
imap <silent> <c-n> <Plug>(completion_smart_tab)
|
||||
imap <silent> <c-p> <Plug>(completion_smart_s_tab)
|
||||
" switch between completion sources manually with c-j/c-k
|
||||
" only do so if popupmenu is visible, otherwise normal function
|
||||
imap <silent> <c-j> <Plug>(completion_next_source)
|
||||
imap <silent> <c-k> <Plug>(completion_prev_source)
|
||||
|
||||
" Set completeopt to have a better completion experience
|
||||
set completeopt=menuone,noinsert,noselect
|
||||
|
||||
" Avoid showing message extra message when using completion
|
||||
set shortmess+=c
|
||||
|
||||
" set loop of strategies in descending order
|
||||
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
|
||||
|
||||
" even when backtracking enable completion
|
||||
let g:completion_trigger_on_delete = 1
|
||||
|
||||
" switch between different completion changes when no completions found for
|
||||
" current one
|
||||
let g:completion_auto_change_source = 1
|
||||
|
||||
" register new completion engines
|
||||
" (set in rtp/lua/*_complete.lua)
|
||||
"
|
||||
" pandoc citation key completion
|
||||
lua require'completion'.addCompletionSource('bibcite', require'pandoc_complete'.complete_item)
|
||||
|
||||
" in pandoc files, normal completion should only come from buffer sources and
|
||||
" bibcite only invoked manually, since it takes long to parse
|
||||
augroup pandocCompletion
|
||||
autocmd!
|
||||
autocmd BufEnter * call SetupPandocCompletion()
|
||||
augroup end
|
||||
fun! SetupPandocCompletion()
|
||||
if &ft =~ 'pandoc'
|
||||
let g:completion_auto_change_source = 0
|
||||
return
|
||||
endif
|
||||
let g:completion_auto_change_source = 1
|
||||
endfun
|
||||
|
||||
" the completion chains for different filetypes
|
||||
" see https://github.com/nvim-lua/completion-nvim/wiki/chain-complete-support
|
||||
" BUG for triggered only bibcite completion, see: https://github.com/nvim-lua/completion-nvim/issues/158
|
||||
let g:completion_chain_complete_list = {
|
||||
\ 'pandoc': [
|
||||
\ { 'complete_items': ['buffers', 'snippet']},
|
||||
\ { 'complete_items': ['bibcite']},
|
||||
\ { 'complete_items': ['path']},
|
||||
\ { 'mode': '<c-p>'},
|
||||
\ { 'mode': '<c-n>'}
|
||||
\],
|
||||
\ 'tex': [
|
||||
\ { 'complete_items': ['buffers', 'snippet']},
|
||||
\ { 'complete_items': ['bibcite']},
|
||||
\ { 'complete_items': ['path']},
|
||||
\ { 'mode': '<c-p>'},
|
||||
\ { 'mode': '<c-n>'}
|
||||
\],
|
||||
\ 'default': [
|
||||
\ { 'complete_items': [ 'ts', 'lsp', 'snippet' ]},
|
||||
\ { 'complete_items': [ 'buffers' ] },
|
||||
\ { 'complete_items': [ 'path' ], 'triggered_only': ['/'] },
|
||||
\ { 'mode': '<c-p>'},
|
||||
\ { 'mode': '<c-n>'}
|
||||
\]
|
||||
\}
|
|
@ -2,5 +2,4 @@ command! LspHover lua vim.lsp.buf.hover()<CR>
|
|||
command! LspDisable lua vim.lsp.stop_client(vim.lsp.get_active_clients())<CR>
|
||||
|
||||
" actual LSP config takes place in lua ('lua/lsp')
|
||||
lua require("nvim-lspconfig")
|
||||
setlocal omnifunc=v:lua.vim.lsp.omnifunc
|
||||
|
|
16
nvim/.config/nvim/plugin/vim-terminator.vim
Normal file
16
nvim/.config/nvim/plugin/vim-terminator.vim
Normal file
|
@ -0,0 +1,16 @@
|
|||
let g:terminator_clear_default_mappings = "foo bar"
|
||||
let g:terminator_split_location = "vertical botright"
|
||||
|
||||
nnoremap <silent> <leader>rr :TerminatorStartREPL <CR>
|
||||
nnoremap <silent> <leader>rs :TerminatorStopRun <CR>
|
||||
|
||||
nnoremap <silent> <leader>rt :TerminatorRunFileInTerminal <CR>
|
||||
vnoremap <silent> <leader>rt :TerminatorRunPartOfFileInTerminal<CR>
|
||||
|
||||
nnoremap <silent> <leader>rd :TerminatorSendDelimiterToTerminal<CR>
|
||||
vnoremap <silent> <leader>rd :TerminatorSendSelectionToTerminal<CR>
|
||||
|
||||
nnoremap <silent> <leader>ra :norm O# In[ ]:hh
|
||||
|
||||
" lets you send fragments from jupyter-style blocks and markdown fences
|
||||
let g:terminator_repl_delimiter_regex = '\(In\[.*\]:\|^```\)'
|
|
@ -24,7 +24,7 @@ function! WikiFileOpen(...) abort dict
|
|||
silent execute '!xdg-open' fnameescape(self.path) '&'
|
||||
return 1
|
||||
endfunction
|
||||
let g:wiki_file_open = 'WikiFileOpen'
|
||||
let g:wiki_file_handler = 'WikiFileOpen'
|
||||
|
||||
" Zettelkasten functionality
|
||||
|
||||
|
@ -67,9 +67,9 @@ function! ZettelOpenAtCursor(...) abort
|
|||
|
||||
" fall back to normal link opening otherwise
|
||||
if l:zettel ==? ''
|
||||
call wiki#link#open()
|
||||
call wiki#link#follow()
|
||||
else
|
||||
call wiki#page#open(l:zettel)
|
||||
call wiki#page#follow(l:zettel)
|
||||
endif
|
||||
catch /E716:/
|
||||
call wiki#link#toggle(l:link)
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
" }}}
|
||||
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" automatically install vim-plug if it does not exist
|
||||
" Note: this installs it in the neovim folder, not the vim folder
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | q
|
||||
endif
|
||||
|
||||
" automatically install any missing plugins
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
|
||||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
" base
|
||||
Plug 'christoomey/vim-tmux-navigator' " allow seamless navigation between vim buffers and tmux splits
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle' " toggles numbers to absolute for all buffers but the current which is relative
|
||||
Plug 'justinmk/vim-sneak' " jump between letters with improved fFtT quicksearch
|
||||
Plug 'RRethy/vim-illuminate' " highlight other occurences of the word under cursor
|
||||
|
||||
" filedrawer
|
||||
Plug 'vifm/vifm.vim'
|
||||
|
||||
" editing
|
||||
Plug 'tpope/vim-commentary' " easily toggle comments for lines, paragraphs etc with gc
|
||||
Plug 'tpope/vim-surround' " lets you change surrounding things with cs (or ds to del, ys to add)
|
||||
Plug 'tommcdo/vim-exchange' " adds exchange operator with cx. common use: cxiw . on 2 words to switch
|
||||
Plug 'jiangmiao/auto-pairs' " Auto close brackets and ''
|
||||
Plug 'junegunn/vim-easy-align' " Align tables and other alignable things
|
||||
Plug 'junegunn/vim-peekaboo' " Show the contents of regiseters on pasting from '', @, <C-R>
|
||||
|
||||
" Fuzzy matching
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
||||
" neovim goodies: treesitter and lsp
|
||||
Plug 'neovim/nvim-lspconfig' " some commong language server configurations
|
||||
Plug 'glepnir/lspsaga.nvim' " nice and fast ui for lsp actions
|
||||
|
||||
Plug 'nvim-lua/completion-nvim' " simple completion engine built specifically for nvim and lsp
|
||||
Plug 'steelsojka/completion-buffers' " completion source from words found in current buffers
|
||||
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
Plug 'nvim-treesitter/completion-treesitter'
|
||||
|
||||
|
||||
Plug 'desmap/ale-sensible' | Plug 'w0rp/ale' " asynchronous linting - might be superseded by lsp or coc.nvim at some point
|
||||
" statusline
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'edkolev/tmuxline.vim'
|
||||
" Colorschemes
|
||||
Plug 'chriskempson/base16-vim'
|
||||
Plug 'reedes/vim-colors-pencil'
|
||||
|
||||
" RMarkdown & LaTeX workflow
|
||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||
Plug 'vim-pandoc/vim-pandoc'
|
||||
" Notes and Wiki
|
||||
Plug 'dyng/ctrlsf.vim' " search-and-edit of many wiki files at once
|
||||
Plug 'lervag/wiki.vim' " foundational wiki system, allowing links between plaintext files
|
||||
Plug 'alok/notational-fzf-vim' " quickly search through the wiki
|
||||
" Prose Workflow
|
||||
Plug 'micarmst/vim-spellsync' " personal dict improvements for git sync
|
||||
Plug 'ron89/thesaurus_query.vim' " find thesaurus backed synonyms for word under cursor
|
||||
Plug 'kana/vim-textobj-user' " dependency for most other textobj plugins
|
||||
Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detection
|
||||
" and allows you to jump to the *end* of this <g)> or last <g(> sentence.
|
||||
|
||||
Plug 'junegunn/goyo.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing
|
||||
Plug 'junegunn/limelight.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs)
|
||||
" Language Integration
|
||||
Plug 'euclidianAce/BetterLua.vim' " better syntax highlighting for lua
|
||||
|
||||
if !has('nvim')
|
||||
Plug 'tpope/vim-sensible'
|
||||
endif
|
||||
|
||||
" Plug 'liuchengxu/vim-which-key', { 'on': ['WhichKey', 'WhichKey!'] } ->
|
||||
" instructions: http://liuchengxu.org/vim-which-key/, needs setup tp become
|
||||
" useful. TODO enable when setup is more settled down
|
||||
|
||||
call plug#end()
|
||||
endif
|
|
@ -99,3 +99,4 @@ blog
|
|||
flexicurity
|
||||
indices
|
||||
Anthropocene
|
||||
ecotourism
|
||||
|
|
Loading…
Reference in a new issue