aboutsummaryrefslogtreecommitdiff
path: root/dot_config
diff options
context:
space:
mode:
Diffstat (limited to 'dot_config')
-rw-r--r--dot_config/nvim/init.lua.tmpl (renamed from dot_config/nvim/init.lua)95
-rw-r--r--dot_config/nvim/lua/plugins/catppuccin.lua6
-rw-r--r--dot_config/nvim/lua/plugins/dap.lua44
-rw-r--r--dot_config/nvim/lua/plugins/lsp.lua2
-rw-r--r--dot_config/nvim/lua/plugins/lualine.lua10
-rw-r--r--dot_config/nvim/lua/plugins/telescope.lua6
-rw-r--r--dot_config/nvim/lua/plugins/tmux.lua.tmpl (renamed from dot_config/nvim/lua/plugins/tmux.lua)4
-rw-r--r--dot_config/nvim/lua/plugins/which-key.lua9
8 files changed, 96 insertions, 80 deletions
diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua.tmpl
index b618040..2f6aa79 100644
--- a/dot_config/nvim/init.lua
+++ b/dot_config/nvim/init.lua.tmpl
@@ -38,6 +38,8 @@ vim.keymap.set("n", "<leader>-", function()
vim.cmd.new()
end, { desc = "Pane split down" })
+-- Movement
+{{ if eq .chezmoi.hostname "gentoo" }}
local function smart_move(direction, vim_cmd)
return function()
local before = vim.api.nvim_get_current_win()
@@ -62,26 +64,30 @@ vim.keymap.set('n', '<D-l>', smart_move("right", "l"), { noremap = true, silent
vim.keymap.set('n', '<D-j>', smart_move("down", "j"), { noremap = true, silent = false, desc = "Move to down window" });
vim.keymap.set('n', '<D-k>', smart_move("up", "k"), { noremap = true, silent = false, desc = "Move to up window" });
+{{ end }}
+
vim.api.nvim_set_keymap('n', 'gb', ':bnext<CR>', { noremap = true, silent = true, desc = "Go back last buffer" });
vim.api.nvim_set_keymap('t', '<c-[><c-[>', '<C-\\><C-n>', { noremap = true, silent = true, desc = "Escape Terminal" });
vim.api.nvim_create_autocmd('TermOpen', {
group = vim.api.nvim_create_augroup('custom-term-open', { clear = true }),
callback = function()
- vim.opt.number = false
- vim.opt.relativenumber = false
+ vim.opt_local.number = false
+ vim.opt_local.relativenumber = false
end,
});
-- Telescope
-local builtin = require("telescope.builtin")
-vim.keymap.set('n', '<leader>fg', function() builtin.live_grep({ glob_pattern = "!*_templ.go" }) end,
+vim.keymap.set('n', '<leader>fg', function() require("telescope.builtin").live_grep({ glob_pattern = "!*_templ.go" }) end,
{ desc = "Telescope live grep" })
-vim.keymap.set('n', 'gl', builtin.lsp_references, { desc = "Telescope show references" })
-vim.keymap.set('n', '<leader>fx', builtin.diagnostics, { desc = "Telescope open diagnostics" })
-vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = "Telescope find files" })
-vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = "Telescope open buffers" })
+vim.keymap.set('n', 'gl', function() require("telescope.builtin").lsp_references() end,
+ { desc = "Telescope show references" })
+vim.keymap.set('n', '<leader>fx', function() require("telescope.builtin").diagnostics() end,
+ { desc = "Telescope open diagnostics" })
+vim.keymap.set('n', '<leader>ff', function() require("telescope.builtin").find_files() end,
+ { desc = "Telescope find files" })
+vim.keymap.set('n', '<leader>fb', function() require("telescope.builtin").buffers() end, { desc = "Telescope open buffers" })
-- Formating
vim.keymap.set("n", "<leader>gf", function()
@@ -92,30 +98,34 @@ end, { desc = "Format buffer" })
vim.keymap.set("n", "<leader>e", ":Oil<CR>", { desc = "Open file explorer: OIL" })
-- Neotest
-local neotest = require("neotest")
vim.keymap.set("n", "<leader>ts", function()
- neotest.summary.toggle()
+ require("neotest").summary.toggle()
end, { desc = "Neotest open summary" })
-vim.keymap.set("n", "<leader>to", neotest.output.open, { desc = "Neotest open output" })
-vim.keymap.set("n", "<leader>td", function() neotest.run.run({ suite = false, strategy = "dap" }) end,
+vim.keymap.set("n", "<leader>to", function() require("neotest").output.open() end, { desc = "Neotest open output" })
+vim.keymap.set("n", "<leader>td", function() require("neotest").run.run({ suite = false, strategy = "dap" }) end,
{ desc = "Neotest debug closest test" })
-vim.keymap.set("n", "<leader>tr", function() neotest.run.run({ suite = false }) end,
+vim.keymap.set("n", "<leader>tr", function() require("neotest").run.run({ suite = false }) end,
{ desc = "Neotest run closest test" })
-- Debugging
-local dap = require("dap")
-vim.keymap.set("n", "<leader>db", dap.toggle_breakpoint,
+vim.keymap.set("n", "<leader>db", function() require("dap").toggle_breakpoint() end,
{ nowait = true, remap = false, desc = "Debug toggle breakpoint" })
-vim.keymap.set("n", "<leader>dc", dap.continue, { nowait = true, remap = false, desc = "Debug continue" })
-vim.keymap.set("n", "<leader>di", dap.step_into, { nowait = true, remap = false, desc = "Debug step into" })
-vim.keymap.set("n", "<leader>do", dap.step_over, { nowait = true, remap = false, desc = "Debug step over" })
-vim.keymap.set("n", "<leader>dr", dap.repl.open, { nowait = true, remap = false, desc = "Debug open repl" })
+vim.keymap.set("n", "<leader>dc", function() require("dap").continue() end,
+ { nowait = true, remap = false, desc = "Debug continue" })
+vim.keymap.set("n", "<leader>di", function() require("dap").step_into() end,
+ { nowait = true, remap = false, desc = "Debug step into" })
+vim.keymap.set("n", "<leader>do", function() require("dap").step_over() end,
+ { nowait = true, remap = false, desc = "Debug step over" })
+vim.keymap.set("n", "<leader>dr", function() require("dap").repl.open() end,
+ { nowait = true, remap = false, desc = "Debug open repl" })
vim.keymap.set("n", "<leader>dq", function()
+ local dap = require("dap")
dap.terminate()
require("dapui").close()
require("nvim-dap-virtual-text").toggle()
end, { nowait = true, remap = false, desc = "Debug close" })
-vim.keymap.set("n", "<leader>dl", dap.list_breakpoints, { nowait = true, remap = false, desc = "Debug list breakpoints" })
+vim.keymap.set("n", "<leader>dl", function() require("dap").list_breakpoints() end,
+ { nowait = true, remap = false, desc = "Debug list breakpoints" })
local function read_pyproject()
local results = vim.fs.find("pyproject.toml", { upward = true, stop = vim.loop.os_homedir() })
@@ -201,20 +211,16 @@ vim.keymap.set("n", "<leader>dps", function()
vim.log.levels.INFO
)
- local dap = require("dap")
- dap.configurations.python = {
- {
- type = "python",
- request = "launch",
- name = "Debug: " .. script_name,
- module = package,
- args = args,
- pythonPath = get_python_path(),
- justMyCode = false,
- console = "integratedTerminal",
- },
- }
- dap.continue()
+ require("dap").run({
+ type = "python",
+ request = "launch",
+ name = "Debug: " .. script_name,
+ module = package,
+ args = args,
+ pythonPath = get_python_path(),
+ justMyCode = false,
+ console = "integratedTerminal",
+ })
end
local function show_param_input(script_name, module)
@@ -258,3 +264,24 @@ vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename, { desc = "LSP rename" })
-- Motions
vim.keymap.set("n", "<C-d>", "<C-d>zz", {})
vim.keymap.set("n", "<C-u>", "<C-u>zz", {})
+
+-- Disable unused
+for _, key in ipairs({
+ "Q",
+ "q:",
+ "q/",
+ "q?",
+ "ZZ",
+ "ZQ",
+ "<C-z>",
+ "U",
+ "gQ",
+ "<Up>",
+ "<Down>",
+ "<Left>",
+ "<Right>",
+ "<S-Down>",
+ "<S-Up>"
+}) do
+ vim.keymap.set("n", key, "<Nop>")
+end
diff --git a/dot_config/nvim/lua/plugins/catppuccin.lua b/dot_config/nvim/lua/plugins/catppuccin.lua
index 772b80e..b60a0e4 100644
--- a/dot_config/nvim/lua/plugins/catppuccin.lua
+++ b/dot_config/nvim/lua/plugins/catppuccin.lua
@@ -5,9 +5,9 @@ return
priority = 1000,
lazy = false,
config = function()
- -- require("catppuccin").setup({
- -- transparent_background = true,
- -- })
+ require("catppuccin").setup({
+ transparent_background = true,
+ })
vim.cmd.colorscheme "catppuccin"
end
diff --git a/dot_config/nvim/lua/plugins/dap.lua b/dot_config/nvim/lua/plugins/dap.lua
index 6d63dfa..1314be1 100644
--- a/dot_config/nvim/lua/plugins/dap.lua
+++ b/dot_config/nvim/lua/plugins/dap.lua
@@ -27,31 +27,29 @@ return {
})
-- Configurations
- dap.configurations = {
- python = {
- {
- -- The first three options are required by nvim-dap
- type = "python", -- the type here established the link to the adapter definition: `dap.adapters.python`
- request = "launch",
- name = "Launch file",
+ dap.configurations.python = {
+ {
+ -- The first three options are required by nvim-dap
+ type = "python", -- the type here established the link to the adapter definition: `dap.adapters.python`
+ request = "launch",
+ name = "Launch file",
- -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
+ -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
- program = "${file}", -- This configuration will launch the current file if used.
- pythonPath = function()
- -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
- -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
- -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
- local cwd = vim.fn.getcwd()
- if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
- return cwd .. "/venv/bin/python"
- elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
- return cwd .. "/.venv/bin/python"
- else
- return "/usr/bin/python"
- end
- end,
- },
+ program = "${file}", -- This configuration will launch the current file if used.
+ pythonPath = function()
+ -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
+ -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
+ -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
+ local cwd = vim.fn.getcwd()
+ if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
+ return cwd .. "/venv/bin/python"
+ elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
+ return cwd .. "/.venv/bin/python"
+ else
+ return vim.fn.exepath("python")
+ end
+ end,
},
}
diff --git a/dot_config/nvim/lua/plugins/lsp.lua b/dot_config/nvim/lua/plugins/lsp.lua
index 78c93dd..aa4388a 100644
--- a/dot_config/nvim/lua/plugins/lsp.lua
+++ b/dot_config/nvim/lua/plugins/lsp.lua
@@ -7,7 +7,7 @@ return {
"gopls",
"html",
"yamlls",
- "svelte-language-server",
+ "svelte",
"clangd",
"ansiblels",
"vtsls",
diff --git a/dot_config/nvim/lua/plugins/lualine.lua b/dot_config/nvim/lua/plugins/lualine.lua
index 68bb97d..71522da 100644
--- a/dot_config/nvim/lua/plugins/lualine.lua
+++ b/dot_config/nvim/lua/plugins/lualine.lua
@@ -6,16 +6,6 @@ return {
-- options = {
-- theme = 'catppuccin'
-- },
- sections = {
- lualine_x = {
- function()
- return require('direnv').statusline()
- end,
- 'encoding',
- 'fileformat',
- 'filetype',
- }
- }
})
end
}
diff --git a/dot_config/nvim/lua/plugins/telescope.lua b/dot_config/nvim/lua/plugins/telescope.lua
index 9134656..d5b89d1 100644
--- a/dot_config/nvim/lua/plugins/telescope.lua
+++ b/dot_config/nvim/lua/plugins/telescope.lua
@@ -6,9 +6,6 @@ return {
'BurntSushi/ripgrep',
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
},
- },
- {
- 'nvim-telescope/telescope-ui-select.nvim',
config = function()
local telescope = require("telescope")
telescope.setup({
@@ -28,5 +25,8 @@ return {
telescope.load_extension("ui-select")
telescope.load_extension("fzf")
end
+ },
+ {
+ 'nvim-telescope/telescope-ui-select.nvim',
}
}
diff --git a/dot_config/nvim/lua/plugins/tmux.lua b/dot_config/nvim/lua/plugins/tmux.lua.tmpl
index 2b859f8..5c73b6c 100644
--- a/dot_config/nvim/lua/plugins/tmux.lua
+++ b/dot_config/nvim/lua/plugins/tmux.lua.tmpl
@@ -1,3 +1,4 @@
+{{ if ne .chezmoi.hostname "gentoo" }}
return {
'alexghergh/nvim-tmux-navigation',
config = function()
@@ -13,3 +14,6 @@ return {
}
end
}
+{{ else }}
+return {}
+{{ end }}
diff --git a/dot_config/nvim/lua/plugins/which-key.lua b/dot_config/nvim/lua/plugins/which-key.lua
index 62125fe..7db392f 100644
--- a/dot_config/nvim/lua/plugins/which-key.lua
+++ b/dot_config/nvim/lua/plugins/which-key.lua
@@ -1,11 +1,7 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
- opts = {
- -- your configuration comes here
- -- or leave it empty to use the default settings
- -- refer to the configuration section below
- },
+ opts = {},
keys = {
{
"<leader>?",
@@ -15,8 +11,9 @@ return {
desc = "Buffer Local Keymaps (which-key)",
},
},
- config = function()
+ config = function(_, opts)
local wk = require("which-key")
+ wk.setup(opts)
wk.add({
{ "<leader>d", group = "Debug" },
{ "<leader>f", group = "Telescope" },