lua: Format with stylua

This commit is contained in:
Marty Oehme 2023-06-15 10:12:30 +02:00
parent e434c191c9
commit 5f93ecba7c
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
33 changed files with 4062 additions and 3413 deletions

View file

@ -1,5 +1,5 @@
local ns = vim.api.nvim_create_namespace('gitcommit')
vim.api.nvim_set_hl(ns, 'ColorColumn', { bg = '#a33a3a', blend = 90 })
local ns = vim.api.nvim_create_namespace("gitcommit")
vim.api.nvim_set_hl(ns, "ColorColumn", { bg = "#a33a3a", blend = 90 })
vim.api.nvim_win_set_hl_ns(0, ns)
vim.bo.textwidth = 72
vim.wo.colorcolumn = '+0'
vim.wo.colorcolumn = "+0"

View file

@ -1,90 +1,91 @@
-- Start quarto session
local startsession = function(file, args)
file = file or "/tmp/jupyter-magma-session.json"
if args then file = args[0] end
vim.fn.jobstart({ "jupyter", "console", "-f", file }, {
on_stdout = function(_)
vim.cmd("MagmaInit " .. file)
vim.cmd("JupyterAttach " .. file)
end,
on_exit = function(_)
vim.notify(string.format("jupyter kernel stopped: %s", file), vim.log.levels.INFO)
end,
stdin = nil
})
file = file or "/tmp/jupyter-magma-session.json"
if args then
file = args[0]
end
vim.fn.jobstart({ "jupyter", "console", "-f", file }, {
on_stdout = function(_)
vim.cmd("MagmaInit " .. file)
vim.cmd("JupyterAttach " .. file)
end,
on_exit = function(_)
vim.notify(string.format("jupyter kernel stopped: %s", file), vim.log.levels.INFO)
end,
stdin = nil,
})
end
vim.api.nvim_create_user_command("JupyterStart", function() startsession() end,
{})
vim.api.nvim_create_user_command("JupyterStart", function()
startsession()
end, {})
local map = vim.keymap.set
-- filetype mappings
-- PLUGIN: magma-nvim
-- Operate jupyter notebooks from within vim
map('n', '<localleader>cc', ':MagmaEvaluateLine<cr>', { silent = true })
map('n', '<localleader>C', '?^```{<cr>jV/```<cr>k:<C-u>MagmaEvaluateVisual<cr>',
{ silent = true, desc = 'Evaluate current code cell' })
map('x', '<localleader>c', ':<C-u>MagmaEvaluateVisual<cr>', { silent = true })
map('n', '<localleader>c', "nvim_exec('MagmaEvaluateOperator', v:true)",
{ expr = true, silent = true, desc = '+code-evaluation' })
map('n', '<localleader>cr', ':MagmaReevaluateCell<cr>', { silent = true })
map('n', '<localleader>cu', ':MagmaShowOutput<cr>', { silent = true })
map('n', '<localleader>cU', ':noautocmd :MagmaEnterOutput<cr>',
{ silent = true, desc = 'MagmaEnterOutput' })
map('n', '<localleader>cd', ':MagmaDelete<cr>', { silent = true })
map('n', '<localleader>cs', ':MagmaInterrupt<cr>')
map('n', '<localleader>ci', ':MagmaInit ')
map('n', '<localleader>cD', ':MagmaDeinit<cr>')
map('n', '<localleader>cR', ':MagmaRestart<cr>')
map("n", "<localleader>cc", ":MagmaEvaluateLine<cr>", { silent = true })
map(
"n",
"<localleader>C",
"?^```{<cr>jV/```<cr>k:<C-u>MagmaEvaluateVisual<cr>",
{ silent = true, desc = "Evaluate current code cell" }
)
map("x", "<localleader>c", ":<C-u>MagmaEvaluateVisual<cr>", { silent = true })
map(
"n",
"<localleader>c",
"nvim_exec('MagmaEvaluateOperator', v:true)",
{ expr = true, silent = true, desc = "+code-evaluation" }
)
map("n", "<localleader>cr", ":MagmaReevaluateCell<cr>", { silent = true })
map("n", "<localleader>cu", ":MagmaShowOutput<cr>", { silent = true })
map("n", "<localleader>cU", ":noautocmd :MagmaEnterOutput<cr>", { silent = true, desc = "MagmaEnterOutput" })
map("n", "<localleader>cd", ":MagmaDelete<cr>", { silent = true })
map("n", "<localleader>cs", ":MagmaInterrupt<cr>")
map("n", "<localleader>ci", ":MagmaInit ")
map("n", "<localleader>cD", ":MagmaDeinit<cr>")
map("n", "<localleader>cR", ":MagmaRestart<cr>")
-- jump to beginning of previous/ next cell code
map('n', ']c', '/^```{<cr>}:nohl<cr>', { desc = 'Next quarto cell' })
map('n', '[c', '?^```<cr>n}:nohl<cr>', { desc = 'Previous quarto cell' })
map("n", "]c", "/^```{<cr>}:nohl<cr>", { desc = "Next quarto cell" })
map("n", "[c", "?^```<cr>n}:nohl<cr>", { desc = "Previous quarto cell" })
-- insert cell header above/below
map('n', '<localleader>co', 'o```{python}<cr><cr>```<esc>k',
{ desc = 'Insert quarto cell below' })
map('n', '<localleader>cO', 'O```{python}<cr><cr>```<esc>k',
{ desc = 'Insert quarto cell above' })
map("n", "<localleader>co", "o```{python}<cr><cr>```<esc>k", { desc = "Insert quarto cell below" })
map("n", "<localleader>cO", "O```{python}<cr><cr>```<esc>k", { desc = "Insert quarto cell above" })
local bufnr = 0
map('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>',
{ buffer = bufnr, desc = 'Previous diagnostic' })
map('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>',
{ buffer = bufnr, desc = 'Next diagnostic' })
map('n', '[e',
'<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<cr>',
{ buffer = bufnr, desc = 'Previous error' })
map('n', ']e',
'<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<cr>',
{ buffer = bufnr, desc = 'Next error' })
map("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { buffer = bufnr, desc = "Previous diagnostic" })
map("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<cr>", { buffer = bufnr, desc = "Next diagnostic" })
map(
"n",
"[e",
"<cmd>lua vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR})<cr>",
{ buffer = bufnr, desc = "Previous error" }
)
map(
"n",
"]e",
"<cmd>lua vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR})<cr>",
{ buffer = bufnr, desc = "Next error" }
)
-- TODO find better way to enable lsp key mappings for quarto buffers
local prefix = require('which-key').register
prefix({ ['<localleader>l'] = { name = "+lsp" } })
map('n', '<localleader>li', '<cmd>LspInfo<cr>',
{ buffer = bufnr, desc = 'Lsp Info' })
map('n', '<localleader>ld', '<cmd>lua vim.diagnostic.open_float()<cr>',
{ buffer = bufnr, desc = 'Line diagnostics' })
map('n', '<localleader>la', '<cmd>lua vim.lsp.buf.code_action()<cr>',
{ buffer = bufnr, desc = 'Codeactions' })
map('n', '<localleader>ln', '<cmd>lua vim.lsp.buf.rename()<cr>',
{ buffer = bufnr, desc = 'Rename element' })
map('n', '<localleader>lr', '<cmd>lua vim.lsp.buf.references()<cr>',
{ buffer = bufnr, desc = 'References' })
local prefix = require("which-key").register
prefix({ ["<localleader>l"] = { name = "+lsp" } })
map("n", "<localleader>li", "<cmd>LspInfo<cr>", { buffer = bufnr, desc = "Lsp Info" })
map("n", "<localleader>ld", "<cmd>lua vim.diagnostic.open_float()<cr>", { buffer = bufnr, desc = "Line diagnostics" })
map("n", "<localleader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", { buffer = bufnr, desc = "Codeactions" })
map("n", "<localleader>ln", "<cmd>lua vim.lsp.buf.rename()<cr>", { buffer = bufnr, desc = "Rename element" })
map("n", "<localleader>lr", "<cmd>lua vim.lsp.buf.references()<cr>", { buffer = bufnr, desc = "References" })
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>',
{ buffer = bufnr, desc = 'Hover definition' })
map('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>',
{ buffer = bufnr, desc = 'Definition' })
map('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>',
{ buffer = bufnr, desc = 'Declaration' })
map('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>',
{ buffer = bufnr, desc = 'Signature help' })
map('n', 'gI', '<cmd>lua vim.lsp.buf.implementation()<cr>',
{ buffer = bufnr, desc = 'Implementation' })
map('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<cr>',
{ buffer = bufnr, desc = 'Type definition' })
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", { buffer = bufnr, desc = "Hover definition" })
map("n", "gd", "<cmd>lua vim.lsp.buf.definition()<cr>", { buffer = bufnr, desc = "Definition" })
map("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<cr>", { buffer = bufnr, desc = "Declaration" })
map("n", "gs", "<cmd>lua vim.lsp.buf.signature_help()<cr>", { buffer = bufnr, desc = "Signature help" })
map("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<cr>", { buffer = bufnr, desc = "Implementation" })
map("n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<cr>", { buffer = bufnr, desc = "Type definition" })
if vim.b['sessionfile'] == nil then
vim.b['sessionfile'] = vim.fn.tempname() .. '.json'
startsession(vim.b['sessionfile'])
if vim.b["sessionfile"] == nil then
vim.b["sessionfile"] = vim.fn.tempname() .. ".json"
startsession(vim.b["sessionfile"])
end

