Compare commits

..

No commits in common. "c423d2a5f85a80d8269f0b40441ab9d859f1db1c" and "8c512a2572d1217f06a99920eb77ba2c6b7c2572" have entirely different histories.

5 changed files with 75 additions and 97 deletions

View File

@ -88,6 +88,7 @@ keymap("gR", "<cmd>TroubleToggle lsp_references<cr>")
-- plug: nvim-lspconfig
------
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
@ -126,21 +127,6 @@ local servers = {
tsserver = {},
bashls = {},
cssls = {},
lua_ls = {
settings = {
Lua = {
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
},
}
}
}
},
rust_analyzer = {
settings = {
['rust-analyzer'] = {
@ -154,7 +140,7 @@ local servers = {
local nvim_lsp = require('lspconfig')
for lsp, sv_settings in pairs(servers) do
-- defaults
local settings = {
settings = {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,

View File

@ -8,19 +8,14 @@ function M.keymap(key, cmd, params)
params = {}
end
if cmd == nil then
-- sometimes a function will be there, sometimes not
return
end
local default_params = {
default_params = {
silent=true,
mode={'n'},
noremap=true,
}
setmetatable(params, {
__index = function(table, k)
return default_params[k]
__index = function (table, key)
return default_params[key]
end
})

View File

@ -129,29 +129,27 @@ function M.dbg_dir(file)
-- get a directory to store files needed for debugging
-- like ad hoc test cases, or compiled binaries
local dir = assert(vim.env.XDG_CACHE_HOME, "$XDG_CACHE_HOME is unset") .. "/nvimdbg"
file = gf(file)
local file = gf(file)
local subdir = dir .. file
assert(vim.fn.mkdir(subdir, "p"), "Could not create debug directory.")
return subdir
end
function M.compile(file)
file = gf(file)
function compile(file)
local file = gf(file)
local subdir = M.dbg_dir(file)
vim.fn.execute("make " .. subdir .. "/binary " .. "-f $XDG_CONFIG_HOME/nvim/makefile")
end
keymap("<leader>dc", compile)
keymap("<leader>dc", M.compile)
function M.write_input(file)
function write_input(file)
-- store ad hoc test input from clipboard
file = gf(file)
local file = gf(file)
local inp_file = M.dbg_dir(file) .. "/input"
vim.fn.writefile(vim.fn.getreg("+", 1, 1), inp_file)
end
function M.run_input(file)
file = gf(file)
function run_input(file)
local file = gf(file)
if not dapui.elements.console then
print("Unable to feed input: no console found")
return
@ -162,14 +160,14 @@ function M.run_input(file)
let @x = join(readfile(b:nvimdbg_inp_file), "\n") .. "\n\n"
normal G"xp
]]
end)
end
keymap("<leader>rw", write_input)
keymap("<leader>ri", run_input)
keymap("<leader>rw", M.write_input)
keymap("<leader>ri", M.run_input)
function M.run_tests(file)
file = gf(file)
function run_tests(file)
local file = gf(file)
local executable
if vim.fn.expand("%:e") == "cpp" then
executable = M.dbg_dir(file) .. "/binary"
@ -189,7 +187,7 @@ function M.run_tests(file)
]]
end
keymap("<leader>dt", M.run_tests)
keymap("<leader>dt", run_tests)
----------------
@ -214,15 +212,15 @@ end
dap.configurations.python = {
{
-- dap parts
type = "python",
request = "launch",
name = "launch file",
type = "python";
request = "launch";
name = "launch file";
-- debugger parts
program = "${file}",
program = "${file}";
-- this could be smarter (e.g., try to find a virtual env)
pythonPath = function() return "/usr/bin/python" end,
console = "integratedTerminal",
pythonPath = function() return "/usr/bin/python" end;
console = "integratedTerminal";
}
}

View File

@ -1,9 +1,9 @@
-- lua entry point
local confutil = require("confutil")
confutil = require("confutil")
local keymap = confutil.keymap
local dotprofile, profile_table = confutil.dotprofile, confutil.profile_table
keymap = confutil.keymap
dotprofile, profile_table = confutil.dotprofile, confutil.profile_table
--------------------------------
--------------------------------

View File

@ -15,20 +15,19 @@ require("noirbuddy").setup({
},
preset = "slate",
})
-- force transparent bg
local Color, colors, Group, groups, styles = require("colorbuddy").setup {}
Group.new("Normal", colors.noir_4, colors.none, nil)
Group.new("Normal", colors.noir_4, colors.none, no)
Group.new("StatusLine", colors.noir_4, colors.none, styles.bold)
-- not selected statusline
Group.new("StatusLineNC", colors.noir_7, colors.none)
Group.link("Gutter", groups.normal)
Group.new("LineNr", colors.noir_8, colors.none, nil)
Group.new("LineNr", colors.noir_8, colors.none, no)
Group.link("SignColumn", groups.LineNr)
Group.new("VertSplit", colors.noir_9, colors.none, nil)
Group.new("VertSplit", colors.noir_9, colors.none, no)
-- other overrides
Group.new("identifier", colors.noir_3, nil, nil)
Group.new("identifier", colors.noir_3, nil, no)
Group.new("function", colors.noir_2, nil)
Group.link("@function", groups["function"])
@ -42,11 +41,11 @@ Group.link("@keyword.return", groups["keyword.return"])
Group.link("type.qualifier", groups["keyword.return"])
Group.link("@type.qualifier", groups["keyword.return"])
Group.new("NormalFloat", colors.noir_1, colors.noir_9, nil)
Group.new("NormalFloat", colors.noir_1, colors.noir_9, no)
-- swap undercurls and underlines
for _, v in ipairs({"Error", "Info", "Hint", "Warn"}) do
local col_name = "diagnostic_" .. string.lower(v)
col_name = "diagnostic_" .. string.lower(v)
if v == "Warn" then
col_name = "diagnostic_warning"
end
@ -57,8 +56,8 @@ end
-- DAP-ui colors
Group.new("debugPC", colors.primary, colors.noir_8)
Group.new("DapUIModifiedValue", colors.primary, nil, styles.bold)
Group.new("debugPC", primary, colors.noir_8)
Group.new("DapUIModifiedValue", primary, nil, styles.bold)
Group.new("DapUIWatchesEmpty", colors.noir_8, nil, nil)
Group.new("DapUIWatchesError", colors.diff_delete, nil, nil)
Group.new("DapUISource", colors.primary, nil, nil)