Compare commits
2 Commits
8c512a2572
...
c423d2a5f8
Author | SHA1 | Date | |
---|---|---|---|
c423d2a5f8 | |||
95fefd2304 |
@ -32,21 +32,21 @@ vim.api.nvim_create_autocmd(
|
|||||||
-- syntax highlighting
|
-- syntax highlighting
|
||||||
-- plug: nvim-treesitter
|
-- plug: nvim-treesitter
|
||||||
------
|
------
|
||||||
require'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
ensure_installed = { "c", "cpp", "javascript", "typescript", "python", "vim", "fish", "bash" },
|
ensure_installed = { "c", "cpp", "javascript", "typescript", "python", "vim", "fish", "bash" },
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
auto_install = false,
|
auto_install = false,
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|
||||||
disable = function(lang, buf)
|
disable = function(lang, buf)
|
||||||
local max_filesize = 100 * 1024 -- 100 KB
|
local max_filesize = 100 * 1024 -- 100 KB
|
||||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
if ok and stats and stats.size > max_filesize then
|
if ok and stats and stats.size > max_filesize then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -55,18 +55,18 @@ require'nvim-treesitter.configs'.setup {
|
|||||||
-- plug: trouble.nvim
|
-- plug: trouble.nvim
|
||||||
------
|
------
|
||||||
require('trouble').setup({
|
require('trouble').setup({
|
||||||
icons = false,
|
icons = false,
|
||||||
fold_open = "v", -- icon used for open folds
|
fold_open = "v", -- icon used for open folds
|
||||||
fold_closed = ">", -- icon used for closed folds
|
fold_closed = ">", -- icon used for closed folds
|
||||||
indent_lines = false, -- add an indent guide below the fold icons
|
indent_lines = false, -- add an indent guide below the fold icons
|
||||||
signs = {
|
signs = {
|
||||||
-- icons / text used for a diagnostic
|
-- icons / text used for a diagnostic
|
||||||
error = "error",
|
error = "error",
|
||||||
warning = "warn",
|
warning = "warn",
|
||||||
hint = "hint",
|
hint = "hint",
|
||||||
information = "info"
|
information = "info"
|
||||||
},
|
},
|
||||||
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
|
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
|
||||||
})
|
})
|
||||||
keymap("<leader>dxx", "<cmd>TroubleToggle<cr>")
|
keymap("<leader>dxx", "<cmd>TroubleToggle<cr>")
|
||||||
keymap("<leader>dxw", "<cmd>TroubleToggle workspace_diagnostics<cr>")
|
keymap("<leader>dxw", "<cmd>TroubleToggle workspace_diagnostics<cr>")
|
||||||
@ -88,12 +88,11 @@ keymap("gR", "<cmd>TroubleToggle lsp_references<cr>")
|
|||||||
-- plug: nvim-lspconfig
|
-- plug: nvim-lspconfig
|
||||||
------
|
------
|
||||||
local on_attach = function(client, bufnr)
|
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
|
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
local opts = { noremap=true, silent=true }
|
local opts = { noremap = true, silent = true }
|
||||||
keymap('gD', vim.lsp.buf.declaration, opts)
|
keymap('gD', vim.lsp.buf.declaration, opts)
|
||||||
keymap('gd', vim.lsp.buf.definition, opts)
|
keymap('gd', vim.lsp.buf.definition, opts)
|
||||||
keymap('gK', vim.lsp.buf.hover, opts)
|
keymap('gK', vim.lsp.buf.hover, opts)
|
||||||
@ -127,6 +126,21 @@ local servers = {
|
|||||||
tsserver = {},
|
tsserver = {},
|
||||||
bashls = {},
|
bashls = {},
|
||||||
cssls = {},
|
cssls = {},
|
||||||
|
lua_ls = {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
version = "LuaJIT",
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
library = {
|
||||||
|
vim.env.VIMRUNTIME,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
rust_analyzer = {
|
rust_analyzer = {
|
||||||
settings = {
|
settings = {
|
||||||
['rust-analyzer'] = {
|
['rust-analyzer'] = {
|
||||||
@ -140,7 +154,7 @@ local servers = {
|
|||||||
local nvim_lsp = require('lspconfig')
|
local nvim_lsp = require('lspconfig')
|
||||||
for lsp, sv_settings in pairs(servers) do
|
for lsp, sv_settings in pairs(servers) do
|
||||||
-- defaults
|
-- defaults
|
||||||
settings = {
|
local settings = {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = {
|
flags = {
|
||||||
debounce_text_changes = 150,
|
debounce_text_changes = 150,
|
||||||
@ -162,8 +176,8 @@ cmp.setup({
|
|||||||
documentation = cmp.config.window.bordered(),
|
documentation = cmp.config.window.bordered(),
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
['<C-f>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
['<C-f>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
}),
|
}),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
|
@ -8,26 +8,31 @@ function M.keymap(key, cmd, params)
|
|||||||
params = {}
|
params = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
default_params = {
|
if cmd == nil then
|
||||||
silent=true,
|
-- sometimes a function will be there, sometimes not
|
||||||
mode={'n'},
|
return
|
||||||
noremap=true,
|
end
|
||||||
|
|
||||||
|
local default_params = {
|
||||||
|
silent = true,
|
||||||
|
mode = { 'n' },
|
||||||
|
noremap = true,
|
||||||
}
|
}
|
||||||
setmetatable(params, {
|
setmetatable(params, {
|
||||||
__index = function (table, key)
|
__index = function(table, k)
|
||||||
return default_params[key]
|
return default_params[k]
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set(params.mode, key, cmd, { silent=params.silent, noremap=params.noremap })
|
vim.keymap.set(params.mode, key, cmd, { silent = params.silent, noremap = params.noremap })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- see ~/.config/dot_profile.example for info
|
-- see ~/.config/dot_profile.example for info
|
||||||
-- enables/disables features based on system profile
|
-- enables/disables features based on system profile
|
||||||
M.profile_table = {
|
M.profile_table = {
|
||||||
DEFAULT=80,
|
DEFAULT = 80,
|
||||||
SLIM=40,
|
SLIM = 40,
|
||||||
MINIMAL=10,
|
MINIMAL = 10,
|
||||||
}
|
}
|
||||||
M.dotprofile = M.profile_table[os.getenv("SYSTEM_PROFILE")] or profile_table.SLIM
|
M.dotprofile = M.profile_table[os.getenv("SYSTEM_PROFILE")] or profile_table.SLIM
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ keymap("<leader>dsc", dap.clear_breakpoints)
|
|||||||
keymap("<leader>dsF", function()
|
keymap("<leader>dsF", function()
|
||||||
dap.set_breakpoint(vim.fn.input("cond: "))
|
dap.set_breakpoint(vim.fn.input("cond: "))
|
||||||
end)
|
end)
|
||||||
keymap("K", dapui.eval, {mode = {'n', 'v'}})
|
keymap("K", dapui.eval, { mode = { 'n', 'v' } })
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
-- ui setup
|
-- ui setup
|
||||||
@ -129,27 +129,29 @@ function M.dbg_dir(file)
|
|||||||
-- get a directory to store files needed for debugging
|
-- get a directory to store files needed for debugging
|
||||||
-- like ad hoc test cases, or compiled binaries
|
-- like ad hoc test cases, or compiled binaries
|
||||||
local dir = assert(vim.env.XDG_CACHE_HOME, "$XDG_CACHE_HOME is unset") .. "/nvimdbg"
|
local dir = assert(vim.env.XDG_CACHE_HOME, "$XDG_CACHE_HOME is unset") .. "/nvimdbg"
|
||||||
local file = gf(file)
|
file = gf(file)
|
||||||
local subdir = dir .. file
|
local subdir = dir .. file
|
||||||
assert(vim.fn.mkdir(subdir, "p"), "Could not create debug directory.")
|
assert(vim.fn.mkdir(subdir, "p"), "Could not create debug directory.")
|
||||||
return subdir
|
return subdir
|
||||||
end
|
end
|
||||||
|
|
||||||
function compile(file)
|
function M.compile(file)
|
||||||
local file = gf(file)
|
file = gf(file)
|
||||||
local subdir = M.dbg_dir(file)
|
local subdir = M.dbg_dir(file)
|
||||||
vim.fn.execute("make " .. subdir .. "/binary " .. "-f $XDG_CONFIG_HOME/nvim/makefile")
|
vim.fn.execute("make " .. subdir .. "/binary " .. "-f $XDG_CONFIG_HOME/nvim/makefile")
|
||||||
end
|
end
|
||||||
keymap("<leader>dc", compile)
|
|
||||||
|
|
||||||
function write_input(file)
|
keymap("<leader>dc", M.compile)
|
||||||
|
|
||||||
|
function M.write_input(file)
|
||||||
-- store ad hoc test input from clipboard
|
-- store ad hoc test input from clipboard
|
||||||
local file = gf(file)
|
file = gf(file)
|
||||||
local inp_file = M.dbg_dir(file) .. "/input"
|
local inp_file = M.dbg_dir(file) .. "/input"
|
||||||
vim.fn.writefile(vim.fn.getreg("+", 1, 1), inp_file)
|
vim.fn.writefile(vim.fn.getreg("+", 1, 1), inp_file)
|
||||||
end
|
end
|
||||||
function run_input(file)
|
|
||||||
local file = gf(file)
|
function M.run_input(file)
|
||||||
|
file = gf(file)
|
||||||
if not dapui.elements.console then
|
if not dapui.elements.console then
|
||||||
print("Unable to feed input: no console found")
|
print("Unable to feed input: no console found")
|
||||||
return
|
return
|
||||||
@ -160,14 +162,14 @@ function run_input(file)
|
|||||||
let @x = join(readfile(b:nvimdbg_inp_file), "\n") .. "\n\n"
|
let @x = join(readfile(b:nvimdbg_inp_file), "\n") .. "\n\n"
|
||||||
normal G"xp
|
normal G"xp
|
||||||
]]
|
]]
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
keymap("<leader>rw", write_input)
|
|
||||||
keymap("<leader>ri", run_input)
|
|
||||||
|
|
||||||
function run_tests(file)
|
keymap("<leader>rw", M.write_input)
|
||||||
local file = gf(file)
|
keymap("<leader>ri", M.run_input)
|
||||||
|
|
||||||
|
function M.run_tests(file)
|
||||||
|
file = gf(file)
|
||||||
local executable
|
local executable
|
||||||
if vim.fn.expand("%:e") == "cpp" then
|
if vim.fn.expand("%:e") == "cpp" then
|
||||||
executable = M.dbg_dir(file) .. "/binary"
|
executable = M.dbg_dir(file) .. "/binary"
|
||||||
@ -187,7 +189,7 @@ function run_tests(file)
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
keymap("<leader>dt", run_tests)
|
keymap("<leader>dt", M.run_tests)
|
||||||
|
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
@ -212,15 +214,15 @@ end
|
|||||||
dap.configurations.python = {
|
dap.configurations.python = {
|
||||||
{
|
{
|
||||||
-- dap parts
|
-- dap parts
|
||||||
type = "python";
|
type = "python",
|
||||||
request = "launch";
|
request = "launch",
|
||||||
name = "launch file";
|
name = "launch file",
|
||||||
|
|
||||||
-- debugger parts
|
-- debugger parts
|
||||||
program = "${file}";
|
program = "${file}",
|
||||||
-- this could be smarter (e.g., try to find a virtual env)
|
-- this could be smarter (e.g., try to find a virtual env)
|
||||||
pythonPath = function() return "/usr/bin/python" end;
|
pythonPath = function() return "/usr/bin/python" end,
|
||||||
console = "integratedTerminal";
|
console = "integratedTerminal",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
-- lua entry point
|
-- lua entry point
|
||||||
|
|
||||||
confutil = require("confutil")
|
local confutil = require("confutil")
|
||||||
|
|
||||||
keymap = confutil.keymap
|
local keymap = confutil.keymap
|
||||||
dotprofile, profile_table = confutil.dotprofile, confutil.profile_table
|
local dotprofile, profile_table = confutil.dotprofile, confutil.profile_table
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
require("noirbuddy").setup({
|
require("noirbuddy").setup({
|
||||||
colors = {
|
colors = {
|
||||||
primary="#99AABB"
|
primary = "#99AABB"
|
||||||
},
|
},
|
||||||
styles = {
|
styles = {
|
||||||
italic = true,
|
italic = true,
|
||||||
@ -15,19 +15,20 @@ require("noirbuddy").setup({
|
|||||||
},
|
},
|
||||||
preset = "slate",
|
preset = "slate",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- force transparent bg
|
-- force transparent bg
|
||||||
local Color, colors, Group, groups, styles = require("colorbuddy").setup {}
|
local Color, colors, Group, groups, styles = require("colorbuddy").setup {}
|
||||||
Group.new("Normal", colors.noir_4, colors.none, no)
|
Group.new("Normal", colors.noir_4, colors.none, nil)
|
||||||
Group.new("StatusLine", colors.noir_4, colors.none, styles.bold)
|
Group.new("StatusLine", colors.noir_4, colors.none, styles.bold)
|
||||||
-- not selected statusline
|
-- not selected statusline
|
||||||
Group.new("StatusLineNC", colors.noir_7, colors.none)
|
Group.new("StatusLineNC", colors.noir_7, colors.none)
|
||||||
Group.link("Gutter", groups.normal)
|
Group.link("Gutter", groups.normal)
|
||||||
Group.new("LineNr", colors.noir_8, colors.none, no)
|
Group.new("LineNr", colors.noir_8, colors.none, nil)
|
||||||
Group.link("SignColumn", groups.LineNr)
|
Group.link("SignColumn", groups.LineNr)
|
||||||
Group.new("VertSplit", colors.noir_9, colors.none, no)
|
Group.new("VertSplit", colors.noir_9, colors.none, nil)
|
||||||
|
|
||||||
-- other overrides
|
-- other overrides
|
||||||
Group.new("identifier", colors.noir_3, nil, no)
|
Group.new("identifier", colors.noir_3, nil, nil)
|
||||||
|
|
||||||
Group.new("function", colors.noir_2, nil)
|
Group.new("function", colors.noir_2, nil)
|
||||||
Group.link("@function", groups["function"])
|
Group.link("@function", groups["function"])
|
||||||
@ -41,11 +42,11 @@ Group.link("@keyword.return", groups["keyword.return"])
|
|||||||
Group.link("type.qualifier", groups["keyword.return"])
|
Group.link("type.qualifier", 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, no)
|
Group.new("NormalFloat", colors.noir_1, colors.noir_9, nil)
|
||||||
|
|
||||||
-- swap undercurls and underlines
|
-- swap undercurls and underlines
|
||||||
for _, v in ipairs({"Error", "Info", "Hint", "Warn"}) do
|
for _, v in ipairs({ "Error", "Info", "Hint", "Warn" }) do
|
||||||
col_name = "diagnostic_" .. string.lower(v)
|
local col_name = "diagnostic_" .. string.lower(v)
|
||||||
if v == "Warn" then
|
if v == "Warn" then
|
||||||
col_name = "diagnostic_warning"
|
col_name = "diagnostic_warning"
|
||||||
end
|
end
|
||||||
@ -56,8 +57,8 @@ end
|
|||||||
|
|
||||||
-- DAP-ui colors
|
-- DAP-ui colors
|
||||||
|
|
||||||
Group.new("debugPC", primary, colors.noir_8)
|
Group.new("debugPC", colors.primary, colors.noir_8)
|
||||||
Group.new("DapUIModifiedValue", primary, nil, styles.bold)
|
Group.new("DapUIModifiedValue", colors.primary, nil, styles.bold)
|
||||||
Group.new("DapUIWatchesEmpty", colors.noir_8, nil, nil)
|
Group.new("DapUIWatchesEmpty", colors.noir_8, nil, nil)
|
||||||
Group.new("DapUIWatchesError", colors.diff_delete, nil, nil)
|
Group.new("DapUIWatchesError", colors.diff_delete, nil, nil)
|
||||||
Group.new("DapUISource", colors.primary, nil, nil)
|
Group.new("DapUISource", colors.primary, nil, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user