View file

@ -2,15 +2,18 @@
-- https://github.com/elianiva/dotfiles/ - with much gratitude
local api = vim.api
api.nvim_exec2('runtime abbrev.vim', {})
api.nvim_exec2("runtime abbrev.vim", {})
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
})
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)
@ -18,14 +21,14 @@ vim.opt.rtp:prepend(lazypath)
-- needs to be set before lazy.nvim is loaded
vim.g.mapleader = " "
require('settings')
require('autocmds')
require("settings")
require("autocmds")
require("lazy").setup("plugins", {
defaults = { version = "*" },
performance = { rtp = { disabled_plugins = { "netrw", "netrwPlugin" } } }
defaults = { version = "*" },
performance = { rtp = { disabled_plugins = { "netrw", "netrwPlugin" } } },
})
require('look')
require('maps')
require("look")
require("maps")
-- to include e.g. the spell dictionaries for vim
vim.opt.rtp:append(vim.fn.stdpath("data") .. "/site")

View file

@ -1,33 +1,37 @@
-- Highlight whatever is being yanked
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
command = 'silent! lua require"vim.highlight".on_yank{timeout=500}',
desc = "Highlight yanked text whenevery yanking something",
group = vim.api.nvim_create_augroup('highlightyanks', { clear = true })
command = 'silent! lua require"vim.highlight".on_yank{timeout=500}',
desc = "Highlight yanked text whenevery yanking something",
group = vim.api.nvim_create_augroup("highlightyanks", { clear = true }),
})
-- Special setting for editing gopass files - make sure nothing leaks outside the directories it is supposed to
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
pattern = {
"/dev/shm/gopass.*", "/dev/shm/pass.?*/?*.txt",
"$TMPDIR/pass.?*/?*.txt", "/tmp/pass.?*/?*.txt"
},
command = 'setlocal noswapfile nobackup noundofile nowritebackup viminfo=',
desc = "Don't leak any information when editing potential password files",
group = vim.api.nvim_create_augroup('passnoleak', { clear = true })
pattern = {
"/dev/shm/gopass.*",
"/dev/shm/pass.?*/?*.txt",
"$TMPDIR/pass.?*/?*.txt",
"/tmp/pass.?*/?*.txt",
},
command = "setlocal noswapfile nobackup noundofile nowritebackup viminfo=",
desc = "Don't leak any information when editing potential password files",
group = vim.api.nvim_create_augroup("passnoleak", { clear = true }),
})
-- fixing neovim opening up at same moment as alacritty (see https://github.com/neovim/neovim/issues/11330)
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function()
local pid, WINCH = vim.fn.getpid(), vim.loop.constants.SIGWINCH
vim.defer_fn(function() vim.loop.kill(pid, WINCH) end, 20)
end,
desc = "Fix neovim sizing issues if opening same time as alacritty",
group = vim.api.nvim_create_augroup('alacritty_fixsize', { clear = true })
callback = function()
local pid, WINCH = vim.fn.getpid(), vim.loop.constants.SIGWINCH
vim.defer_fn(function()
vim.loop.kill(pid, WINCH)
end, 20)
end,
desc = "Fix neovim sizing issues if opening same time as alacritty",
group = vim.api.nvim_create_augroup("alacritty_fixsize", { clear = true }),
})
-- remove line numbers from terminal buffers
vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = '*',
command = 'setlocal nonumber norelativenumber'
pattern = "*",
command = "setlocal nonumber norelativenumber",
})

View file

@ -1,15 +1,17 @@
local colorsfile = vim.fn.stdpath('state') .. '/colorscheme.lua'
local colorsfile = vim.fn.stdpath("state") .. "/colorscheme.lua"
local function source_colors()
if vim.fn.filereadable(colorsfile) == 1 then
vim.cmd("source " .. colorsfile)
end
if vim.fn.filereadable(colorsfile) == 1 then
vim.cmd("source " .. colorsfile)
end
end
-- set on startup
source_colors()
-- continuously watch colors file for changes
local fwatch = require('fwatch')
local fwatch = require("fwatch")
fwatch.watch(colorsfile, {
on_event = vim.schedule_wrap(function() source_colors() end)
on_event = vim.schedule_wrap(function()
source_colors()
end),
})

View file

