Compare commits
No commits in common. "7965036eed43084ec210c0ffcad3d6b6779c8a04" and "9f5bca4a62263fad0616c4a0da22f4931d5f5cad" have entirely different histories.
7965036eed
...
9f5bca4a62
17 changed files with 670 additions and 442 deletions
52
nvim/.config/nvim/after/plugin/bibcite.vim
Normal file
52
nvim/.config/nvim/after/plugin/bibcite.vim
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
" set up fzf-bibtex
|
||||||
|
let g:fzf_bibtex_cache = '~/.cache/'
|
||||||
|
let g:fzf_bibtex_sources = g:pandoc#biblio#bibs
|
||||||
|
|
||||||
|
" prepare bibtex_ls function to look for bib files in cwd/parent/subdirs,
|
||||||
|
" attach the standard bibtex source file
|
||||||
|
" return the command with standard cache directory filled
|
||||||
|
function! s:bibtex_ls(...)
|
||||||
|
let bibfiles = (
|
||||||
|
\ globpath('.', '*.bib', v:true, v:true) +
|
||||||
|
\ globpath('..', '*.bib', v:true, v:true) +
|
||||||
|
\ globpath('*/', '*.bib', v:true, v:true)
|
||||||
|
\ )
|
||||||
|
let bibfiles = join(bibfiles, ' ')
|
||||||
|
let source_cmd = 'bibtex-ls -cache ' . g:fzf_bibtex_cache . ' ' .bibfiles . ' ' . join(g:fzf_bibtex_sources)
|
||||||
|
return source_cmd
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" NORMAL MODE CITATION
|
||||||
|
" insert citation from normal mode at cursor (with brackets)
|
||||||
|
function! s:bibtex_cite_sink(lines)
|
||||||
|
let r=system("bibtex-cite ", a:lines)
|
||||||
|
execute ':normal! i[' . r . ']'
|
||||||
|
endfunction
|
||||||
|
command! -bang -nargs=* CiteRef call fzf#run(fzf#wrap({
|
||||||
|
\ 'source': <sid>bibtex_ls(<q-args>),
|
||||||
|
\ 'sink*': function('<sid>bibtex_cite_sink'),
|
||||||
|
\ 'up': '25%',
|
||||||
|
\ 'options': '--ansi --multi --prompt "Cite> "'
|
||||||
|
\ }))
|
||||||
|
|
||||||
|
" INSERT MODE CITATION
|
||||||
|
" insert citation from insert mode at cursor (no brackets inserted)
|
||||||
|
function! s:bibtex_cite_sink_insert(lines)
|
||||||
|
let r=system("bibtex-cite ", a:lines)
|
||||||
|
execute ':normal! i' . r
|
||||||
|
call feedkeys('a', 'n')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" MARKDOWN CITATION
|
||||||
|
" insert markdown formatted reference
|
||||||
|
function! s:bibtex_markdown_sink(lines)
|
||||||
|
let r=system("bibtex-markdown -cache " . g:fzf_bibtex_cache . ' ' . join(g:fzf_bibtex_sources), a:lines)
|
||||||
|
echo join(a:lines, '; ')
|
||||||
|
execute ':normal! a' . r
|
||||||
|
endfunction
|
||||||
|
command! -bang -nargs=* CiteMarkdown call fzf#run(fzf#wrap({
|
||||||
|
\ 'source': <sid>bibtex_ls(),
|
||||||
|
\ 'sink*': function('<sid>bibtex_markdown_sink'),
|
||||||
|
\ 'up': '25%',
|
||||||
|
\ 'options': '--ansi --multi --prompt "Markdown> "'
|
||||||
|
\ }))
|
|
@ -2,6 +2,11 @@
|
||||||
-- https://github.com/elianiva/dotfiles/ - with much gratitude
|
-- https://github.com/elianiva/dotfiles/ - with much gratitude
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
|
|
||||||
|
require('settings')
|
||||||
|
require('plugins')
|
||||||
|
require('look')
|
||||||
|
require('maps')
|
||||||
|
|
||||||
-- Highlight whatever is being yanked
|
-- Highlight whatever is being yanked
|
||||||
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
|
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||||
command = 'silent! lua require"vim.highlight".on_yank{timeout=500}',
|
command = 'silent! lua require"vim.highlight".on_yank{timeout=500}',
|
||||||
|
@ -31,26 +36,3 @@ vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||||
desc = "Fix neovim sizing issues if opening same time as alacritty",
|
desc = "Fix neovim sizing issues if opening same time as alacritty",
|
||||||
group = vim.api.nvim_create_augroup('alacritty_fixsize', { clear = true })
|
group = vim.api.nvim_create_augroup('alacritty_fixsize', { clear = true })
|
||||||
})
|
})
|
||||||
|
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
|
||||||
vim.fn.system({
|
|
||||||
"git",
|
|
||||||
"clone",
|
|
||||||
"--filter=blob:none",
|
|
||||||
"https://github.com/folke/lazy.nvim.git",
|
|
||||||
"--branch=stable", -- latest stable release
|
|
||||||
lazypath,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
vim.opt.rtp:prepend (lazypath)
|
|
||||||
|
|
||||||
-- set our leader key to space since with hjkl, space is largely useless
|
|
||||||
-- needs to be set before lazy.nvim is loaded
|
|
||||||
vim.g.mapleader = " "
|
|
||||||
|
|
||||||
require('settings')
|
|
||||||
require("lazy").setup("plugins")
|
|
||||||
require('look')
|
|
||||||
require('maps')
|
|
||||||
|
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
{
|
|
||||||
"BetterLua.vim": { "branch": "master", "commit": "d2d6c115575d09258a794a6f20ac60233eee59d5" },
|
|
||||||
"Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
|
|
||||||
"bats.vim": { "branch": "master", "commit": "6a5d2ef22b0ede503d867770afd02ebb1f97b709" },
|
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
|
||||||
"cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" },
|
|
||||||
"cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" },
|
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
|
||||||
"cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" },
|
|
||||||
"cmp-pandoc.nvim": { "branch": "main", "commit": "cb2980263e14fb3c1b776edbd2c7a312b67c65ae" },
|
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
|
||||||
"cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" },
|
|
||||||
"cmp-tmux": { "branch": "main", "commit": "984772716f66d8ee88535a6bf3f94c4b4e1301f5" },
|
|
||||||
"cmp-treesitter": { "branch": "master", "commit": "b40178b780d547bcf131c684bc5fd41af17d05f2" },
|
|
||||||
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
|
|
||||||
"completion-vcard": { "branch": "master", "commit": "2220fd517a985ececed1adcf0e5be8f2815564c7" },
|
|
||||||
"dial.nvim": { "branch": "master", "commit": "5020da900cc5dfd7067f181ee2ebd872ca7c84e8" },
|
|
||||||
"formatter.nvim": { "branch": "master", "commit": "8a4c961330cc4688087f23d18fa7d2f1af9a4902" },
|
|
||||||
"friendly-snippets": { "branch": "main", "commit": "a6f7a1609addb4e57daa6bedc300f77f8d225ab7" },
|
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "ec4742a7eebf68bec663041d359b95637242b5c3" },
|
|
||||||
"guihua.lua": { "branch": "master", "commit": "d3f6d01639b52e6a83ea98dd6ca244c9aa98b79b" },
|
|
||||||
"lazy.nvim": { "branch": "main", "commit": "273081443471cbc52c327bcb99614c32f247998d" },
|
|
||||||
"lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" },
|
|
||||||
"lsp_signature.nvim": { "branch": "master", "commit": "6f6252f63b0baf0f2224c4caea33819a27f3f550" },
|
|
||||||
"lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
|
|
||||||
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
|
|
||||||
"magma-nvim-goose": { "branch": "main", "commit": "94370733757d550594fe4a1d65643949d7485989" },
|
|
||||||
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
|
|
||||||
"mini.nvim": { "branch": "main", "commit": "dc0ccf1b0499d649a6177d2a406babcfe73b97de" },
|
|
||||||
"nabla.nvim": { "branch": "master", "commit": "ddbfc6e244e79db9280c535ee85c81388c5d1b46" },
|
|
||||||
"navigator.lua": { "branch": "master", "commit": "66d84151e94052f710b1dfb0d1fce2faaca6dced" },
|
|
||||||
"neorg": { "branch": "main", "commit": "36cc15300c0dfc19d483b0a4176cb89e94f4730a" },
|
|
||||||
"nui.nvim": { "branch": "main", "commit": "d147222a1300901656f3ebd5b95f91732785a329" },
|
|
||||||
"nvim-base16.lua": { "branch": "master", "commit": "b336f40462b3ca1ad16a17c195b83731a2942d9a" },
|
|
||||||
"nvim-cmp": { "branch": "main", "commit": "cfafe0a1ca8933f7b7968a287d39904156f2c57d" },
|
|
||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
|
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "aeb76066212b09c7c01a3abb42fe82f0130ef402" },
|
|
||||||
"nvim-surround": { "branch": "main", "commit": "a06dea11e7fdcf338776fa51fa5277163ffb048d" },
|
|
||||||
"nvim-toggleterm.lua": { "branch": "main", "commit": "19aad0f41f47affbba1274f05e3c067e6d718e1e" },
|
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "f6df07be122de665fb363476cc3680c90f5bdf05" },
|
|
||||||
"nvim-treesitter-context": { "branch": "master", "commit": "cacee4828152dd3a83736169ae61bbcd29a3d213" },
|
|
||||||
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "bc047b20768845fd54340eb76272b2cf2f6fa3f3" },
|
|
||||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" },
|
|
||||||
"nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" },
|
|
||||||
"otter.nvim": { "branch": "main", "commit": "e32e432988fddc7fc96f08300e56750a838f0893" },
|
|
||||||
"papis.nvim": { "branch": "main", "commit": "4023d30b336c147b12a249ce103561d03fbedef8" },
|
|
||||||
"playground": { "branch": "master", "commit": "c481c660fa903a0e295902b1765ecfbd6e76a556" },
|
|
||||||
"plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" },
|
|
||||||
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
|
||||||
"quarto-nvim": { "branch": "main", "commit": "a30db854054973ab8f140adf3e6b565bf2febf0f" },
|
|
||||||
"spellsitter.nvim": { "branch": "master", "commit": "4af8640d9d706447e78c13150ef7475ea2c16b30" },
|
|
||||||
"sqlite.lua": { "branch": "master", "commit": "93ff5824682ecc874200e338fd8ca9ccd08508f8" },
|
|
||||||
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
|
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" },
|
|
||||||
"telescope.nvim": { "branch": "master", "commit": "203bf5609137600d73e8ed82703d6b0e320a5f36" },
|
|
||||||
"twilight.nvim": { "branch": "main", "commit": "9410252bed96887ca5a86bf16435a3a51a0e6ce5" },
|
|
||||||
"vifm.vim": { "branch": "master", "commit": "199af91d6b1b4997450da2098e7e756627c6583b" },
|
|
||||||
"vim-criticmarkup": { "branch": "master", "commit": "d15dc134eb177a170c79f6377f81eb02a9d20b02" },
|
|
||||||
"vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" },
|
|
||||||
"vim-exchange": { "branch": "master", "commit": "784d63083ad7d613aa96f00021cd0dfb126a781a" },
|
|
||||||
"vim-numbertoggle": { "branch": "main", "commit": "075b7478777e694fbac330ee34a74590dad0fee1" },
|
|
||||||
"vim-oscyank": { "branch": "main", "commit": "e6298736a7835bcb365dd45a8e8bfe86d935c1f8" },
|
|
||||||
"vim-pandoc": { "branch": "master", "commit": "9f406d964ca70d959b7867f1b5cee3d4884d4d3c" },
|
|
||||||
"vim-pandoc-syntax": { "branch": "master", "commit": "4268535e1d33117a680a91160d845cd3833dfe28" },
|
|
||||||
"vim-spellsync": { "branch": "master", "commit": "27e103f2d283a1f6e24cc99dbdcd624713aff277" },
|
|
||||||
"vim-vsnip": { "branch": "master", "commit": "8dde8c0ef10bb1afdbb301e2bd7eb1c153dd558e" },
|
|
||||||
"which-key.nvim": { "branch": "main", "commit": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531" },
|
|
||||||
"zen-mode.nvim": { "branch": "main", "commit": "3c92f503823088862ca2a7809d1c7edc90fb92fa" },
|
|
||||||
"zettelkasten.nvim": { "branch": "main", "commit": "0e77624689b470410f5355b613d45219c9350264" }
|
|
||||||
}
|
|
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,30 +1,34 @@
|
||||||
local map = vim.keymap.set
|
local map = require 'cartographer'
|
||||||
|
|
||||||
-- The general ideas behind these mappings:
|
-- The general ideas behind these mappings:
|
||||||
--
|
--
|
||||||
-- * Leader prefix is the generally preferred way to map new things, however
|
-- * Leader prefix is the generally preferred way to map new things, however
|
||||||
-- only for those that affect all of vim of work in a supra-buffer way.
|
-- only for those that affect all of vim
|
||||||
--
|
--
|
||||||
-- * Localleader prefix is used for mappings which only affect single buffers.
|
-- * Localleader prefix is used for mappings which only affect single buffers,
|
||||||
-- In other words mostly filetype specific mappings
|
-- in other words mostly filetype specific mappings
|
||||||
|
--
|
||||||
|
-- many of these mapping ideas come from Tom Ryder who has them nicely
|
||||||
|
-- documented
|
||||||
|
|
||||||
-- backspace to switch to alternate (last) buffer
|
-- backspace to switch to alternate (last) buffer
|
||||||
map('n', '<BS>', '<C-^>')
|
map.n.nore['<BS>'] = '<C-^>'
|
||||||
|
|
||||||
-- since u undoes, would it not make sense that U redoes?
|
-- since u undoes, would it not make sense that U redoes?
|
||||||
map('n', 'U', '<C-r>')
|
map.n.nore['U'] = '<C-r>'
|
||||||
|
|
||||||
-- d-motion puts the last 'deleted' thing into the default register to paste;
|
-- d-motion puts the last 'deleted' thing into the default register to paste;
|
||||||
-- use D-motion to truly delete something into nothingness and keep whatever
|
-- use D-motion to truly delete something into nothingness and keep whatever
|
||||||
-- you want in your register, ready to paste
|
-- you want in your register, ready to paste
|
||||||
map('n', 'D', '"_d')
|
map.n.nore['D'] = '"_d'
|
||||||
|
|
||||||
-- I don't particularly need ex mode (at least, yet) but faster macro access is nice
|
-- I don't particularly need ex mode (at least, yet) but faster macro access
|
||||||
map('n', 'Q', '@')
|
-- is nice
|
||||||
|
map.n.nore['Q'] = '@'
|
||||||
|
|
||||||
-- stronger versions of left,right - move all the way to beginning/end of line
|
-- stronger versions of left,right - move all the way to beginning/end of line
|
||||||
map('n', 'H', '^')
|
map.n.nore['H'] = '^'
|
||||||
map('n', 'L', '$')
|
map.n.nore['L'] = '$'
|
||||||
|
|
||||||
-- when in softwrapped files, allow moving through the visible lines with j/k
|
-- when in softwrapped files, allow moving through the visible lines with j/k
|
||||||
-- but when prepending a number jump *exactly* as many lines, wrapped or not
|
-- but when prepending a number jump *exactly* as many lines, wrapped or not
|
||||||
|
@ -40,37 +44,44 @@ local function wrap_down()
|
||||||
return 'j'
|
return 'j'
|
||||||
end
|
end
|
||||||
|
|
||||||
map('n', 'k', wrap_up, { expr = true })
|
map.n.nore.expr['k'] = wrap_up
|
||||||
map('n', 'j', wrap_down, { expr = true })
|
map.n.nore.expr['j'] = wrap_down
|
||||||
|
|
||||||
-- move around between matching brackets with tab
|
-- move around between matching brackets with tab
|
||||||
map('n', '<Tab>', '%')
|
map.n.nore['<tab>'] = '%'
|
||||||
|
|
||||||
-- when in insertion mode, C-u uppercases the current word, C-l lowercases it,
|
-- when in insertion mode, C-u uppercases the current word, C-l lowercases it,
|
||||||
map('i', '<C-u>', '<esc>gUiw`]a')
|
map.i.nore['<C-u>'] = '<esc>gUiw`]a'
|
||||||
map('i', '<C-y>', '<esc>guiw`]a')
|
map.i.nore['<C-l>'] = '<esc>guiw`]a'
|
||||||
|
|
||||||
|
-- let me save stuff as sudo when I forget to call vim with it
|
||||||
|
map.c.nore['w!!'] =
|
||||||
|
[[execute 'silent! write !sudo tee % >/dev/null' <bar> edit!]]
|
||||||
|
|
||||||
-- yank current filename/filepath to f buffer
|
-- yank current filename/filepath to f buffer
|
||||||
map('n', 'yp', ':let @p = expand("%")<Cr>', { desc = 'yank filename' })
|
map.n.nore['yp'] = ':let @p = expand("%")<Cr>'
|
||||||
map('n', 'yP', ':let @p = expand("%:p")<Cr>', { desc = 'yank filepath' })
|
map.n.nore['yP'] = ':let @p = expand("%:p")<Cr>'
|
||||||
|
|
||||||
-- repeat the last substitute command with all its flags preserved
|
-- repeat the last substitute command with all its flags preserved
|
||||||
map('n', '&', ':&&<cr>')
|
map.n.nore['&'] = ':&&<cr>'
|
||||||
|
|
||||||
-- bracket pairings to go to the next/previous of:
|
-- bracket pairings to go to the next/previous of:
|
||||||
-- (works with count prefixes)
|
-- (works with count prefixes)
|
||||||
-- Argument list
|
-- Argument list
|
||||||
map('n', '[a', ':previous<cr>')
|
map.n.nore['[a'] = ':previous<cr>'
|
||||||
map('n', ']a', ':next<cr>')
|
map.n.nore[']a'] = ':next<cr>'
|
||||||
-- Buffers
|
-- Buffers
|
||||||
map('n', '[b', ':bprevious<cr>')
|
map.n.nore['[b'] = ':bprevious<cr>'
|
||||||
map('n', ']b', ':bnext<cr>')
|
map.n.nore[']b'] = ':bnext<cr>'
|
||||||
-- Quickfix list
|
-- Quickfix list
|
||||||
map('n', '[q', ':cprevious<cr>')
|
map.n.nore['[q'] = ':cprevious<cr>'
|
||||||
map('n', ']q', ':cnext<cr>')
|
map.n.nore[']q'] = ':cnext<cr>'
|
||||||
-- Location list
|
-- Location list
|
||||||
map('n', '[l', ':lprevious<cr>')
|
map.n.nore['[l'] = ':lprevious<cr>'
|
||||||
map('n', ']l', ':lnext<cr>')
|
map.n.nore[']l'] = ':lnext<cr>'
|
||||||
|
|
||||||
|
-- set our leader key to space since with hjkl, space is largely useless
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
-- maps the leader for buffer local mappings
|
-- maps the leader for buffer local mappings
|
||||||
-- since we are (atm) using sneak to go fwd/bwd in fFtT searches, comma does
|
-- since we are (atm) using sneak to go fwd/bwd in fFtT searches, comma does
|
||||||
|
@ -79,180 +90,181 @@ vim.g.maplocalleader = ","
|
||||||
|
|
||||||
-- If we mapped localleader to comma, we can still get to its original function
|
-- If we mapped localleader to comma, we can still get to its original function
|
||||||
-- by douple-tapping it.
|
-- by douple-tapping it.
|
||||||
-- FIXME does this work still (and is it necessary)?
|
|
||||||
if vim.g.maplocalleader == ',' then
|
if vim.g.maplocalleader == ',' then
|
||||||
map('', ',,', ',')
|
map.nore[',,'] = ','
|
||||||
vim.keymap.del('', ',,', { silent = true })
|
map.s[',,'] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- remove search highlights by pressing space+/
|
-- remove search highlights by pressing space+/
|
||||||
map('n', '<leader>/', ':noh<cr>', { desc = 'remove highlights' })
|
map.n.nore['<leader>/'] = ':noh<cr>'
|
||||||
|
|
||||||
-- split buffers vertically/horizontally with the leader \ or - (mirrors my
|
-- split buffers vertically/horizontally with the leader \ or - (mirrors my
|
||||||
-- tmux setup)
|
-- tmux setup)
|
||||||
map('n', '<leader>-', ':sp<cr>', { desc = 'open horiz split' })
|
map.n.nore['<leader>-'] = ':sp<cr>'
|
||||||
map('n', '<leader>\\', ':vsp<cr>', { desc = 'open vert split' })
|
map.n.nore['<leader>\\'] = ':vsp<cr>'
|
||||||
-- 'open new buffer' with leader-t (opens new buffer containing current dir and switches to it)
|
-- 'open new buffer' with leader-t (opens new buffer containing current dir and switches to it)
|
||||||
map('n', '<leader>t', ':vsp | Vifm<cr>', { desc = 'open buffer' })
|
map.n.nore['<leader>t'] = ':vsp .<cr>'
|
||||||
-- open actual new tab with leader-T
|
-- open actual new tab with leader-T
|
||||||
map('n', '<leader>T', ':tabedit | Vifm<cr>', { desc = 'open tab' })
|
map.n.nore['<leader>T'] = ':tabedit .<cr>'
|
||||||
|
|
||||||
-- select the whole buffer with <leader>-a
|
-- select the whole buffer with <leader>-a
|
||||||
map('n', '<leader>a', 'ggVG', { desc = 'select all' })
|
map.n.nore['<leader>a'] = 'ggVG'
|
||||||
|
|
||||||
-- PLUGIN: Navigator.nvim
|
-- CONFIG EDITING
|
||||||
map('n', '<c-w>h', '<CMD>lua require("Navigator").left()<cr>', { silent = true })
|
-- quickly edit vimrc with leader+V
|
||||||
map('n', '<c-w>k', '<CMD>lua require("Navigator").up()<cr>', { silent = true })
|
map.n.nore['<leader>V'] = ':vsp $MYVIMRC<cr>'
|
||||||
map('n', '<c-w>l', '<CMD>lua require("Navigator").right()<cr>', { silent = true })
|
-- source vimrc with keystroke combination
|
||||||
map('n', '<c-w>j', '<CMD>lua require("Navigator").down()<cr>', { silent = true })
|
map.n.nore['<leader>VV'] = ':source $MYVIMRC<cr>'
|
||||||
map('n', '<c-w>p', '<CMD>lua require("Navigator").previous()<cr>',
|
|
||||||
{ silent = true })
|
|
||||||
|
|
||||||
-- PLUGIN: Vifm.vim
|
-- PLUGIN: Vifm.vim
|
||||||
-- open/close file tree with leader-e
|
-- open/close file tree with leader-e
|
||||||
map('n', '<leader>e', ':Vifm<cr>', { desc = 'browse files' })
|
map.n.nore['<leader>e'] = ':Vifm<cr>'
|
||||||
-- open current file tree with current file directory
|
-- open current file tree with current file directory
|
||||||
map('n', '<leader>E', ':Vifm getcwd()<cr>', { desc = 'browse project' })
|
map.n.nore['<leader>E'] = ':Vifm getcwd()<cr>'
|
||||||
|
|
||||||
-- PLUGIN: Telescope GLOBAL FUZZY FINDING
|
-- PLUGIN: Telescope GLOBAL FUZZY FINDING
|
||||||
-- buffers and files in current workdir
|
-- buffers and files in current workdir
|
||||||
map('n', '<leader>s',
|
map.n.nore['<leader>s'] =
|
||||||
":lua require 'telescope.builtin'.buffers(require 'telescope.themes'.get_ivy())<cr>",
|
[[:lua require 'telescope.builtin'.buffers(require 'telescope.themes'.get_ivy())<cr>]]
|
||||||
{ desc = 'list buffers' })
|
|
||||||
-- most recently used / MRU, bound to S since it is essentially a larger
|
-- most recently used / MRU, bound to S since it is essentially a larger
|
||||||
-- go-back intention than just buffers
|
-- go-back intention than just buffers
|
||||||
map('n', '<leader>S',
|
map.n.nore['<leader>S'] =
|
||||||
":lua require 'telescope.builtin'.oldfiles(require 'telescope.themes'.get_ivy())<cr>",
|
[[:lua require 'telescope.builtin'.oldfiles(require 'telescope.themes'.get_ivy())<cr>]]
|
||||||
{ desc = 'list old files' })
|
|
||||||
-- fuzzy find files in cwd
|
-- fuzzy find files in cwd
|
||||||
map('n', '<leader>f', ":lua require 'telescope.builtin'.find_files()<cr>",
|
map.n.nore['<leader>f'] = [[:lua require 'telescope.builtin'.find_files()<cr>]]
|
||||||
{ desc = 'find files' })
|
|
||||||
-- fuzzy find hidden files in cwd
|
-- fuzzy find hidden files in cwd
|
||||||
map('n', '<leader><c-f>',
|
map.n.nore['<leader><c-f>'] =
|
||||||
":lua require 'telescope.builtin'.find_files({hidden=true})<cr>",
|
[[:lua require 'telescope.builtin'.find_files({hidden=true})<cr>]]
|
||||||
{ desc = 'find hidden files' })
|
|
||||||
-- general full-text search in cwd with rg
|
-- general full-text search in cwd with rg
|
||||||
map('n', '<leader>F', ":lua require 'telescope.builtin'.live_grep()<cr>",
|
map.n.nore['<leader>F'] = [[:lua require 'telescope.builtin'.live_grep()<cr>]]
|
||||||
{ desc = 'grep search' })
|
|
||||||
|
|
||||||
-- git status
|
-- git status
|
||||||
map('n', '<leader>gs', ":lua require 'telescope.builtin'.git_status()<cr>",
|
map.n.nore['<leader>gs'] = [[:lua require 'telescope.builtin'.git_status()<cr>]]
|
||||||
{ desc = 'git status' })
|
|
||||||
-- git buffercommits
|
-- git buffercommits
|
||||||
map('n', '<leader>gb', ":lua require 'telescope.builtin'.git_bcommits()<cr>",
|
map.n.nore['<leader>gb'] =
|
||||||
{ desc = 'git buffer commits' })
|
[[:lua require 'telescope.builtin'.git_bcommits()<cr>]]
|
||||||
-- git commitlog
|
-- git commitlog
|
||||||
map('n', '<leader>gl', ":lua require 'telescope.builtin'.git_commits()<cr>",
|
map.n.nore['<leader>gl'] =
|
||||||
{ desc = 'git commit log' })
|
[[:lua require 'telescope.builtin'.git_commits()<cr>]]
|
||||||
|
|
||||||
-- helptags
|
-- helptags
|
||||||
map('n', '<leader><F1>', ":lua require 'telescope.builtin'.help_tags()<cr>",
|
map.n.nore['<leader><F1>'] =
|
||||||
{ desc = 'help tags' })
|
[[:lua require 'telescope.builtin'.help_tags()<cr>]]
|
||||||
-- manpages
|
-- manpages
|
||||||
map('n', '<leader><F2>', ":lua require 'telescope.builtin'.man_pages()<cr>",
|
map.n.nore['<leader><F2>'] =
|
||||||
{ desc = 'man pages' })
|
[[:lua require 'telescope.builtin'.man_pages()<cr>]]
|
||||||
|
|
||||||
-- colorschemes
|
-- colorschemes
|
||||||
map('n', '<leader><F8>',
|
map.n.nore['<leader><F8>'] =
|
||||||
":lua require 'telescope.builtin'.colorscheme(require 'telescope.themes'.get_ivy())<cr>",
|
[[:lua require 'telescope.builtin'.colorscheme(require 'telescope.themes'.get_ivy())<cr>]]
|
||||||
{ desc = 'colorschemes' })
|
|
||||||
|
|
||||||
-- spell suggestions
|
-- spell suggestions
|
||||||
map('n', 'z=',
|
map.n.nore['z='] =
|
||||||
":lua require 'telescope.builtin'.spell_suggest(require 'telescope.themes'.get_ivy())<cr>")
|
[[:lua require 'telescope.builtin'.spell_suggest(require 'telescope.themes'.get_ivy())<cr>]]
|
||||||
|
|
||||||
|
-- PLUGIN: betterdigraphs
|
||||||
|
-- allow normal digraph insertion on c-k, telescope search on c-k c-k
|
||||||
|
map.i.nore['<C-k><C-k>'] = '<Cmd>lua require "betterdigraphs".digraphs("i")<CR>'
|
||||||
|
|
||||||
|
-- Note Searching
|
||||||
|
-- PLUGIN: Notational-FZF
|
||||||
|
-- set notational-fzf-vim keys for the NV window itself
|
||||||
|
vim.g.nv_fzf_binds = {
|
||||||
|
'alt-a:select-all', 'alt-q:deselect-all', 'alt-p:toggle-preview',
|
||||||
|
'alt-u:page-up', 'alt-d:page-down', 'ctrl-w:backward-kill-word'
|
||||||
|
}
|
||||||
|
-- FZF note full-text search with notational-velocity like functions (in wiki
|
||||||
|
-- directory)
|
||||||
|
map.n.nore['<leader>n'] = ':NV<cr>'
|
||||||
|
map.n.nore['<leader>N'] = ':NV!<cr>'
|
||||||
|
|
||||||
-- Format current Paragraph (esp useful in prose writing)
|
-- Format current Paragraph (esp useful in prose writing)
|
||||||
map('n', '<localleader>q', 'gqap',
|
map.n.nore.silent['<localleader>q'] = 'gqap'
|
||||||
{ silent = true, desc = 'Format current paragraph' })
|
map.x.nore.silent['<localleader>q'] = 'gq'
|
||||||
map('x', '<localleader>q', 'gq', { silent = true, desc = 'Format {motion}' })
|
map.n.nore.silent['<localleader>Q'] = 'vapJgqap'
|
||||||
map('n', '<localleader>Q', 'vapJgqap',
|
|
||||||
{ silent = true, desc = 'Unformat then format paragraph' })
|
|
||||||
|
|
||||||
map('n', '<localleader>mp', '<Plug>MarkdownPreviewToggle',
|
map.n.silent['<localleader>mp'] = '<Plug>MarkdownPreviewToggle'
|
||||||
{ desc = 'Toggle md preview' })
|
|
||||||
|
|
||||||
-- FORMAT code with
|
-- FORMAT code with
|
||||||
-- PLUGIN: formatter.nvim
|
-- PLUGIN: formatter.nvim
|
||||||
map('n', '<localleader>f', ':FormatLock<cr>')
|
map.n.nore.silent['<localleader>f'] = ':FormatLock<cr>'
|
||||||
map('n', '<localleader>F', ':FormatWriteLock<cr>')
|
map.n.nore.silent['<localleader>F'] = ':FormatWriteLock<cr>'
|
||||||
|
|
||||||
-- Enter distraction free prose mode with F11
|
-- Enter distraction free prose mode with F11
|
||||||
map('n', '<F11>', ':ZenMode<cr>', { silent = true })
|
map.n.nore.silent['<F11>'] = ':ZenMode<cr>'
|
||||||
|
|
||||||
|
-- PLUGIN: fzf-bibtex
|
||||||
|
-- map @@ to automatically insert citation reference at cursor
|
||||||
|
map.i.nore.silent['@@'] = '<c-g>u<c-o>:CiteRef<cr>'
|
||||||
|
-- map <leader>cc to insert a complete citation at cursor
|
||||||
|
|
||||||
-- SPELL CHECKING
|
-- SPELL CHECKING
|
||||||
-- Move to the prev/next spelling error with [S ]S
|
-- Move to the prev/next spelling error with [S ]S
|
||||||
-- Move to the prev/next spelling error or suggestion with [s ]s
|
-- Move to the prev/next spelling error or suggestion with [s ]s
|
||||||
map('n', '<localleader>ZZ', ':setlocal spell! spelllang=en_us,de_de<cr>',
|
map.n.nore['<localleader>ZZ'] = ':setlocal spell! spelllang=en_us,de_de<cr>'
|
||||||
{ desc = 'Toggle spellcheck' })
|
map.n.nore['<localleader>ZE'] = ':setlocal spell! spelllang=en_us<cr>'
|
||||||
map('n', '<localleader>ZE', ':setlocal spell! spelllang=en_us<cr>',
|
map.n.nore['<localleader>ZG'] = ':setlocal spell! spelllang=de_de<cr>'
|
||||||
{ desc = 'Toggle EN spellcheck' })
|
|
||||||
map('n', '<localleader>ZG', ':setlocal spell! spelllang=de_de<cr>',
|
|
||||||
{ desc = 'Toggle DE spellcheck' })
|
|
||||||
-- undo last spelling mistake from insert and normal mode
|
-- undo last spelling mistake from insert and normal mode
|
||||||
map('i', '<c-s>', '<C-G>u<Esc>[s1z=`]a<C-G>u')
|
map.i.nore['<c-s>'] = '<C-G>u<Esc>[s1z=`]a<C-G>u'
|
||||||
map('n', '<localleader>s', 'ms[s1z=`s', { desc = 'Fix last spell error' })
|
map.n.nore['<localleader>s'] = 'ms[s1z=`s'
|
||||||
|
|
||||||
-- PLUGIN: easy-align
|
-- PLUGIN: easy-align
|
||||||
-- Start interactive EasyAlign in visual mode (e.g. vipga)
|
-- Start interactive EasyAlign in visual mode (e.g. vipga)
|
||||||
map('x', 'ga', '<Plug>(EasyAlign)')
|
map.x['ga'] = '<Plug>(EasyAlign)'
|
||||||
-- Start interactive EasyAlign for a motion/text object (e.g. gaip)
|
-- Start interactive EasyAlign for a motion/text object (e.g. gaip)
|
||||||
map('n', 'ga', '<Plug>(EasyAlign)')
|
map.n['ga'] = '<Plug>(EasyAlign)'
|
||||||
|
|
||||||
-- PLUGIN: vnsip
|
-- PLUGIN: Navigator.nvim
|
||||||
-- jump around in snippets
|
map.n.nore.silent['<c-w>h'] = "<CMD>lua require('Navigator').left()<CR>"
|
||||||
map('i', '<Tab>', [[vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>']],
|
map.n.nore.silent['<c-w>k'] = "<CMD>lua require('Navigator').up()<CR>"
|
||||||
{ expr = true })
|
map.n.nore.silent['<c-w>l'] = "<CMD>lua require('Navigator').right()<CR>"
|
||||||
map('i', '<S-Tab>',
|
map.n.nore.silent['<c-w>j'] = "<CMD>lua require('Navigator').down()<CR>"
|
||||||
[[vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-next)' : '<S-Tab>']],
|
map.n.nore.silent['<c-w>p'] = "<CMD>lua require('Navigator').previous()<CR>"
|
||||||
{ expr = true })
|
|
||||||
|
-- PLUGIN: compe.nvim
|
||||||
|
-- lsp keymaps are set in lsp settings, only for lsp buffers
|
||||||
|
map.i.nore.expr.silent['<c-space>'] = 'compe#complete()'
|
||||||
|
map.i.expr['<Tab>'] =
|
||||||
|
[[vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>']]
|
||||||
|
map.i.expr['<S-Tab>'] =
|
||||||
|
[[vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-next)' : '<S-Tab>']]
|
||||||
|
|
||||||
-- PLUGIN: symbols-outline.nvim
|
-- PLUGIN: symbols-outline.nvim
|
||||||
map('n', '<leader>o', '<cmd>SymbolsOutline<cr>', { silent = true })
|
map.n.nore.silent['<leader>o'] = "<cmd>SymbolsOutline<cr>"
|
||||||
|
|
||||||
-- trim trailing whitespaces with mini.nvim trailspace
|
|
||||||
map("n", "<localleader>w", function() require("mini.trailspace").trim() end,
|
|
||||||
{ noremap = true })
|
|
||||||
|
|
||||||
-- PLUGIN: dial-increment
|
-- PLUGIN: dial-increment
|
||||||
map("n", "<C-a>", require("dial.map").inc_normal(), { noremap = true })
|
map.n['<c-a>'] = '<Plug>(dial-increment)'
|
||||||
map("n", "<C-x>", require("dial.map").dec_normal(), { noremap = true })
|
map.n['<c-x>'] = '<Plug>(dial-decrement)'
|
||||||
map("v", "<C-a>", require("dial.map").inc_visual(), { noremap = true })
|
map.v['<c-a>'] = '<Plug>(dial-increment)'
|
||||||
map("v", "<C-x>", require("dial.map").dec_visual(), { noremap = true })
|
map.v['<c-x>'] = '<Plug>(dial-decrement)'
|
||||||
map("v", "g<C-a>", require("dial.map").inc_gvisual(), { noremap = true })
|
map.v['g<c-a>'] = 'g<Plug>(dial-increment)'
|
||||||
map("v", "g<C-x>", require("dial.map").dec_gvisual(), { noremap = true })
|
map.v['g<c-x>'] = 'g<Plug>(dial-decrement)'
|
||||||
|
|
||||||
-- PLUGIN: zettelkasten.nvim
|
-- PLUGIN: zettelkasten.nvim
|
||||||
map('n', '<cr>', [[:silent lua require 'zettelkasten'.link_follow()<cr>]])
|
map.n.nore['<cr>'] = [[:silent lua require 'zettelkasten'.link_follow()<cr>]]
|
||||||
map('v', '<cr>', [[:lua require 'zettelkasten'.link_follow(true)<cr>]])
|
map.v.nore['<cr>'] = [[:lua require 'zettelkasten'.link_follow(true)<cr>]]
|
||||||
map('n', '<leader>ww', [[:lua require 'zettelkasten'.index_open()<cr> ]])
|
map.n.nore['<leader>ww'] = [[:lua require 'zettelkasten'.index_open()<cr> ]]
|
||||||
|
|
||||||
-- PLUGIN: toggleterm.nvim
|
-- PLUGIN: toggleterm.nvim
|
||||||
-- create a lazygit window, set up in toggleterm settings
|
-- create a lazygit window, set up in toggleterm settings
|
||||||
map('n', '<leader>G', ':Lazygit<cr>')
|
map.n.nore['<leader>G'] = ':Lazygit<cr>'
|
||||||
|
|
||||||
-- PLUGIN: magma-nvim
|
-- PLUGIN: magma-nvim
|
||||||
-- Operate jupyter notebooks from within vim
|
-- Operate jupyter notebooks from within vim
|
||||||
map('n', '<localleader>mm', ':MagmaEvaluateLine<cr>', { silent = true })
|
map.n.nore.silent['<localleader>rr'] = ':MagmaEvaluateLine<cr>'
|
||||||
map('n', '<localleader>M', '?^```{<cr>jV/```<cr>k:<C-u>MagmaEvaluateVisual<cr>',
|
map.n.nore.silent['<localleader>R'] = '?^```{<cr>jV/```<cr>k:<C-u>MagmaEvaluateVisual<cr>'
|
||||||
{ silent = true, desc = 'Evaluate current quarto cell' })
|
map.x.nore.silent['<localleader>r'] = ':<C-u>MagmaEvaluateVisual<cr>'
|
||||||
map('x', '<localleader>m', ':<C-u>MagmaEvaluateVisual<cr>', { silent = true })
|
map.n.nore.expr.silent['<localleader>r'] = "nvim_exec('MagmaEvaluateOperator', v:true)"
|
||||||
map('n', '<localleader>m', "nvim_exec('MagmaEvaluateOperator', v:true)",
|
map.n.nore.silent['<localleader>re'] = ':MagmaReevaluateCell<cr>'
|
||||||
{ expr = true, silent = true })
|
map.n.nore.silent['<localleader>ro'] = ':MagmaShowOutput<cr>'
|
||||||
map('n', '<localleader>mr', ':MagmaReevaluateCell<cr>', { silent = true })
|
map.n.nore.silent['<localleader>rq'] = ':noautocmd :MagmaEnterOutput<cr>'
|
||||||
map('n', '<localleader>ma', ':MagmaShowOutput<cr>', { silent = true })
|
map.n.nore.silent['<localleader>rc'] = ':MagmaDelete<cr>'
|
||||||
map('n', '<localleader>mq', ':noautocmd :MagmaEnterOutput<cr>',
|
map.n.nore.silent['<localleader>rd'] = ':MagmaInterrupt<cr>'
|
||||||
{ silent = true, desc = 'MagmaEnterOutput' })
|
|
||||||
map('n', '<localleader>md', ':MagmaDelete<cr>', { silent = true })
|
|
||||||
map('n', '<localleader>ms', ':MagmaInterrupt<cr>')
|
|
||||||
map('n', '<localleader>mI', ':MagmaInit ')
|
|
||||||
map('n', '<localleader>mD', ':MagmaDeinit<cr>')
|
|
||||||
map('n', '<localleader>mR', ':MagmaRestart<cr>')
|
|
||||||
|
|
||||||
|
map.n.nore.silent['<localleader>rO'] = ':lua vim.g.magma_automatically_open_output = not(vim.g.magma_automatically_open_output)<cr>'
|
||||||
-- jump to beginning of previous/ next cell code
|
-- jump to beginning of previous/ next cell code
|
||||||
map('n', ']c', '/^```{<cr>}:nohl<cr>', { desc = 'Next quarto cell' })
|
map.n.nore[']r'] = '/^```{<cr>}:nohl<cr>'
|
||||||
map('n', '[c', '?^```<cr>n}:nohl<cr>', { desc = 'Previous quarto cell' })
|
map.n.nore['[r'] = '?^```n<cr>}:nohl<cr>'
|
||||||
-- insert cell header above/below
|
-- insert cell header above/below
|
||||||
map('n', '<localleader>mo', 'o```{python}<cr><cr>```<esc>k',
|
map.n.nore['<leader>cO'] = ':IPythonCellInsertAbove<cr>a'
|
||||||
{ desc = 'Insert quarto cell below' })
|
map.n.nore['<leader>co'] = ':IPythonCellInsertBelow<cr>a'
|
||||||
map('n', '<localleader>mO', 'O```{python}<cr><cr>```<esc>k',
|
|
||||||
{ desc = 'Insert quarto cell above' })
|
|
||||||
|
|
33
nvim/.config/nvim/lua/plug/_autopair.lua
Normal file
33
nvim/.config/nvim/lua/plug/_autopair.lua
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
require('nvim-autopairs').setup({ check_ts = true })
|
||||||
|
|
||||||
|
--- Auto-space rules
|
||||||
|
local npairs = require 'nvim-autopairs'
|
||||||
|
local Rule = require 'nvim-autopairs.rule'
|
||||||
|
|
||||||
|
npairs.setup({
|
||||||
|
check_ts = true,
|
||||||
|
ts_config = {
|
||||||
|
lua = { 'string' }, -- it will not add a pair on that treesitter node
|
||||||
|
javascript = { 'template_string' },
|
||||||
|
java = false -- don't check treesitter on java
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
local ts_conds = require('nvim-autopairs.ts-conds')
|
||||||
|
|
||||||
|
-- press % => %% only while inside a comment or string
|
||||||
|
npairs.add_rules({
|
||||||
|
Rule("%", "%", "lua"):with_pair(ts_conds.is_ts_node({ 'string', 'comment' })),
|
||||||
|
Rule("$", "$", "lua"):with_pair(ts_conds.is_not_ts_node({ 'function' }))
|
||||||
|
})
|
||||||
|
|
||||||
|
npairs.add_rules {
|
||||||
|
Rule(' ', ' '):with_pair(function(opts)
|
||||||
|
local pair = opts.line:sub(opts.col, opts.col + 1)
|
||||||
|
return vim.tbl_contains({ '()', '[]', '{}' }, pair)
|
||||||
|
end)
|
||||||
|
}
|
||||||
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
local cmp = require('cmp')
|
||||||
|
cmp.event:on('confirm_done',
|
||||||
|
cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
|
@ -68,7 +68,7 @@ cmp.setup({
|
||||||
},
|
},
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'path' }, { name = 'nvim_lsp' }, { name = 'treesitter' },
|
{ name = 'path' }, { name = 'nvim_lsp' }, { name = 'treesitter' },
|
||||||
{ name = 'tmux' }, { name = 'vsnip' }, { name = 'otter' },
|
{ name = 'cmp_pandoc' }, { name = 'tmux' }, { name = 'vsnip' },
|
||||||
{ name = 'latex_symbols' }, { name = 'vCard' }, { name = 'nvim_lua' }
|
{ name = 'latex_symbols' }, { name = 'vCard' }, { name = 'nvim_lua' }
|
||||||
}, { { name = 'buffer' }, { name = 'spell' } })
|
}, { { name = 'buffer' }, { name = 'spell' } })
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,30 +1,7 @@
|
||||||
require('mini.ai').setup()
|
|
||||||
require('mini.comment').setup()
|
require('mini.comment').setup()
|
||||||
require('mini.cursorword').setup({delay = 500})
|
|
||||||
require('mini.fuzzy').setup()
|
|
||||||
require('mini.indentscope').setup({
|
require('mini.indentscope').setup({
|
||||||
symbol = "│",
|
symbol = "│",
|
||||||
draw = {animation = require('mini.indentscope').gen_animation('none')},
|
draw = {animation = require('mini.indentscope').gen_animation('none')},
|
||||||
options = {indent_at_cursor = false}
|
options = {indent_at_cursor = false}
|
||||||
})
|
})
|
||||||
require('mini.map').setup()
|
|
||||||
-- require('mini.move').setup() -- has not hit stable yet
|
|
||||||
require('mini.pairs').setup()
|
|
||||||
require('mini.trailspace').setup()
|
require('mini.trailspace').setup()
|
||||||
|
|
||||||
local starter = require('mini.starter')
|
|
||||||
starter.setup({
|
|
||||||
evaluate_single = true,
|
|
||||||
items = {
|
|
||||||
starter.sections.builtin_actions(),
|
|
||||||
starter.sections.recent_files(10, false),
|
|
||||||
starter.sections.recent_files(10, true),
|
|
||||||
-- Use this if you set up 'mini.sessions'
|
|
||||||
starter.sections.telescope()
|
|
||||||
},
|
|
||||||
content_hooks = {
|
|
||||||
starter.gen_hook.adding_bullet(),
|
|
||||||
starter.gen_hook.padding(3, 2),
|
|
||||||
starter.gen_hook.aligning('center', 'center')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
|
@ -12,12 +12,6 @@ require("telescope").setup {
|
||||||
},
|
},
|
||||||
generic_sorter = require('mini.fuzzy').get_telescope_sorter
|
generic_sorter = require('mini.fuzzy').get_telescope_sorter
|
||||||
},
|
},
|
||||||
defaults = {
|
|
||||||
-- Appearance
|
|
||||||
prompt_prefix = ' ',
|
|
||||||
selection_caret = ' ',
|
|
||||||
color_devicons = true
|
|
||||||
},
|
|
||||||
pickers = {
|
pickers = {
|
||||||
buffers = {theme = "ivy"},
|
buffers = {theme = "ivy"},
|
||||||
oldfiles = {theme = "ivy"},
|
oldfiles = {theme = "ivy"},
|
||||||
|
|
|
@ -1,118 +1,191 @@
|
||||||
local writing_ft = {"quarto", "pandoc", "markdown", "text", "tex"}
|
local ensure_packer = function()
|
||||||
|
local fn = vim.fn
|
||||||
|
local install_path = fn.stdpath('data') ..
|
||||||
|
'/site/pack/packer/start/packer.nvim'
|
||||||
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
|
fn.system({
|
||||||
|
'git', 'clone', '--depth', '1',
|
||||||
|
'https://github.com/wbthomason/packer.nvim', install_path
|
||||||
|
})
|
||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local packer_bootstrap = ensure_packer()
|
||||||
|
|
||||||
|
-- Compile on plugin edits
|
||||||
|
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||||
|
pattern = "plugins.lua",
|
||||||
|
command = "PackerCompile",
|
||||||
|
desc = "Compile plugins after editing plugin list",
|
||||||
|
group = vim.api.nvim_create_augroup('compilepackages', { clear = true })
|
||||||
|
})
|
||||||
|
|
||||||
|
local use = require("packer").use
|
||||||
|
require("packer").startup(function()
|
||||||
|
-- packer manages itself
|
||||||
|
use "wbthomason/packer.nvim"
|
||||||
|
|
||||||
return {
|
|
||||||
-- vim plugs
|
-- vim plugs
|
||||||
-- essential
|
-- essential
|
||||||
{'numToStr/Navigator.nvim', config = true}, -- allow seamless navigation between vim buffers and tmux/wezterm splits
|
use {
|
||||||
{'jeffkreeftmeijer/vim-numbertoggle', event = "BufEnter"}, -- toggles numbers to absolute for all buffers but the current which is relative
|
'numToStr/Navigator.nvim',
|
||||||
{'ojroques/vim-oscyank', event = "VeryLazy"}, -- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
|
config = function() require('Navigator').setup() end
|
||||||
{'ggandor/lightspeed.nvim', event = "VeryLazy"}, -- jump between letters with improved fFtT quicksearch, mimics sneak
|
} -- allow seamless navigation between vim buffers and tmux/wezterm splits
|
||||||
|
use 'jeffkreeftmeijer/vim-numbertoggle' -- toggles numbers to absolute for all buffers but the current which is relative
|
||||||
|
use 'RRethy/vim-illuminate' -- highlight other occurences of the word under cursor
|
||||||
|
use 'ojroques/vim-oscyank' -- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
|
||||||
|
use 'ggandor/lightspeed.nvim' -- jump between letters with improved fFtT quicksearch, mimics sneak
|
||||||
-- files
|
-- files
|
||||||
{'vifm/vifm.vim'}, -- integrate file manager
|
use 'vifm/vifm.vim' -- integrate file manager
|
||||||
{
|
use {
|
||||||
'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter
|
'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter
|
||||||
config = true,
|
requires = { 'nvim-lua/plenary.nvim' },
|
||||||
|
tag = 'release',
|
||||||
|
config = function() require('plug._gitsigns') end,
|
||||||
event = "BufRead"
|
event = "BufRead"
|
||||||
}, {
|
}
|
||||||
|
use {
|
||||||
'norcalli/nvim-colorizer.lua', -- color hex, named colors in the correct preview scheme
|
'norcalli/nvim-colorizer.lua', -- color hex, named colors in the correct preview scheme
|
||||||
config = true,
|
config = function() require('colorizer').setup() end,
|
||||||
event = "VeryLazy"
|
event = "BufRead"
|
||||||
}, {
|
}
|
||||||
|
use {
|
||||||
'mhartington/formatter.nvim', -- auto formatting on save
|
'mhartington/formatter.nvim', -- auto formatting on save
|
||||||
config = function() require('plug._format') end,
|
config = function() require('plug._format') end,
|
||||||
event = "VeryLazy"
|
event = "BufRead"
|
||||||
}, -- editing
|
}
|
||||||
{'kylechui/nvim-surround', version = '*', config = true, event = "VeryLazy"}, -- surround things with other things using ys/cs/ds
|
|
||||||
{
|
-- editing
|
||||||
|
-- use {'machakann/vim-sandwich', event = "BufRead"} -- surround things with other things using sa/sd/sr
|
||||||
|
use {
|
||||||
|
'kylechui/nvim-surround',
|
||||||
|
tag = '*',
|
||||||
|
config = function() require('nvim-surround').setup() end
|
||||||
|
} -- surround things with other things using ys/cs/ds
|
||||||
|
use {
|
||||||
'monaqa/dial.nvim', -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
|
'monaqa/dial.nvim', -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
|
||||||
event = "VeryLazy"
|
event = "BufRead"
|
||||||
}, {
|
}
|
||||||
|
use {
|
||||||
'tommcdo/vim-exchange', -- adds exchange operator with cx. common use: cxiw . on 2 words to switch
|
'tommcdo/vim-exchange', -- adds exchange operator with cx. common use: cxiw . on 2 words to switch
|
||||||
event = "VeryLazy"
|
event = "BufRead"
|
||||||
}, {
|
}
|
||||||
|
use {
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
config = function() require('plug._autopair') end,
|
||||||
|
event = "BufRead"
|
||||||
|
} -- Auto close brackets and ''
|
||||||
|
use {
|
||||||
'junegunn/vim-easy-align', -- Align tables and other alignable things
|
'junegunn/vim-easy-align', -- Align tables and other alignable things
|
||||||
event = "VeryLazy"
|
event = "BufRead"
|
||||||
}, -- colorschemes
|
}
|
||||||
{'norcalli/nvim-base16.lua'}, --
|
use {
|
||||||
|
'tversteeg/registers.nvim', -- Show the contents of regiseters on pasting from '', @, <C-R>
|
||||||
|
event = "BufRead"
|
||||||
|
}
|
||||||
|
use { -- highlight where the cursor jumps to
|
||||||
|
'edluffy/specs.nvim',
|
||||||
|
config = function() require('specs').setup {} end,
|
||||||
|
event = "BufRead"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- colorschemes
|
||||||
|
use 'norcalli/nvim-base16.lua'
|
||||||
|
|
||||||
-- statusline
|
-- statusline
|
||||||
{
|
use {
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
|
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
|
||||||
config = function() require('plug._lualine') end
|
config = function() require('plug._lualine') end
|
||||||
}, -- writing
|
|
||||||
{'vim-pandoc/vim-pandoc-syntax', ft = writing_ft},
|
|
||||||
{'vim-pandoc/vim-pandoc', ft = writing_ft},
|
|
||||||
{'vim-pandoc/vim-criticmarkup', ft = writing_ft}, {
|
|
||||||
'quarto-dev/quarto-nvim',
|
|
||||||
dependencies = {'jmbuhr/otter.nvim', 'neovim/nvim-lspconfig'},
|
|
||||||
config = function()
|
|
||||||
require'quarto'.setup {
|
|
||||||
lspFeatures = {
|
|
||||||
enabled = true,
|
|
||||||
languages = {'r', 'python', 'julia'},
|
|
||||||
diagnostics = {enabled = true, triggers = {"BufWrite"}},
|
|
||||||
completion = {enabled = true}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- writing
|
||||||
|
use { 'vim-pandoc/vim-pandoc-syntax' }
|
||||||
|
use { 'vim-pandoc/vim-pandoc' }
|
||||||
|
use { 'vim-pandoc/vim-criticmarkup' }
|
||||||
|
use {
|
||||||
|
"quarto-dev/quarto-vim",
|
||||||
|
requires = { { "vim-pandoc/vim-pandoc-syntax" } },
|
||||||
|
ft = { "quarto" }
|
||||||
}
|
}
|
||||||
end,
|
use 'micarmst/vim-spellsync' -- personal dict improvements for git sync
|
||||||
ft = writing_ft
|
use { 'folke/zen-mode.nvim', config = require('zen-mode').setup() } -- provide distraction free writing
|
||||||
}, {'micarmst/vim-spellsync', event = "VeryLazy"}, -- personal dict improvements for git sync
|
use 'folke/twilight.nvim' -- provide even distraction free-er writing (lowlight paragraphs)
|
||||||
{'folke/zen-mode.nvim', config = true, event = "VeryLazy"}, -- provide distraction free writing
|
use 'alok/notational-fzf-vim' -- quickly search through the wiki
|
||||||
{'folke/twilight.nvim', event = "VeryLazy"}, -- provide even distraction free-er writing (lowlight paragraphs)
|
use({
|
||||||
{'marty-oehme/zettelkasten.nvim', ft = writing_ft, event = "VeryLazy"}, -- simple static markdown linking
|
|
||||||
{
|
|
||||||
"iamcco/markdown-preview.nvim", -- generate an auto-updating html preview for md files
|
"iamcco/markdown-preview.nvim", -- generate an auto-updating html preview for md files
|
||||||
build = function() vim.fn["mkdp#util#install"]() end,
|
run = function() vim.fn["mkdp#util#install"]() end
|
||||||
ft = writing_ft
|
})
|
||||||
}, -- languages
|
|
||||||
{'euclidianAce/BetterLua.vim', ft = 'lua'}, -- better syntax highlighting for lua
|
-- languages
|
||||||
{'aliou/bats.vim', ft = {"bash", "sh", "zsh", "bats"}}, -- enable syntax for bats shell-code testing library
|
use { 'euclidianAce/BetterLua.vim', ft = 'lua' } -- better syntax highlighting for lua
|
||||||
|
use 'aliou/bats.vim' -- enable syntax for bats shell-code testing library
|
||||||
|
|
||||||
-- REPL work
|
-- REPL work
|
||||||
{
|
use {
|
||||||
'WhiteBlackGoose/magma-nvim-goose',
|
'WhiteBlackGoose/magma-nvim-goose',
|
||||||
build = ":UpdateRemotePlugins",
|
run = ":UpdateRemotePlugins",
|
||||||
config = function()
|
config = function()
|
||||||
vim.g.magma_image_provider = "kitty"
|
vim.g.magma_image_provider = "kitty"
|
||||||
vim.g.magma_automatically_open_output = false
|
vim.g.magma_automatically_open_output = false
|
||||||
end
|
end
|
||||||
}, -- nvim plugs
|
}
|
||||||
{
|
|
||||||
|
-- nvim plugs
|
||||||
|
use {
|
||||||
'echasnovski/mini.nvim',
|
'echasnovski/mini.nvim',
|
||||||
version = '*',
|
branch = 'stable',
|
||||||
config = function() require('plug._mini') end
|
config = function() require('plug._mini') end
|
||||||
},
|
}
|
||||||
{
|
use 'Iron-E/nvim-cartographer' -- makes it easier to set mappings through lua
|
||||||
|
use 'marty-oehme/zettelkasten.nvim' -- simple static markdown linking
|
||||||
|
use {
|
||||||
"akinsho/nvim-toggleterm.lua", -- simpler, programmable and multiple terminal toggling for nvim
|
"akinsho/nvim-toggleterm.lua", -- simpler, programmable and multiple terminal toggling for nvim
|
||||||
config = function() require('plug._toggleterm') end,
|
event = "BufWinEnter",
|
||||||
event = "BufWinEnter"
|
config = function() require('plug._toggleterm') end
|
||||||
},
|
}
|
||||||
{
|
use {
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
config = function() require("which-key").setup {} end
|
config = function() require("which-key").setup {} end
|
||||||
}, {
|
}
|
||||||
|
-- extensive organization plugin mimicking orgmode
|
||||||
|
use {
|
||||||
"nvim-neorg/neorg",
|
"nvim-neorg/neorg",
|
||||||
config = function() require("plug._neorg") end,
|
config = function() require("plug._neorg") end,
|
||||||
dependencies = {"nvim-lua/plenary.nvim"},
|
requires = "nvim-lua/plenary.nvim",
|
||||||
version = "*",
|
tag = "*"
|
||||||
ft = "norg"
|
}
|
||||||
}, -- extensive organization plugin mimicking orgmode
|
|
||||||
-- fuzzy matching
|
-- fuzzy matching
|
||||||
{"nvim-telescope/telescope-fzf-native.nvim", build = 'make'}, {
|
use {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
dependencies = {"nvim-lua/popup.nvim", "nvim-lua/plenary.nvim"},
|
requires = {
|
||||||
|
{ "nvim-lua/popup.nvim" }, { "nvim-lua/plenary.nvim" },
|
||||||
|
{ "nvim-telescope/telescope-fzf-native.nvim", run = 'make' }
|
||||||
|
},
|
||||||
config = function() require('plug._telescope') end
|
config = function() require('plug._telescope') end
|
||||||
}, -- snippeting
|
}
|
||||||
{"hrsh7th/vim-vsnip", event = "InsertEnter"}, -- snippet engine
|
use {
|
||||||
{"rafamadriz/friendly-snippets", event = "InsertEnter"}, -- many snippets
|
'protex/better-digraphs.nvim',
|
||||||
|
requires = { { "nvim-telescope/telescope.nvim" } }
|
||||||
|
}
|
||||||
|
|
||||||
|
-- snippeting
|
||||||
|
use { "hrsh7th/vim-vsnip", event = "InsertEnter" } -- snippet engine
|
||||||
|
use { "rafamadriz/friendly-snippets", event = "InsertEnter" } -- many snippets
|
||||||
|
|
||||||
-- treesitter
|
-- treesitter
|
||||||
{
|
use {
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
build = ':TSUpdate',
|
run = ':TSUpdate',
|
||||||
config = function() require('plug._treesitter') end
|
config = function() require('plug._treesitter') end
|
||||||
}, {'nvim-treesitter/playground', cmd = "TSPlaygroundToggle"}, -- interactively view and query the treesitter tree
|
}
|
||||||
{'romgrk/nvim-treesitter-context', event = "BufReadPre", config = true}, -- show current cursor context at top of buffer
|
use 'nvim-treesitter/playground' -- interactively view and query the treesitter tree
|
||||||
{
|
use 'romgrk/nvim-treesitter-context' -- show current cursor context at top of buffer
|
||||||
|
use {
|
||||||
'RRethy/nvim-treesitter-textsubjects', -- allows using . and ; to target treesitter branches
|
'RRethy/nvim-treesitter-textsubjects', -- allows using . and ; to target treesitter branches
|
||||||
config = function()
|
config = function()
|
||||||
require 'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
|
@ -124,51 +197,45 @@ return {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end,
|
end
|
||||||
event = "BufReadPre"
|
}
|
||||||
}, {'p00f/nvim-ts-rainbow', event = "BufReadPre"}, -- rainbow brackets using treesitter
|
use 'p00f/nvim-ts-rainbow' -- rainbow brackets using treesitter
|
||||||
{'JoosepAlviste/nvim-ts-context-commentstring', event = "BufReadPre"}, -- improves commenting plugin above by using ts
|
use 'JoosepAlviste/nvim-ts-context-commentstring' -- improves commenting plugin above by using ts
|
||||||
{
|
use {
|
||||||
'lewis6991/spellsitter.nvim', -- uses treesitter to highlight spelling errors
|
'lewis6991/spellsitter.nvim', -- uses treesitter to highlight spelling errors
|
||||||
config = function() require('spellsitter').setup() end,
|
config = function() require('spellsitter').setup() end
|
||||||
event = "BufReadPre"
|
}
|
||||||
}, -- lsp
|
|
||||||
{'neovim/nvim-lspconfig', event = "VeryLazy"}, -- some common language server configurations
|
-- lsp
|
||||||
{
|
use 'neovim/nvim-lspconfig' -- some commong language server configurations
|
||||||
|
use {
|
||||||
'simrat39/symbols-outline.nvim',
|
'simrat39/symbols-outline.nvim',
|
||||||
config = function() require('symbols-outline').setup() end,
|
config = function() require('symbols-outline').setup() end
|
||||||
event = "VeryLazy"
|
} -- vista-like outline view for code
|
||||||
}, -- vista-like outline view for code
|
use 'ray-x/lsp_signature.nvim'
|
||||||
{'ray-x/lsp_signature.nvim', event = "VeryLazy"},
|
use {
|
||||||
{'ray-x/guihua.lua', build = 'cd lua/fzy && make', event = "VeryLazy"}, {
|
|
||||||
'ray-x/navigator.lua',
|
'ray-x/navigator.lua',
|
||||||
config = function() require('plug._lsp') end,
|
requires = { 'ray-x/guihua.lua', run = 'cd lua/fzy && make' },
|
||||||
event = "VeryLazy"
|
config = function() require('plug._lsp') end
|
||||||
}, -- and completion
|
}
|
||||||
{
|
-- and completion
|
||||||
|
use {
|
||||||
'hrsh7th/nvim-cmp', -- simple completion engine built specifically for nvim and lsp
|
'hrsh7th/nvim-cmp', -- simple completion engine built specifically for nvim and lsp
|
||||||
dependencies = {
|
requires = {
|
||||||
'onsails/lspkind-nvim', 'andersevenrud/cmp-tmux', -- completion source from adjacent tmux panes
|
'onsails/lspkind-nvim', 'andersevenrud/cmp-tmux', -- completion source from adjacent tmux panes
|
||||||
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-path',
|
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-path',
|
||||||
'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-vsnip', 'hrsh7th/cmp-nvim-lua',
|
'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-vsnip', 'hrsh7th/cmp-nvim-lua',
|
||||||
'kdheepak/cmp-latex-symbols', 'ray-x/cmp-treesitter',
|
'kdheepak/cmp-latex-symbols', 'ray-x/cmp-treesitter',
|
||||||
'f3fora/cmp-spell', 'cbarrete/completion-vcard'
|
'f3fora/cmp-spell', 'cbarrete/completion-vcard'
|
||||||
},
|
}
|
||||||
event = "VeryLazy",
|
}
|
||||||
config = function() require('plug._cmp') end
|
use {
|
||||||
}, {
|
|
||||||
'aspeddro/cmp-pandoc.nvim',
|
'aspeddro/cmp-pandoc.nvim',
|
||||||
dependencies = {'nvim-lua/plenary.nvim', 'jbyuki/nabla.nvim'},
|
requires = { 'nvim-lua/plenary.nvim', 'jbyuki/nabla.nvim' }
|
||||||
event = "VeryLazy"
|
|
||||||
}, {
|
|
||||||
"jghauser/papis.nvim",
|
|
||||||
after = {"telescope.nvim", "nvim-cmp"},
|
|
||||||
dependencies = {
|
|
||||||
"kkharji/sqlite.lua", "nvim-lua/plenary.nvim",
|
|
||||||
"MunifTanjim/nui.nvim", "nvim-treesitter/nvim-treesitter"
|
|
||||||
},
|
|
||||||
event = "VeryLazy",
|
|
||||||
rocks = {"lyaml"},
|
|
||||||
config = function() require("papis").setup({}) end
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
require('plug._cmp')
|
||||||
|
|
||||||
|
-- Automatically set up your configuration after cloning packer.nvim
|
||||||
|
-- Put this at the end after all plugins
|
||||||
|
if packer_bootstrap then require('packer').sync() end
|
||||||
|
end)
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
|
require("helpers.vimoptions")
|
||||||
|
|
||||||
local default_builtins_disabled = {"netrw", "netrwPlugin"}
|
local default_builtins_disabled = {"netrw", "netrwPlugin"}
|
||||||
local disable_builtins = function(builtins)
|
local disable_builtins = function(builtins)
|
||||||
for _, plugin in pairs(builtins) do vim.g["loaded_" .. plugin] = 1 end
|
for _, plugin in pairs(builtins) do vim.g["loaded_" .. plugin] = 1 end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local apply_options = function(opts)
|
||||||
|
for k, v in pairs(opts) do vim.opt[k] = v end
|
||||||
|
end
|
||||||
|
|
||||||
local o = {
|
local o = {
|
||||||
termguicolors = true,
|
termguicolors = true,
|
||||||
-- sets tabs to be 2 characters, expanded into spaces, but still removable with
|
-- sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||||
|
@ -66,9 +72,6 @@ local o = {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v in pairs(o) do
|
|
||||||
vim.opt[k] = v
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_set_var('tex_flavor', 'latex')
|
vim.api.nvim_set_var('tex_flavor', 'latex')
|
||||||
|
apply_options(o)
|
||||||
disable_builtins(default_builtins_disabled)
|
disable_builtins(default_builtins_disabled)
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# load global sh env vars
|
||||||
|
[ -f "$XDG_CONFIG_HOME/sh/env" ] && source "$XDG_CONFIG_HOME/sh/env"
|
||||||
|
if [ -d "$XDG_CONFIG_HOME/sh/env.d" ]; then
|
||||||
|
for _env in "$XDG_CONFIG_HOME/sh/env.d"/*.sh; do
|
||||||
|
. "$_env"
|
||||||
|
done
|
||||||
|
unset _env
|
||||||
|
fi
|
||||||
|
|
||||||
# load zsh specific env vars
|
# load zsh specific env vars
|
||||||
if [ -d "$XDG_CONFIG_HOME/zsh/env.d" ]; then
|
if [ -d "$XDG_CONFIG_HOME/zsh/env.d" ]; then
|
||||||
for _env in "$XDG_CONFIG_HOME/zsh/env.d"/*.zsh; do
|
for _env in "$XDG_CONFIG_HOME/zsh/env.d"/*.zsh; do
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
[settings]
|
|
||||||
#opentool = zathura
|
|
||||||
#picktool = fzf
|
|
||||||
default-library = master
|
|
||||||
file-browser = vifm
|
|
||||||
ref-format = {doc[author_list][0][surname]}{doc[year]}
|
|
||||||
|
|
||||||
# edit info.yaml as new papers are added
|
|
||||||
add-edit = True
|
|
||||||
add-folder-name = {doc[ref]}-{doc[title]}
|
|
||||||
add-file-name = {doc[author_list][0][family]}{doc[year]}
|
|
||||||
header-format-file = ~/.config/papis/headerformat
|
|
||||||
extra-bibtex-keys = ["tags", "readstatus"]
|
|
||||||
|
|
||||||
database-backend = whoosh
|
|
||||||
whoosh-schema-fields = ["doi", "ref", "author", "year", "title", "publisher", "tags", "readstatus", "date", "isbn", "type", "keyword", "qualityassured"]
|
|
||||||
# to make whoosh list everything by default
|
|
||||||
default-query-string = *
|
|
||||||
|
|
||||||
notes-name = notes.qmd
|
|
||||||
notes-template = {doc[author_list][0][family]}{doc[year]}--{doc[title]}
|
|
||||||
|
|
||||||
mark-opener = zathura -P {mark[value]}
|
|
||||||
|
|
||||||
[tui]
|
|
||||||
editmore = vi
|
|
||||||
|
|
||||||
[master]
|
|
||||||
dir = ~/documents/library
|
|
||||||
|
|
||||||
[academia]
|
|
||||||
dir = ~/documents/library/academia
|
|
||||||
|
|
||||||
[cs]
|
|
||||||
dir = ~/documents/library/cs
|
|
|
@ -1,3 +0,0 @@
|
||||||
{doc.html_escape[title]}
|
|
||||||
<ansigreen>{doc.html_escape[author]}</ansigreen>
|
|
||||||
<ansiblue>({doc.html_escape[year]})</ansiblue> [<ansiyellow>{doc.html_escape[tags]}</ansiyellow>] [<ansired>{doc.html_escape[readstatus]}</ansired>]
|
|
|
@ -1,16 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# papis-short-help: Manually rebuild cache for all libraries
|
|
||||||
#
|
|
||||||
# This tiny script updates all libraries by rebuilding their caches.
|
|
||||||
# Useful to invoke after manual edits in one of your library folders
|
|
||||||
# so you don't have to think about which library you changed stuff in
|
|
||||||
# and just get everything updated. Might take a little time but
|
|
||||||
# should generally be a quick process (even with 1000s of entries).
|
|
||||||
|
|
||||||
import papis.api
|
|
||||||
|
|
||||||
libs = papis.api.get_libraries()
|
|
||||||
|
|
||||||
for lib in libs:
|
|
||||||
papis.api.clear_lib_cache(lib)
|
|
||||||
papis.api.get_all_documents_in_lib()
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# papis-short-help: Display pretty human-readable document overview
|
|
||||||
#
|
|
||||||
# TODO strip {} from bibtex entries to really pretty print
|
|
||||||
|
|
||||||
papis -l "${PAPIS_LIB}" list --format "{doc[author]} ({doc[year]}). {doc[title]}." "$@"
|
|
|
@ -2,7 +2,6 @@ include colorscheme
|
||||||
|
|
||||||
set recolor "true"
|
set recolor "true"
|
||||||
set selection-clipboard "clipboard"
|
set selection-clipboard "clipboard"
|
||||||
set first-page-column 1
|
|
||||||
|
|
||||||
map r reload
|
map r reload
|
||||||
map R rotate
|
map R rotate
|
||||||
|
|
Loading…
Reference in a new issue