diff --git a/src/.config/nvim/lua/coding.lua b/src/.config/nvim/lua/coding.lua index 00e3a55..2a18331 100644 --- a/src/.config/nvim/lua/coding.lua +++ b/src/.config/nvim/lua/coding.lua @@ -32,21 +32,21 @@ vim.api.nvim_create_autocmd( -- syntax highlighting -- plug: nvim-treesitter ------ -require'nvim-treesitter.configs'.setup { - ensure_installed = { "c", "cpp", "javascript", "typescript", "python", "vim", "fish", "bash" }, - sync_install = false, - auto_install = false, - highlight = { - enable = true, +require 'nvim-treesitter.configs'.setup { + ensure_installed = { "c", "cpp", "javascript", "typescript", "python", "vim", "fish", "bash" }, + sync_install = false, + auto_install = false, + highlight = { + enable = true, - disable = function(lang, buf) - local max_filesize = 100 * 1024 -- 100 KB - 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 - return true - end - end, - }, + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + 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 + return true + end + end, + }, } @@ -55,18 +55,18 @@ require'nvim-treesitter.configs'.setup { -- plug: trouble.nvim ------ require('trouble').setup({ - icons = false, - fold_open = "v", -- icon used for open folds - fold_closed = ">", -- icon used for closed folds - indent_lines = false, -- add an indent guide below the fold icons - signs = { - -- icons / text used for a diagnostic - error = "error", - warning = "warn", - hint = "hint", - information = "info" - }, - use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client + icons = false, + fold_open = "v", -- icon used for open folds + fold_closed = ">", -- icon used for closed folds + indent_lines = false, -- add an indent guide below the fold icons + signs = { + -- icons / text used for a diagnostic + error = "error", + warning = "warn", + hint = "hint", + information = "info" + }, + use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client }) keymap("dxx", "TroubleToggle") keymap("dxw", "TroubleToggle workspace_diagnostics") @@ -92,7 +92,7 @@ local on_attach = function(client, bufnr) -- Enable completion triggered by 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.definition, opts) keymap('gK', vim.lsp.buf.hover, opts) @@ -176,8 +176,8 @@ cmp.setup({ documentation = cmp.config.window.bordered(), }, mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, diff --git a/src/.config/nvim/lua/confutil.lua b/src/.config/nvim/lua/confutil.lua index 435bde8..223373d 100644 --- a/src/.config/nvim/lua/confutil.lua +++ b/src/.config/nvim/lua/confutil.lua @@ -14,25 +14,25 @@ function M.keymap(key, cmd, params) end local default_params = { - silent=true, - mode={'n'}, - noremap=true, + silent = true, + mode = { 'n' }, + noremap = true, } setmetatable(params, { - __index = function (table, k) + __index = function(table, k) return default_params[k] 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 -- see ~/.config/dot_profile.example for info -- enables/disables features based on system profile M.profile_table = { - DEFAULT=80, - SLIM=40, - MINIMAL=10, + DEFAULT = 80, + SLIM = 40, + MINIMAL = 10, } M.dotprofile = M.profile_table[os.getenv("SYSTEM_PROFILE")] or profile_table.SLIM diff --git a/src/.config/nvim/lua/debugging.lua b/src/.config/nvim/lua/debugging.lua index d113afd..34d2fdc 100644 --- a/src/.config/nvim/lua/debugging.lua +++ b/src/.config/nvim/lua/debugging.lua @@ -35,7 +35,7 @@ keymap("dsc", dap.clear_breakpoints) keymap("dsF", function() dap.set_breakpoint(vim.fn.input("cond: ")) end) -keymap("K", dapui.eval, {mode = {'n', 'v'}}) +keymap("K", dapui.eval, { mode = { 'n', 'v' } }) ---------------- -- ui setup @@ -140,6 +140,7 @@ function M.compile(file) local subdir = M.dbg_dir(file) vim.fn.execute("make " .. subdir .. "/binary " .. "-f $XDG_CONFIG_HOME/nvim/makefile") end + keymap("dc", M.compile) function M.write_input(file) @@ -148,6 +149,7 @@ function M.write_input(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) if not dapui.elements.console then @@ -160,9 +162,9 @@ function M.run_input(file) let @x = join(readfile(b:nvimdbg_inp_file), "\n") .. "\n\n" normal G"xp ]] - end) end + keymap("rw", M.write_input) keymap("ri", M.run_input) @@ -212,15 +214,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", } } diff --git a/src/.config/nvim/lua/theme.lua b/src/.config/nvim/lua/theme.lua index 1b9c943..2a6ad6b 100644 --- a/src/.config/nvim/lua/theme.lua +++ b/src/.config/nvim/lua/theme.lua @@ -5,7 +5,7 @@ require("noirbuddy").setup({ colors = { - primary="#99AABB" + primary = "#99AABB" }, styles = { italic = true, @@ -45,7 +45,7 @@ Group.link("@type.qualifier", groups["keyword.return"]) Group.new("NormalFloat", colors.noir_1, colors.noir_9, nil) -- swap undercurls and underlines -for _, v in ipairs({"Error", "Info", "Hint", "Warn"}) do +for _, v in ipairs({ "Error", "Info", "Hint", "Warn" }) do local col_name = "diagnostic_" .. string.lower(v) if v == "Warn" then col_name = "diagnostic_warning"