@ -1,5 +1,5 @@
local map = vim.keymap.set
local prefix = require('which-key').register
local prefix = require("which-key").register
-- The general ideas behind these mappings:
--
@ -10,73 +10,77 @@ local prefix = require('which-key').register
-- In other words mostly filetype specific mappings
-- backspace to switch to alternate (last) buffer
map('n', '<BS>', '<C-^>')
map("n", "<BS>", "<C-^>")
-- since u undoes, would it not make sense that U redoes?
map('n', 'U', '<C-r>')
map("n", "U", "<C-r>")
-- 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
-- you want in your register, ready to paste
map('n', 'D', '"_d')
map("n", "D", '"_d')
-- I don't particularly need ex mode (at least, yet) but faster macro access is nice
map('n', 'Q', '@')
map("n", "Q", "@")
-- stronger versions of left,right - move all the way to beginning/end of line
map('n', 'H', '^')
map('n', 'L', '$')
map("n", "H", "^")
map("n", "L", "$")
-- 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
-- This makes relative linenumbers much more useful in prose docs since they
-- are always exactly correct
local function wrap_up()
if vim.v.count == 0 then return 'gk' end
return 'k'
if vim.v.count == 0 then
return "gk"
end
return "k"
end
local function wrap_down()
if vim.v.count == 0 then return 'gj' end
return 'j'
if vim.v.count == 0 then
return "gj"
end
return "j"
end
map('n', 'k', wrap_up, { expr = true })
map('n', 'j', wrap_down, { expr = true })
map("n", "k", wrap_up, { expr = true })
map("n", "j", wrap_down, { expr = true })
-- move around between matching brackets with tab
map('n', '<Tab>', '%')
map("n", "<Tab>", "%")
-- when in insertion mode, C-u uppercases the current word, C-l lowercases it,
map('i', '<C-u>', '<esc>gUiw`]a')
map('i', '<C-y>', '<esc>guiw`]a')
map("i", "<C-u>", "<esc>gUiw`]a")
map("i", "<C-y>", "<esc>guiw`]a")
-- Add undo break-points at punctuations for plaintext editing
for _, char in pairs({ ",", ".", ";", "?", "!" }) do
map("i", char, string.format("%s<c-g>u", char))
map("i", char, string.format("%s<c-g>u", char))
end
-- yank current filename/filepath to f buffer
map('n', 'yp', ':let @p = expand("%")<Cr>', { desc = 'yank filename' })
map('n', 'yP', ':let @p = expand("%:p")<Cr>', { desc = 'yank filepath' })
map("n", "yp", ':let @p = expand("%")<Cr>', { desc = "yank filename" })
map("n", "yP", ':let @p = expand("%:p")<Cr>', { desc = "yank filepath" })
-- repeat the last substitute command with all its flags preserved
map('n', '&', ':&&<cr>')
map("n", "&", ":&&<cr>")
-- bracket pairings to go to the next/previous of:
-- (works with count prefixes)
-- Argument list
map('n', '[a', ':previous<cr>')
map('n', ']a', ':next<cr>')
map("n", "[a", ":previous<cr>")
map("n", "]a", ":next<cr>")
-- Buffers
map('n', '[b', ':bprevious<cr>')
map('n', ']b', ':bnext<cr>')
map("n", "[b", ":bprevious<cr>")
map("n", "]b", ":bnext<cr>")
-- Quickfix list
map('n', '[q', ':cprevious<cr>')
map('n', ']q', ':cnext<cr>')
map("n", "[q", ":cprevious<cr>")
map("n", "]q", ":cnext<cr>")
-- Location list
map('n', '[l', ':lprevious<cr>')
map('n', ']l', ':lnext<cr>')
map("n", "[l", ":lprevious<cr>")
map("n", "]l", ":lnext<cr>")
-- maps the leader for buffer local mappings
-- since we are (atm) using sneak to go fwd/bwd in fFtT searches, comma does
@ -86,198 +90,193 @@ vim.g.maplocalleader = ","
-- If we mapped localleader to comma, we can still get to its original function
-- by douple-tapping it.
-- FIXME does this work still (and is it necessary)?
if vim.g.maplocalleader == ',' then
map('', ',,', ',')
vim.keymap.del('', ',,', { silent = true })
if vim.g.maplocalleader == "," then
map("", ",,", ",")
vim.keymap.del("", ",,", { silent = true })
end
-- remove search highlights by pressing space+/
map('n', '<leader>/', ':noh<cr>', { desc = 'remove highlights' })
map("n", "<leader>/", ":noh<cr>", { desc = "remove highlights" })
-- split buffers vertically/horizontally with the leader \ or - (mirrors my
-- tmux setup)
map('n', '<leader>-', ':sp<cr>', { desc = 'open horiz split' })
map('n', '<leader>\\', ':vsp<cr>', { desc = 'open vert split' })
map("n", "<leader>-", ":sp<cr>", { desc = "open horiz split" })
map("n", "<leader>\\", ":vsp<cr>", { desc = "open vert split" })
-- '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", "<leader>t", ":vsp | Vifm<cr>", { desc = "open buffer" })
-- open actual new tab with leader-T
map('n', '<leader>T', ':tabedit | Vifm<cr>', { desc = 'open tab' })
map("n", "<leader>T", ":tabedit | Vifm<cr>", { desc = "open tab" })
-- select the whole buffer with <leader>-a
map('n', '<leader>a', 'ggVG', { desc = 'select all' })
map("n", "<leader>a", "ggVG", { desc = "select all" })
-- PLUGIN: Navigator.nvim
map('n', '<c-w>h', '<CMD>lua require("Navigator").left()<cr>', { silent = true })
map('n', '<c-w>k', '<CMD>lua require("Navigator").up()<cr>', { silent = true })
map('n', '<c-w>l', '<CMD>lua require("Navigator").right()<cr>', { silent = true })
map('n', '<c-w>j', '<CMD>lua require("Navigator").down()<cr>', { silent = true })
map('n', '<c-w>p', '<CMD>lua require("Navigator").previous()<cr>',
{ silent = true })
map("n", "<c-w>h", '<CMD>lua require("Navigator").left()<cr>', { silent = true })
map("n", "<c-w>k", '<CMD>lua require("Navigator").up()<cr>', { silent = true })
map("n", "<c-w>l", '<CMD>lua require("Navigator").right()<cr>', { silent = true })
map("n", "<c-w>j", '<CMD>lua require("Navigator").down()<cr>', { silent = true })
map("n", "<c-w>p", '<CMD>lua require("Navigator").previous()<cr>', { silent = true })
-- PLUGIN: Vifm.vim
-- open/close file tree with leader-e
map('n', '<leader>e', ':Vifm<cr>', { desc = 'browse files' })
map("n", "<leader>e", ":Vifm<cr>", { desc = "browse files" })
-- open current file tree with current file directory
map('n', '<leader>E', ':Vifm getcwd()<cr>', { desc = 'browse project' })
map("n", "<leader>E", ":Vifm getcwd()<cr>", { desc = "browse project" })
-- set 'v'im-related options
prefix({ ['<leader>v'] = { name = "+vim" } })
map('n', '<leader>vc', ':Vifm ' .. vim.fn.stdpath('config') .. '/lua<cr>',
{ desc = 'open config' })
map('n', '<leader>vh', ":lua require 'telescope.builtin'.help_tags()<cr>",
{ desc = 'help tags' })
map('n', '<leader>vH', ":lua require 'telescope.builtin'.man_pages()<cr>",
{ desc = 'man pages' })
map('n', '<leader>vC',
":lua require 'telescope.builtin'.colorscheme(require 'telescope.themes'.get_ivy())<cr>",
{ desc = 'colorschemes' })
map('n', '<leader>vl', ":Lazy<cr>", { desc = 'Lazy' })
map('n', '<leader>vm', ":Mason<cr>", { desc = 'Mason' })
prefix({ ["<leader>v"] = { name = "+vim" } })
map("n", "<leader>vc", ":Vifm " .. vim.fn.stdpath("config") .. "/lua<cr>", { desc = "open config" })
map("n", "<leader>vh", ":lua require 'telescope.builtin'.help_tags()<cr>", { desc = "help tags" })
map("n", "<leader>vH", ":lua require 'telescope.builtin'.man_pages()<cr>", { desc = "man pages" })
map(
"n",
"<leader>vC",
":lua require 'telescope.builtin'.colorscheme(require 'telescope.themes'.get_ivy())<cr>",
{ desc = "colorschemes" }
)
map("n", "<leader>vl", ":Lazy<cr>", { desc = "Lazy" })
map("n", "<leader>vm", ":Mason<cr>", { desc = "Mason" })
-- Set vim to distraction free prose mode with F11
map('n', '<leader>vz', ':ZenMode<cr>', { silent = true })
map("n", "<leader>vz", ":ZenMode<cr>", { silent = true })
-- PLUGIN: Telescope GLOBAL FUZZY FINDING
-- buffers and files in current workdir
prefix({ ['<leader>f'] = { name = '+find' } })
map('n', '<leader>fb',
":lua require 'telescope.builtin'.buffers(require 'telescope.themes'.get_ivy())<cr>",
{ desc = 'list buffers' })
prefix({ ["<leader>f"] = { name = "+find" } })
map(
"n",
"<leader>fb",
":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
-- go-back intention than just buffers
map('n', '<leader>fo',
":lua require 'telescope.builtin'.oldfiles(require 'telescope.themes'.get_ivy())<cr>",
{ desc = 'list old files' })
map(
"n",
"<leader>fo",
":lua require 'telescope.builtin'.oldfiles(require 'telescope.themes'.get_ivy())<cr>",
{ desc = "list old files" }
)
-- fuzzy find files in cwd
map('n', '<leader>ff', ":lua require 'telescope.builtin'.find_files()<cr>",
{ desc = 'find files' })
map("n", "<leader>ff", ":lua require 'telescope.builtin'.find_files()<cr>", { desc = "find files" })
-- fuzzy find hidden files in cwd
map('n', '<leader>fh',
":lua require 'telescope.builtin'.find_files({hidden=true})<cr>",
{ desc = 'find hidden files' })
map("n", "<leader>fh", ":lua require 'telescope.builtin'.find_files({hidden=true})<cr>", { desc = "find hidden files" })
-- general full-text search in cwd with rg
map('n', '<leader>fw', ":lua require 'telescope.builtin'.live_grep()<cr>",
{ desc = 'grep search' })
map("n", "<leader>fw", ":lua require 'telescope.builtin'.live_grep()<cr>", { desc = "grep search" })
-- git status
map('n', '<leader>fg', ":lua require 'telescope.builtin'.git_status()<cr>",
{ desc = 'git status' })
map("n", "<leader>fg", ":lua require 'telescope.builtin'.git_status()<cr>", { desc = "git status" })
-- git buffercommits
map('n', '<leader>fc', ":lua require 'telescope.builtin'.git_bcommits()<cr>",
{ desc = 'git buffer commits' })
map("n", "<leader>fc", ":lua require 'telescope.builtin'.git_bcommits()<cr>", { desc = "git buffer commits" })
-- git commitlog
map('n', '<leader>fl', ":lua require 'telescope.builtin'.git_commits()<cr>",
{ desc = 'git commit log' })
map("n", "<leader>fl", ":lua require 'telescope.builtin'.git_commits()<cr>", { desc = "git commit log" })
-- spell suggestions
map('n', 'z=',
":lua require 'telescope.builtin'.spell_suggest(require 'telescope.themes'.get_ivy())<cr>")
map("n", "z=", ":lua require 'telescope.builtin'.spell_suggest(require 'telescope.themes'.get_ivy())<cr>")
-- Format current Paragraph (esp useful in prose writing)
map('n', '<localleader>q', 'gqap',
{ silent = true, desc = 'Format current paragraph' })
map('x', '<localleader>q', 'gq', { silent = true, desc = 'Format {motion}' })
map('n', '<localleader>Q', 'vapJgqap',
{ silent = true, desc = 'Unformat then format paragraph' })
map("n", "<localleader>q", "gqap", { silent = true, desc = "Format current paragraph" })
map("x", "<localleader>q", "gq", { silent = true, desc = "Format {motion}" })
map("n", "<localleader>Q", "vapJgqap", { silent = true, desc = "Unformat then format paragraph" })
map('n', '<localleader>mp', '<Plug>MarkdownPreviewToggle',
{ desc = 'Toggle md preview' })
map("n", "<localleader>mp", "<Plug>MarkdownPreviewToggle", { desc = "Toggle md preview" })
-- FORMAT code with
-- PLUGIN: formatter.nvim
map('n', '<localleader>f', ':FormatLock<cr>')
map('n', '<localleader>F', ':FormatWriteLock<cr>')
map("n", "<localleader>f", ":FormatLock<cr>")
map("n", "<localleader>F", ":FormatWriteLock<cr>")
-- SPELL CHECKING
-- Move to the prev/next spelling error with [S ]S
-- Move to the prev/next spelling error or suggestion with [s ]s
prefix({ ['<localleader>Z'] = { name = '+Spelling' } })
map('n', '<localleader>ZZ', ':setlocal spell! spelllang=en_us,de_de<cr>',
{ desc = 'Toggle spellcheck' })
map('n', '<localleader>ZE', ':setlocal spell! spelllang=en_us<cr>',
{ desc = 'Toggle EN spellcheck' })
map('n', '<localleader>ZG', ':setlocal spell! spelllang=de_de<cr>',
{ desc = 'Toggle DE spellcheck' })
prefix({ ["<localleader>Z"] = { name = "+Spelling" } })
map("n", "<localleader>ZZ", ":setlocal spell! spelllang=en_us,de_de<cr>", { desc = "Toggle spellcheck" })
map("n", "<localleader>ZE", ":setlocal spell! spelllang=en_us<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
map('i', '<c-z>', '<C-G>u<Esc>[s1z=`]a<C-G>u')
map('n', '<localleader>z', 'ms[s1z=`s', { desc = 'Fix last spell error' })
map("i", "<c-z>", "<C-G>u<Esc>[s1z=`]a<C-G>u")
map("n", "<localleader>z", "ms[s1z=`s", { desc = "Fix last spell error" })
-- PLUGIN: mini.nvim
prefix({ ['<leader>s'] = { name = '+show' } })
map('n', '<leader>sm', ':lua MiniMap.toggle()<cr>',
{ silent = true, desc = 'toggle minimap' })
map('n', '<leader>ss', ":lua MiniStarter.open()<cr>", { desc = 'show startpage' })
prefix({ ["<leader>s"] = { name = "+show" } })
map("n", "<leader>sm", ":lua MiniMap.toggle()<cr>", { silent = true, desc = "toggle minimap" })
map("n", "<leader>ss", ":lua MiniStarter.open()<cr>", { desc = "show startpage" })
-- PLUGIN: symbols-outline.nvim
map('n', '<leader>so', '<cmd>SymbolsOutline<cr>',
{ silent = true, desc = 'toggle symbol outline' })
map("n", "<leader>so", "<cmd>SymbolsOutline<cr>", { silent = true, desc = "toggle symbol outline" })
-- PLUGIN: nvim-tree
map('n', '<leader>se', '<cmd>NvimTreeToggle<cr>',
{ silent = true, desc = 'toggle filetree' })
map("n", "<leader>se", "<cmd>NvimTreeToggle<cr>", { silent = true, desc = "toggle filetree" })
-- PLUGIN: easy-align
-- 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)
map('n', 'ga', '<Plug>(EasyAlign)')
map("n", "ga", "<Plug>(EasyAlign)")
-- trim trailing whitespaces with mini.nvim trailspace
map("n", "<localleader>w", function() require("mini.trailspace").trim() end,
{ noremap = true })
map("n", "<localleader>w", function()
require("mini.trailspace").trim()
end, { noremap = true })
-- PLUGIN: dial-increment
map("n", "<C-a>", '<Plug>(dial-increment)')
map("n", "<C-x>", '<Plug>(dial-decrement)')
map("v", "<C-a>", '<Plug>(dial-increment)')
map("v", "<C-x>", '<Plug>(dial-increment)')
map("v", "g<C-a>", 'g<Plug>(dial-increment)')
map("v", "g<C-x>", 'g<Plug>(dial-increment)')
map("n", "<C-a>", "<Plug>(dial-increment)")
map("n", "<C-x>", "<Plug>(dial-decrement)")
map("v", "<C-a>", "<Plug>(dial-increment)")
map("v", "<C-x>", "<Plug>(dial-increment)")
map("v", "g<C-a>", "g<Plug>(dial-increment)")
map("v", "g<C-x>", "g<Plug>(dial-increment)")
-- PLUGIN: zettelkasten.nvim
map('n', '<cr>', [[:silent lua require 'zettelkasten'.link_follow()<cr>]])
map('v', '<cr>', [[:lua require 'zettelkasten'.link_follow(true)<cr>]])
prefix({ ['<leader>n'] = { name = '+notes' } })
map('n', '<leader>ni', [[:lua require 'zettelkasten'.index_open()<cr> ]],
{ desc = "index page" })
map("n", "<cr>", [[:silent lua require 'zettelkasten'.link_follow()<cr>]])
map("v", "<cr>", [[:lua require 'zettelkasten'.link_follow(true)<cr>]])
prefix({ ["<leader>n"] = { name = "+notes" } })
map("n", "<leader>ni", [[:lua require 'zettelkasten'.index_open()<cr> ]], { desc = "index page" })
-- PLUGIN: zk
map('n', '<leader>nn', "<cmd>ZkNotes { sort = { 'modified' } }<cr>",
{ desc = "note list" })
map("n", "<leader>nf", "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>",
{ desc = "note search" })
map('n', '<leader>nt', "<cmd>ZkTags<cr>",
{ desc = "note tags" })
map('n', '<leader>nc', "<cmd>ZkCd<cr>",
{ desc = "notes directory" })
prefix({ ['<localleader>n'] = { name = '+note' } })
map('n', '<localleader>nl', "<cmd>ZkLinks<cr>",
{ desc = "note links" })
map('n', '<localleader>nb', "<cmd>ZkLinks<cr>",
{ desc = "note backlinks" })
map('n', '<localleader>nn', "<cmd>ZkNew { title = vim.fn.input('Title: ') }<cr>",
{ desc = "new note" })
prefix({ ['<localleader>n'] = { name = '+note', mode = "v" } })
map('v', '<localleader>nn', ":ZkNewFromTitleSelection<cr>",
{ desc = "title from selection" })
map('v', '<localleader>nN', ":ZkNewFromContentSelection<cr>",
{ desc = "content from selection" })
map('v', '<localleader>nf', ":ZkMatch<cr>",
{ desc = "find note from selection" })
map("n", "<leader>nn", "<cmd>ZkNotes { sort = { 'modified' } }<cr>", { desc = "note list" })
map(
"n",
"<leader>nf",
"<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>",
{ desc = "note search" }
)
map("n", "<leader>nt", "<cmd>ZkTags<cr>", { desc = "note tags" })
map("n", "<leader>nc", "<cmd>ZkCd<cr>", { desc = "notes directory" })
prefix({ ["<localleader>n"] = { name = "+note" } })
map("n", "<localleader>nl", "<cmd>ZkLinks<cr>", { desc = "note links" })
map("n", "<localleader>nb", "<cmd>ZkLinks<cr>", { desc = "note backlinks" })
map("n", "<localleader>nn", "<cmd>ZkNew { title = vim.fn.input('Title: ') }<cr>", { desc = "new note" })
prefix({ ["<localleader>n"] = { name = "+note", mode = "v" } })
map("v", "<localleader>nn", ":ZkNewFromTitleSelection<cr>", { desc = "title from selection" })
map("v", "<localleader>nN", ":ZkNewFromContentSelection<cr>", { desc = "content from selection" })
map("v", "<localleader>nf", ":ZkMatch<cr>", { desc = "find note from selection" })
-- PLUGIN: toggleterm.nvim
-- create a lazygit window, set up in toggleterm settings
map('n', '<leader>G', ':Lazygit<cr>')
map("n", "<leader>G", ":Lazygit<cr>")
prefix({ ['<localleader>s'] = { name = '+set' } })
prefix({ ["<localleader>s"] = { name = "+set" } })
-- PLUGIN: wrapping.nvim
map('n', '<localleader>sw', [[:lua require('wrapping').toggle_wrap_mode()<cr> ]],
{ silent = true, desc = 'toggle wrap mode' })
map(
"n",
"<localleader>sw",
[[:lua require('wrapping').toggle_wrap_mode()<cr> ]],
{ silent = true, desc = "toggle wrap mode" }
)
-- PLUGIN: easyread.nvim
map('n', '<localleader>ss', ':EasyreadToggle<cr>', { silent = true, desc = 'toggle speedreading' })
map("n", "<localleader>ss", ":EasyreadToggle<cr>", { silent = true, desc = "toggle speedreading" })
-- PLUGIN: nabla.nvim
map('n', '<localleader>sv', '<cmd>lua require("nabla").popup()<cr>', { silent = true, desc = 'latex formula popup' })
map('n', '<localleader>sV', '<cmd>lua require("nabla").toggle_virt({autogen = true, silent = true})<cr>',
{ silent = true, desc = 'toggle formula notation' })
map("n", "<localleader>sv", '<cmd>lua require("nabla").popup()<cr>', { silent = true, desc = "latex formula popup" })
map(
"n",
"<localleader>sV",
'<cmd>lua require("nabla").toggle_virt({autogen = true, silent = true})<cr>',
{ silent = true, desc = "toggle formula notation" }
)
-- PLUGIN: nvim-colorizer
map('n', '<localleader>sc', '<cmd>ColorizerToggle<cr>', { silent = true, desc = 'toggle colorizer' })
map('n', '<localleader>sC', '<cmd>lua require("colorizer").attach_to_buffer(0, {mode = "background"} )<cr>',
{ silent = true, desc = 'colorize background' })
map("n", "<localleader>sc", "<cmd>ColorizerToggle<cr>", { silent = true, desc = "toggle colorizer" })
map(
"n",
"<localleader>sC",
'<cmd>lua require("colorizer").attach_to_buffer(0, {mode = "background"} )<cr>',
{ silent = true, desc = "colorize background" }
)

View file

@ -1,12 +1,11 @@
local M = {}
function M.getCompletionItems(prefix)
-- define your total completion items
local items = vim.api.nvim_call_function('pandoc#completion#Complete',
{0, prefix})
return items
-- define your total completion items
local items = vim.api.nvim_call_function("pandoc#completion#Complete", { 0, prefix })
return items
end
M.complete_item = {item = M.getCompletionItems}
M.complete_item = { item = M.getCompletionItems }
return M

View file

@ -9,34 +9,41 @@ window, otherwise opens a new split.
The buffer, by default is set to the pandoc filetype.
This can be changed by setting the `g:scratchpad_ft` variable or the `b:scratchpad_ft`
variable to the intended filetype.
]] --
]]
--
local api = vim.api
local M = {}
local function isempty(s) return s == nil or s == '' end
local function isempty(s)
return s == nil or s == ""
end
function M.create(split, ft)
-- should we create a new split or switch out the current buffer?
if isempty(split) then
split = false
else
split = true
end
-- which filetype to set for the scratchpad, defaults to pandoc
if isempty(ft) then
ft = vim.b["scratchpad_ft"] or vim.g["scratchpad_ft"] or "pandoc"
end
-- should we create a new split or switch out the current buffer?
if isempty(split) then
split = false
else
split = true
end
-- which filetype to set for the scratchpad, defaults to pandoc
if isempty(ft) then
ft = vim.b["scratchpad_ft"] or vim.g["scratchpad_ft"] or "pandoc"
end
local buf = api.nvim_create_buf(false, true)
if buf == 0 then print("Error opening scratch buffer.") end
api.nvim_buf_set_option(buf, "bufhidden", "hide")
api.nvim_buf_set_option(buf, "buftype", "nofile")
api.nvim_buf_set_option(buf, "swapfile", false)
api.nvim_buf_set_option(buf, "filetype", ft)
local buf = api.nvim_create_buf(false, true)
if buf == 0 then
print("Error opening scratch buffer.")
end
api.nvim_buf_set_option(buf, "bufhidden", "hide")
api.nvim_buf_set_option(buf, "buftype", "nofile")
api.nvim_buf_set_option(buf, "swapfile", false)
api.nvim_buf_set_option(buf, "filetype", ft)
if split then api.nvim_command('vsplit new') end -- i think this is the only way to interact with the buffers creating a new split
-- switch to scratchpad
api.nvim_win_set_buf(0, buf)
if split then
api.nvim_command("vsplit new")
end -- i think this is the only way to interact with the buffers creating a new split
-- switch to scratchpad
api.nvim_win_set_buf(0, buf)
end
return M

View file

@ -1,44 +1,56 @@
require('gitsigns').setup {
numhl = true,
signcolumn = false,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
require("gitsigns").setup({
numhl = true,
signcolumn = false,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']h', function()
if vim.wo.diff then return ']h' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, { expr = true })
-- Navigation
map("n", "]h", function()
if vim.wo.diff then
return "]h"
end
vim.schedule(function()
gs.next_hunk()
end)
return "<Ignore>"
end, { expr = true })
map('n', '[h', function()
if vim.wo.diff then return '[h' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, { expr = true })
map("n", "[h", function()
if vim.wo.diff then
return "[h"
end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })
-- Actions
require('which-key').register({ ['<localleader>h'] = { name = '+git' } })
map({ 'n', 'v' }, '<localleader>hs', ':Gitsigns stage_hunk<CR>', { desc = 'stage hunk' })
map({ 'n', 'v' }, '<localleader>hr', ':Gitsigns reset_hunk<CR>', { desc = 'reset hunk' })
map('n', '<localleader>hS', gs.stage_buffer, { desc = 'stage buffer' })
map('n', '<localleader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
map('n', '<localleader>hR', gs.reset_buffer, { desc = 'reset buffer' })
map('n', '<localleader>hp', gs.preview_hunk, { desc = 'preview hunk' })
map('n', '<localleader>hb', function() gs.blame_line { full = true } end, { desc = 'blame line' })
map('n', '<localleader>hB', gs.toggle_current_line_blame, { desc = 'toggle blame' })
map('n', '<localleader>hd', gs.diffthis, { desc = 'diffthis' })
map('n', '<localleader>hD', function() gs.diffthis('~') end, { desc = 'diffbase' })
map('n', '<localleader>ht', gs.toggle_deleted, { desc = 'toggle deleted' })
-- Actions
require("which-key").register({ ["<localleader>h"] = { name = "+git" } })
map({ "n", "v" }, "<localleader>hs", ":Gitsigns stage_hunk<CR>", { desc = "stage hunk" })
map({ "n", "v" }, "<localleader>hr", ":Gitsigns reset_hunk<CR>", { desc = "reset hunk" })
map("n", "<localleader>hS", gs.stage_buffer, { desc = "stage buffer" })
map("n", "<localleader>hu", gs.undo_stage_hunk, { desc = "undo stage hunk" })
map("n", "<localleader>hR", gs.reset_buffer, { desc = "reset buffer" })
map("n", "<localleader>hp", gs.preview_hunk, { desc = "preview hunk" })
map("n", "<localleader>hb", function()
gs.blame_line({ full = true })
end, { desc = "blame line" })
map("n", "<localleader>hB", gs.toggle_current_line_blame, { desc = "toggle blame" })
map("n", "<localleader>hd", gs.diffthis, { desc = "diffthis" })
map("n", "<localleader>hD", function()
gs.diffthis("~")
end, { desc = "diffbase" })
map("n", "<localleader>ht", gs.toggle_deleted, { desc = "toggle deleted" })
-- Text object
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
map({ 'o', 'x' }, 'ah', ':<C-U>Gitsigns select_hunk<CR>')
end
}
-- Text object
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
map({ "o", "x" }, "ah", ":<C-U>Gitsigns select_hunk<CR>")
end,
})

View file

@ -1,28 +1,28 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = {left = '', right = ''},
section_separators = {left = '', right = ''},
disabled_filetypes = {},
always_divide_middle = true
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress', 'location'},
lualine_z = {'hostname'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {'branch', 'diff'},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {'location'},
lualine_z = {}
},
tabline = {},
extensions = {'quickfix', 'toggleterm'}
}
require("lualine").setup({
options = {
icons_enabled = true,
theme = "auto",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {},
always_divide_middle = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress", "location" },
lualine_z = { "hostname" },
},
inactive_sections = {
lualine_a = {},
lualine_b = { "branch", "diff" },
lualine_c = { "filename" },
lualine_x = {},
lualine_y = { "location" },
lualine_z = {},
},
tabline = {},
extensions = { "quickfix", "toggleterm" },
})

View file

@ -1,38 +1,38 @@
require('mini.ai').setup()
require('mini.comment').setup({
hooks = {
pre = function()
require('ts_context_commentstring.internal').update_commentstring()
end
}
require("mini.ai").setup()
require("mini.comment").setup({
hooks = {
pre = function()
require("ts_context_commentstring.internal").update_commentstring()
end,
},
})
require('mini.cursorword').setup({ delay = 500 })
require('mini.fuzzy').setup()
require('mini.indentscope').setup({
symbol = "",
draw = { animation = require('mini.indentscope').gen_animation.none() },
options = { indent_at_cursor = false }
require("mini.cursorword").setup({ delay = 500 })
require("mini.fuzzy").setup()
require("mini.indentscope").setup({
symbol = "",
draw = { animation = require("mini.indentscope").gen_animation.none() },
options = { indent_at_cursor = false },
})
require('mini.map').setup()
require("mini.map").setup()
-- require('mini.move').setup() -- has not hit stable yet
require('mini.pairs').setup()
require('mini.trailspace').setup()
require("mini.pairs").setup()
require("mini.trailspace").setup()
local starter = require('mini.starter')
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')
}
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"),
},
})
vim.api.nvim_set_hl(0, 'MiniCursorword', { bold = true })
vim.api.nvim_set_hl(0, "MiniCursorword", { bold = true })

View file

@ -4,40 +4,61 @@
-- rg (ripgrep) for in-text searches
-- fd for quicker directory structure searches
-- lsp for a variety of lsp queries
require("telescope").setup {
defaults = {
vimgrep_arguments = {
'rg', '--ignore-vcs', '--hidden', '--color=never', '--no-heading',
'--with-filename', '--line-number', '--column', '--smart-case'
},
generic_sorter = require('mini.fuzzy').get_telescope_sorter
},
defaults = {
-- Appearance
prompt_prefix = '',
selection_caret = '󰳟 ',
color_devicons = true
},
pickers = {
buffers = {theme = "ivy"},
oldfiles = {theme = "ivy"},
find_files = {
theme = "dropdown",
-- nice minimal picker design
borderchars = {
{'', '', '', '', '', '', '', ''},
prompt = {"", "", " ", "", '', '', "", ""},
results = {
"", "", "", "", "", "", "", ""
},
preview = {
'', '', '', '', '', '', '', ''
}
},
width = 0.8,
previewer = false,
prompt_title = false
}
}
}
require("telescope").setup({
defaults = {
vimgrep_arguments = {
"rg",
"--ignore-vcs",
"--hidden",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
generic_sorter = require("mini.fuzzy").get_telescope_sorter,
},
defaults = {
-- Appearance
prompt_prefix = "",
selection_caret = "󰳟 ",
color_devicons = true,
},
pickers = {
buffers = { theme = "ivy" },
oldfiles = { theme = "ivy" },
find_files = {
theme = "dropdown",
-- nice minimal picker design
borderchars = {
{ "", "", "", "", "", "", "", "" },
prompt = { "", "", " ", "", "", "", "", "" },
results = {
"",
"",
"",
"",
"",
"",
"",
"",
},
preview = {
"",
"",
"",
"",
"",
"",
"",
"",
},
},
width = 0.8,
previewer = false,
prompt_title = false,
},
},
})
require("telescope").load_extension("fzf")

View file

@ -1,16 +1,18 @@
require("toggleterm").setup {
open_mapping = [[<leader>=]],
insert_mappings = false -- don't map the key in insert mode
}
require("toggleterm").setup({
open_mapping = [[<leader>=]],
insert_mappings = false, -- don't map the key in insert mode
})
local Terminal = require('toggleterm.terminal').Terminal
local Terminal = require("toggleterm.terminal").Terminal
-- create a lazygit window with the lazygit command
local lazygit = Terminal:new({
cmd = "lazygit",
hidden = true,
direction = 'float',
float_opts = { border = "curved" }
cmd = "lazygit",
hidden = true,
direction = "float",
float_opts = { border = "curved" },
})
function _Lazygit_toggle() lazygit:toggle() end
function _Lazygit_toggle()
lazygit:toggle()
end
vim.cmd([[command! Lazygit :lua _Lazygit_toggle()<cr>]])

View file

@ -1,21 +1,21 @@
local rainbow = require('ts-rainbow')
require 'nvim-treesitter.configs'.setup {
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "all",
highlight = { enable = true },
incremental_selection = { enable = true },
textobjects = { enable = true },
indent = { enable = true },
local rainbow = require("ts-rainbow")
require("nvim-treesitter.configs").setup({
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = "all",
highlight = { enable = true },
incremental_selection = { enable = true },
textobjects = { enable = true },
indent = { enable = true },
-- enable rainbow brackets, needs p00f/nvim-ts-rainbow
rainbow = {
enable = true,
strategy = { rainbow.strategy.global }
},
-- enable rainbow brackets, needs p00f/nvim-ts-rainbow
rainbow = {
enable = true,
strategy = { rainbow.strategy.global },
},
-- for improved commentstrings, needs corresponding plugin
context_commentstring = {
enable = true,
enable_autocmd = false -- since we run it as a hook from the mini.comment plugin
}
}
-- for improved commentstrings, needs corresponding plugin
context_commentstring = {
enable = true,
enable_autocmd = false, -- since we run it as a hook from the mini.comment plugin
},
})

View file

@ -1,261 +1,321 @@
local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex" }
return {
-- essential
{ 'numToStr/Navigator.nvim', branch = "master", config = true }, -- allow seamless navigation between vim buffers and tmux/wezterm splits
{ 'jeffkreeftmeijer/vim-numbertoggle', event = "BufEnter" }, -- toggles numbers to absolute for all buffers but the current which is relative
{ 'ojroques/vim-oscyank', event = "VeryLazy" }, -- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
{ 'ggandor/lightspeed.nvim', event = "VeryLazy" }, -- jump between letters with improved fFtT quicksearch, mimics sneak
{
'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter
config = function() require('plug._gitsigns') end,
event = "BufRead"
}, { "m4xshen/smartcolumn.nvim", config = true }, -- auto-hiding colorcolumn
-- files
{ 'vifm/vifm.vim' }, -- integrate file manager
{
'nvim-tree/nvim-tree.lua', -- integrate file tree
config = true,
dependencies = { 'nvim-tree/nvim-web-devicons', config = true },
cmd = "NvimTreeToggle"
}, -- colors
{
'RRethy/nvim-base16',
event = "BufWinEnter",
dependencies = { 'rktjmp/fwatch.nvim' }
}, {
'NvChad/nvim-colorizer.lua', -- color hex, named colors in the correct preview scheme
config = function()
require('colorizer').setup({
user_default_options = { mode = 'virtualtext' }
})
end,
event = "VeryLazy"
}, -- editing
{ 'kylechui/nvim-surround', version = '*', config = true, event = "VeryLazy" }, -- surround things with other things using ys/cs/ds
{
'monaqa/dial.nvim', -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
config = function()
local augend = require("dial.augend")
require("dial.config").augends:register_group {
-- default augends used when no group name is specified
default = {
augend.integer.alias.decimal, augend.integer.alias.hex,
augend.date.alias["%Y/%m/%d"],
augend.date.alias["%Y-%m-%d"], augend.date.alias["%m/%d"],
augend.date.alias["%H:%M:%S"], augend.date.alias["%H:%M"],
augend.constant.alias.de_weekday_full,
augend.constant.alias.de_weekday,
augend.constant.alias.bool, augend.semver.alias.semver,
augend.constant.alias.Alpha, augend.constant.alias.alpha,
augend.hexcolor.new { case = "lower" }, augend.constant.new {
elements = { "and", "or" },
word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
cyclic = true -- "or" is incremented into "and".
},
augend.constant
.new {
elements = { "&&", "||" },
word = false,
cyclic = true
}
}
}
end,
event = "VeryLazy"
}, {
'tommcdo/vim-exchange', -- adds exchange operator with cx. common use: cxiw . on 2 words to switch
event = "VeryLazy"
}, {
'junegunn/vim-easy-align', -- Align tables and other alignable things
event = "VeryLazy"
}, { 'edKotinsky/Arduino.nvim', ft = 'arduino', config = true }, -- statusline
{
'nvim-lualine/lualine.nvim',
requires = { 'nvim-tree/nvim-web-devicons', config = true },
config = function() require('plug._lualine') end
}, -- writing
{ 'vim-pandoc/vim-criticmarkup', ft = writing_ft }, {
'jbyuki/nabla.nvim',
ft = writing_ft,
config = function()
require('nabla').enable_virt({ autogen = true, silent = true })
end
}, {
'mickael-menu/zk-nvim',
config = function() require('zk').setup({ picker = "telescope" }) end
}, {
'andrewferrier/wrapping.nvim',
config = function()
require('wrapping').setup({
create_keymappings = false,
notify_on_switch = false
})
end
}, {
'quarto-dev/quarto-nvim',
dependencies = {
'jmbuhr/otter.nvim', 'neovim/nvim-lspconfig',
'vim-pandoc/vim-pandoc-syntax', 'hrsh7th/nvim-cmp',
'nvim-treesitter/nvim-treesitter'
},
config = function()
require 'quarto'.setup {
lspFeatures = {
enabled = true,
languages = { 'r', 'python', 'julia' },
diagnostics = { enabled = true, triggers = { "BufWrite" } },
completion = { enabled = true }
}
}
end,
ft = "quarto"
}, {
"lkhphuc/jupyter-kernel.nvim",
config = true,
cmd = "JupyterAttach",
build = ":UpdateRemotePlugins",
keys = {
{
"<localleader>ck",
"<Cmd>JupyterInspect<CR>",
desc = "Inspect object in kernel"
}
}
}, { 'micarmst/vim-spellsync', event = "VeryLazy" }, -- personal dict improvements for git sync
{ 'folke/zen-mode.nvim', config = true, event = "VeryLazy" }, -- provide distraction free writing
{ 'folke/twilight.nvim', event = "VeryLazy" }, -- provide even distraction free-er writing (lowlight paragraphs)
{
'JellyApple102/easyread.nvim',
config = true,
ft = writing_ft,
cmd = 'EasyreadToggle'
}, -- enable 'speed-reading' mode (bionic reading)
{ '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
build = function() vim.fn["mkdp#util#install"]() end,
ft = writing_ft
}, -- languages
{ 'euclidianAce/BetterLua.vim', ft = 'lua' }, -- better syntax highlighting for lua
{ 'aliou/bats.vim', ft = { "bash", "sh", "zsh", "bats" } }, -- enable syntax for bats shell-code testing library
-- essential
{ "numToStr/Navigator.nvim", branch = "master", config = true }, -- allow seamless navigation between vim buffers and tmux/wezterm splits
{ "jeffkreeftmeijer/vim-numbertoggle", event = "BufEnter" }, -- toggles numbers to absolute for all buffers but the current which is relative
{ "ojroques/vim-oscyank", event = "VeryLazy" }, -- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
{ "ggandor/lightspeed.nvim", event = "VeryLazy" }, -- jump between letters with improved fFtT quicksearch, mimics sneak
{
"lewis6991/gitsigns.nvim", -- show vcs changes on left-hand gutter
config = function()
require("plug._gitsigns")
end,
event = "BufRead",
},
{ "m4xshen/smartcolumn.nvim", config = true }, -- auto-hiding colorcolumn
-- files
{ "vifm/vifm.vim" }, -- integrate file manager
{
"nvim-tree/nvim-tree.lua", -- integrate file tree
config = true,
dependencies = { "nvim-tree/nvim-web-devicons", config = true },
cmd = "NvimTreeToggle",
}, -- colors
{
"RRethy/nvim-base16",
event = "BufWinEnter",
dependencies = { "rktjmp/fwatch.nvim" },
},
{
"NvChad/nvim-colorizer.lua", -- color hex, named colors in the correct preview scheme
config = function()
require("colorizer").setup({
user_default_options = { mode = "virtualtext" },
})
end,
event = "VeryLazy",
}, -- editing
{ "kylechui/nvim-surround", version = "*", config = true, event = "VeryLazy" }, -- surround things with other things using ys/cs/ds
{
"monaqa/dial.nvim", -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
config = function()
local augend = require("dial.augend")
require("dial.config").augends:register_group({
-- default augends used when no group name is specified
default = {
augend.integer.alias.decimal,
augend.integer.alias.hex,
augend.date.alias["%Y/%m/%d"],
augend.date.alias["%Y-%m-%d"],
augend.date.alias["%m/%d"],
augend.date.alias["%H:%M:%S"],
augend.date.alias["%H:%M"],
augend.constant.alias.de_weekday_full,
augend.constant.alias.de_weekday,
augend.constant.alias.bool,
augend.semver.alias.semver,
augend.constant.alias.Alpha,
augend.constant.alias.alpha,
augend.hexcolor.new({ case = "lower" }),
augend.constant.new({
elements = { "and", "or" },
word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
cyclic = true, -- "or" is incremented into "and".
}),
augend.constant.new({
elements = { "&&", "||" },
word = false,
cyclic = true,
}),
},
})
end,
event = "VeryLazy",
},
{
"tommcdo/vim-exchange", -- adds exchange operator with cx. common use: cxiw . on 2 words to switch
event = "VeryLazy",
},
{
"junegunn/vim-easy-align", -- Align tables and other alignable things
event = "VeryLazy",
},
{ "edKotinsky/Arduino.nvim", ft = "arduino", config = true }, -- statusline
{
"nvim-lualine/lualine.nvim",
requires = { "nvim-tree/nvim-web-devicons", config = true },
config = function()
require("plug._lualine")
end,
}, -- writing
{ "vim-pandoc/vim-criticmarkup", ft = writing_ft },
{
"jbyuki/nabla.nvim",
ft = writing_ft,
config = function()
require("nabla").enable_virt({ autogen = true, silent = true })
end,
},
{
"mickael-menu/zk-nvim",
config = function()
require("zk").setup({ picker = "telescope" })
end,
},
{
"andrewferrier/wrapping.nvim",
config = function()
require("wrapping").setup({
create_keymappings = false,
notify_on_switch = false,
})
end,
},
{
"quarto-dev/quarto-nvim",
dependencies = {
"jmbuhr/otter.nvim",
"neovim/nvim-lspconfig",
"vim-pandoc/vim-pandoc-syntax",
"hrsh7th/nvim-cmp",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("quarto").setup({
lspFeatures = {
enabled = true,
languages = { "r", "python", "julia" },
diagnostics = { enabled = true, triggers = { "BufWrite" } },
completion = { enabled = true },
},
})
end,
ft = "quarto",
},
{
"lkhphuc/jupyter-kernel.nvim",
config = true,
cmd = "JupyterAttach",
build = ":UpdateRemotePlugins",
keys = {
{
"<localleader>ck",
"<Cmd>JupyterInspect<CR>",
desc = "Inspect object in kernel",
},
},
},
{ "micarmst/vim-spellsync", event = "VeryLazy" }, -- personal dict improvements for git sync
{ "folke/zen-mode.nvim", config = true, event = "VeryLazy" }, -- provide distraction free writing
{ "folke/twilight.nvim", event = "VeryLazy" }, -- provide even distraction free-er writing (lowlight paragraphs)
{
"JellyApple102/easyread.nvim",
config = true,
ft = writing_ft,
cmd = "EasyreadToggle",
}, -- enable 'speed-reading' mode (bionic reading)
{ "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
build = function()
vim.fn["mkdp#util#install"]()
end,
ft = writing_ft,
}, -- languages
{ "euclidianAce/BetterLua.vim", ft = "lua" }, -- better syntax highlighting for lua
{ "aliou/bats.vim", ft = { "bash", "sh", "zsh", "bats" } }, -- enable syntax for bats shell-code testing library
-- REPL work
{
'WhiteBlackGoose/magma-nvim-goose',
build = ":UpdateRemotePlugins",
config = function()
vim.g.magma_image_provider = "kitty"
vim.g.magma_automatically_open_output = false
end
}, {
'echasnovski/mini.nvim',
version = '*',
config = function() require('plug._mini') end
}, {
"akinsho/nvim-toggleterm.lua", -- simpler, programmable and multiple terminal toggling for nvim
config = function() require('plug._toggleterm') end
},
{
"folke/which-key.nvim",
config = function() require("which-key").setup {} end
}, -- fuzzy matching
{ "nvim-telescope/telescope-fzf-native.nvim", build = 'make' }, {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/popup.nvim", "nvim-lua/plenary.nvim" },
config = function() require('plug._telescope') end
}, {
"dense-analysis/neural",
dependencies = { "MunifTanjim/nui.nvim", "elpiloto/significant.nvim" },
config = function()
require('neural').setup({
source = { openai = { api_key = vim.env.OPENAI_API_KEY } }
})
end
}, -- treesitter
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function() require('plug._treesitter') end,
event = "BufReadPre",
-- rainbow brackets using treesitter
-- show current cursor context at top of buffer
-- improves commenting plugin above by using ts
dependencies = {
'https://gitlab.com/HiPhish/nvim-ts-rainbow2.git',
{ 'romgrk/nvim-treesitter-context', config = true },
'JoosepAlviste/nvim-ts-context-commentstring'
}
}, { 'nvim-treesitter/playground', cmd = "TSPlaygroundToggle" }, -- interactively view and query the treesitter tree
{
'RRethy/nvim-treesitter-textsubjects', -- allows using . and ; to target treesitter branches
config = function()
require 'nvim-treesitter.configs'.setup {
textsubjects = {
enable = true,
keymaps = {
['.'] = 'textsubjects-smart',
[';'] = 'textsubjects-container-outer'
}
}
}
end,
event = "BufReadPre"
}, {
-- lsp
"VonHeikemen/lsp-zero.nvim",
dependencies = {
{ "neovim/nvim-lspconfig", branch = "master" },
"williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", {
"hrsh7th/nvim-cmp",
branch = "main",
dependencies = {
"andersevenrud/cmp-tmux", "cbarrete/completion-vcard",
"f3fora/cmp-spell", "hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path", "hrsh7th/cmp-buffer",
"hrsh7th/cmp-calc", "hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua", "dmitmel/cmp-digraphs",
"jc-doyle/cmp-pandoc-references",
"kdheepak/cmp-latex-symbols", "lukas-reineke/cmp-rg",
"crispgm/cmp-beancount", "ray-x/cmp-treesitter",
"saadparwaiz1/cmp_luasnip"
}
}, "L3MON4D3/LuaSnip", "rafamadriz/friendly-snippets",
-- { "lukas-reineke/lsp-format.nvim", config = true },
{ "j-hui/fidget.nvim", config = true }, -- loading animations for some LSP
{
"jay-babu/mason-null-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"williamboman/mason.nvim", "jose-elias-alvarez/null-ls.nvim"
},
}
},
config = function() require('plug._lsp') end,
branch = "v2.x"
}, { 'simrat39/symbols-outline.nvim', config = true, event = "VeryLazy" }, -- vista-like outline view for code
{ 'ray-x/lsp_signature.nvim', config = true }, -- UI improvements
{ 'stevearc/dressing.nvim', config = true }, {
'rcarriga/nvim-notify',
config = function() vim.notify = require("notify") end
}
-- { -- REQUIRES custom `yay -S --asdeps lua51-lyaml invocation` AND is suuper slow
-- "jghauser/papis.nvim",
-- after = { "telescope.nvim", "nvim-cmp" },
-- dependencies = {
-- "kkharji/sqlite.lua", "nvim-lua/plenary.nvim",
-- "MunifTanjim/nui.nvim", "nvim-treesitter/nvim-treesitter"
-- },
-- ft = writing_ft,
-- rocks = { "lyaml" },
-- config = function()
-- require('papis').setup({
-- papis_python = {
-- dir = "/home/marty/documents/library/academia",
-- info_name = "info.yaml",
-- notes_name = [[notes.qmd]]
-- }
-- })
-- end
-- }
-- REPL work
{
"WhiteBlackGoose/magma-nvim-goose",
build = ":UpdateRemotePlugins",
config = function()
vim.g.magma_image_provider = "kitty"
vim.g.magma_automatically_open_output = false
end,
},
{
"echasnovski/mini.nvim",
version = "*",
config = function()
require("plug._mini")
end,
},
{
"akinsho/nvim-toggleterm.lua", -- simpler, programmable and multiple terminal toggling for nvim
config = function()
require("plug._toggleterm")
end,
},
{
"folke/which-key.nvim",
config = function()
require("which-key").setup({})
end,
}, -- fuzzy matching
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/popup.nvim", "nvim-lua/plenary.nvim" },
config = function()
require("plug._telescope")
end,
},
{
"dense-analysis/neural",
dependencies = { "MunifTanjim/nui.nvim", "elpiloto/significant.nvim" },
config = function()
require("neural").setup({
source = { openai = { api_key = vim.env.OPENAI_API_KEY } },
})
end,
}, -- treesitter
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("plug._treesitter")
end,
event = "BufReadPre",
-- rainbow brackets using treesitter
-- show current cursor context at top of buffer
-- improves commenting plugin above by using ts
dependencies = {
"https://gitlab.com/HiPhish/nvim-ts-rainbow2.git",
{ "romgrk/nvim-treesitter-context", config = true },
"JoosepAlviste/nvim-ts-context-commentstring",
},
},
{ "nvim-treesitter/playground", cmd = "TSPlaygroundToggle" }, -- interactively view and query the treesitter tree
{
"RRethy/nvim-treesitter-textsubjects", -- allows using . and ; to target treesitter branches
config = function()
require("nvim-treesitter.configs").setup({
textsubjects = {
enable = true,
keymaps = {
["."] = "textsubjects-smart",
[";"] = "textsubjects-container-outer",
},
},
})
end,
event = "BufReadPre",
},
{
-- lsp
"VonHeikemen/lsp-zero.nvim",
dependencies = {
{ "neovim/nvim-lspconfig", branch = "master" },
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
{
"hrsh7th/nvim-cmp",
branch = "main",
dependencies = {
"andersevenrud/cmp-tmux",
"cbarrete/completion-vcard",
"f3fora/cmp-spell",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua",
"dmitmel/cmp-digraphs",
"jc-doyle/cmp-pandoc-references",
"kdheepak/cmp-latex-symbols",
"lukas-reineke/cmp-rg",
"crispgm/cmp-beancount",
"ray-x/cmp-treesitter",
"saadparwaiz1/cmp_luasnip",
},
},
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
-- { "lukas-reineke/lsp-format.nvim", config = true },
{ "j-hui/fidget.nvim", config = true }, -- loading animations for some LSP
{
"jay-babu/mason-null-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"williamboman/mason.nvim",
"jose-elias-alvarez/null-ls.nvim",
},
},
},
config = function()
require("plug._lsp")
end,
branch = "v2.x",
},
{ "simrat39/symbols-outline.nvim", config = true, event = "VeryLazy" }, -- vista-like outline view for code
{ "ray-x/lsp_signature.nvim", config = true }, -- UI improvements
{ "stevearc/dressing.nvim", config = true },
{
"rcarriga/nvim-notify",
config = function()
vim.notify = require("notify")
end,
},
-- { -- REQUIRES custom `yay -S --asdeps lua51-lyaml invocation` AND is suuper slow
-- "jghauser/papis.nvim",
-- after = { "telescope.nvim", "nvim-cmp" },
-- dependencies = {
-- "kkharji/sqlite.lua", "nvim-lua/plenary.nvim",
-- "MunifTanjim/nui.nvim", "nvim-treesitter/nvim-treesitter"
-- },
-- ft = writing_ft,
-- rocks = { "lyaml" },
-- config = function()
-- require('papis').setup({
-- papis_python = {
-- dir = "/home/marty/documents/library/academia",
-- info_name = "info.yaml",
-- notes_name = [[notes.qmd]]
-- }
-- })
-- end
-- }
}

View file

@ -1,68 +1,70 @@
local default_builtins_disabled = { "netrw", "netrwPlugin" }
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
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,
-- puts the numbers into the signcolumn so when git/lsp show signs there's no jump
signcolumn = 'number',
-- 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'
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,
-- puts the numbers into the signcolumn so when git/lsp show signs there's no jump
signcolumn = "number",
-- 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
-- set to use treesitter in treesitter config
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,
-- open new buffers bottomright
splitright = true,
splitbelow = true,
-- remove command line if no command is currently present
cmdheight = 0,
-- 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
-- set to use treesitter in treesitter config
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,
-- open new buffers bottomright
splitright = true,
splitbelow = true,
-- remove command line if no command is currently present
cmdheight = 0,
}
for k, v in pairs(o) do
vim.opt[k] = v
vim.opt[k] = v
end
vim.api.nvim_set_var('tex_flavor', 'latex')
vim.api.nvim_set_var("tex_flavor", "latex")
disable_builtins(default_builtins_disabled)

View file

@ -3,15 +3,15 @@
-- 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
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
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

View file

@ -1,45 +1,42 @@
local util = require('lspconfig/util')
local util = require("lspconfig/util")
local path = util.path
local T = {}
local exepath = vim.fn.exepath
local path_sep = function()
local is_win = vim.loop.os_uname().sysname:find('Windows')
if is_win then
return '\\'
else
return '/'
end
local is_win = vim.loop.os_uname().sysname:find("Windows")
if is_win then
return "\\"
else
return "/"
end
end
-- from https://github.com/ray-x/navigator.lua/issues/247#issue-1465308677
T.get_path = function(workspace)
-- Use activated virtualenv.
if vim.env.VIRTUAL_ENV then
return path.join(vim.env.VIRTUAL_ENV, 'bin', 'python'), 'virtual env'
end
-- Use activated virtualenv.
if vim.env.VIRTUAL_ENV then
return path.join(vim.env.VIRTUAL_ENV, "bin", "python"), "virtual env"
end
-- Find and use virtualenv in workspace directory.
for _, pattern in ipairs({ '*', '.*' }) do
local match = vim.fn.glob(path.join(workspace, pattern, 'pyvenv.cfg'))
local sep = path_sep()
local py = 'bin' .. sep .. 'python'
if match ~= '' then
match = string.gsub(match, 'pyvenv.cfg', py)
return match, string.format('venv base folder: %s', match)
end
match = vim.fn.glob(path.join(workspace, pattern, 'poetry.lock'))
if match ~= '' then
local venv_base_folder = vim.fn.trim(vim.fn.system(
'poetry env info -p'))
return path.join(venv_base_folder, 'bin', 'python'),
string.format('venv base folder: %s', venv_base_folder)
end
end
-- Find and use virtualenv in workspace directory.
for _, pattern in ipairs({ "*", ".*" }) do
local match = vim.fn.glob(path.join(workspace, pattern, "pyvenv.cfg"))
local sep = path_sep()
local py = "bin" .. sep .. "python"
if match ~= "" then
match = string.gsub(match, "pyvenv.cfg", py)
return match, string.format("venv base folder: %s", match)
end
match = vim.fn.glob(path.join(workspace, pattern, "poetry.lock"))
if match ~= "" then
local venv_base_folder = vim.fn.trim(vim.fn.system("poetry env info -p"))
return path.join(venv_base_folder, "bin", "python"), string.format("venv base folder: %s", venv_base_folder)
end
end
-- Fallback to system Python.
return exepath('python3') or exepath('python') or 'python',
'fallback to system python path'
-- Fallback to system Python.
return exepath("python3") or exepath("python") or "python", "fallback to system python path"
end
return T