Clean up nvim config

This commit is contained in:
Martin Pander
2026-05-21 07:46:55 +02:00
parent a50db2350a
commit 186752a734
8 changed files with 48 additions and 93 deletions

1
.gitignore vendored
View File

@@ -1 +0,0 @@
plugins/

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "vim/bundle/Vundle.vim"]
path = vim/bundle/Vundle.vim
url = https://github.com/gmarik/Vundle.vim.git

View File

@@ -21,7 +21,7 @@
fileSystems."/home/pan/pro" = {
device = "/dev/disk/by-uuid/9a37862c-85db-4434-b06a-ec8c2713ecc9";
fsType = "ext4"; # or xfs, etc.
fsType = "ext4";
options = [ "defaults" "nofail" "x-systemd.automount" ];
};

View File

@@ -11,7 +11,4 @@
# Home Manager release version
home.stateVersion = "25.05";
# Disable version mismatch warning (intentionally using HM 25.11 with nixpkgs 25.05)
home.enableNixpkgsReleaseCheck = false;
}
}

View File

@@ -57,9 +57,6 @@ in
cmp-git
nvim-lspconfig
lspkind-nvim
# copilot-lua
# copilot-cmp
# CopilotChat-nvim
# opencode-nvim
bullets-vim
nvim-dap

View File

@@ -67,7 +67,6 @@ vim.opt.directory = swapdir .. "," .. temp
-------- CLIPBOARD ---------
----------------------------
-- Force Neovim to use the OSC 52 provider explicitly
-- This often resolves the "waiting" hang by properly handling the sequence
vim.g.clipboard = {
name = 'OSC 52',
copy = {

View File

@@ -1,17 +1,14 @@
vim.g.mapleader = " "
-- Convenience
vim.keymap.set('n', '<leader>w', ':w<CR>', { silent = true })
vim.keymap.set('n', '<leader>F', ':NvimTreeToggle<CR>', { noremap = true, silent = true })
vim.keymap.set('n', 'Y', 'y$', {})
-- Navigation
vim.keymap.set({'n', 'v'}, 'j', 'gj', {})
vim.keymap.set({'n', 'v'}, 'k', 'gk', {})
-- vim.keymap.set('n', '<C-M-h>', '<C-w>h', {})
-- vim.keymap.set('n', '<C-M-j>', '<C-w>j', {})
-- vim.keymap.set('n', '<C-M-k>', '<C-w>k', {})
-- vim.keymap.set('n', '<C-M-l>', '<C-w>l', {})
-- vim.keymap.set('t', '<C-M-h>', '<C-\\><C-n><C-w>h', {})
-- vim.keymap.set('t', '<C-M-j>', '<C-\\><C-n><C-w>j', {})
-- vim.keymap.set('t', '<C-M-k>', '<C-\\><C-n><C-w>k', {})
-- vim.keymap.set('t', '<C-M-l>', '<C-\\><C-n><C-w>l', {})
vim.keymap.set('n', '<leader>zm', '<C-W>_<C-W>|', { noremap = true, silent = true })
vim.keymap.set('n', '<C-M-Y>', '<C-w>5<', {})
vim.keymap.set('n', '<C-M-U>', '<C-w>5+', {})
@@ -24,10 +21,44 @@ vim.keymap.set('t', '<C-M-O>', '<C-\\><C-n><C-w>5>', {})
vim.keymap.set('n', '<leader>s', ':call WindowSwap#EasyWindowSwap()<CR>', {})
-- Convenience
vim.keymap.set('n', '<leader>w', ':w<CR>', { silent = true })
vim.keymap.set('n', '<leader>F', ':NvimTreeToggle<CR>', { noremap = true, silent = true })
vim.keymap.set('n', 'Y', 'y$', {})
-- tmux navigation
vim.g.tmux_navigator_no_mappings = 1
local function tmux_navigate(direction)
local old_win = vim.api.nvim_get_current_win()
vim.cmd('wincmd ' .. direction)
local new_win = vim.api.nvim_get_current_win()
if old_win == new_win then
local tmux_cmd = ""
if direction == 'h' then
tmux_cmd = 'if -F "#{pane_at_left}" "previous-window" "select-pane -L"'
elseif direction == 'j' then
tmux_cmd = 'if -F "#{pane_at_bottom}" "switch-client -n" "select-pane -D"'
elseif direction == 'k' then
tmux_cmd = 'if -F "#{pane_at_top}" "switch-client -p" "select-pane -U"'
elseif direction == 'l' then
tmux_cmd = 'if -F "#{pane_at_right}" "next-window" "select-pane -R"'
end
vim.fn.system('tmux ' .. tmux_cmd)
end
end
vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
vim.diagnostic.open_float(nil, { focusable = false })
end,
})
vim.keymap.set('n', '<C-M-h>', function() tmux_navigate('h') end)
vim.keymap.set('n', '<C-M-j>', function() tmux_navigate('j') end)
vim.keymap.set('n', '<C-M-k>', function() tmux_navigate('k') end)
vim.keymap.set('n', '<C-M-l>', function() tmux_navigate('l') end)
vim.keymap.set('t', '<C-M-h>', function() vim.cmd('stopinsert') tmux_navigate('h') end, { remap = true })
vim.keymap.set('t', '<C-M-j>', function() vim.cmd('stopinsert') tmux_navigate('j') end, { remap = true })
vim.keymap.set('t', '<C-M-k>', function() vim.cmd('stopinsert') tmux_navigate('k') end, { remap = true })
vim.keymap.set('t', '<C-M-l>', function() vim.cmd('stopinsert') tmux_navigate('l') end, { remap = true })
-- Telescope
local telebuiltin = require('telescope.builtin')
@@ -70,29 +101,6 @@ vim.keymap.set('v', '<leader>cf',
end
)
-- Copilot
-- local cop = require('copilot.panel')
-- local cos = require('copilot.suggestion')
--
-- vim.keymap.set('n', '<leader>ap', cop.toggle)
-- vim.keymap.set('n', '<leader>apn', cop.jump_next)
-- vim.keymap.set('n', '<leader>app', cop.jump_prev)
-- vim.keymap.set('n', '<leader>apr', cop.refresh)
--
-- vim.keymap.set('n', '<leader>as', cos.accept)
-- vim.keymap.set('n', '<leader>ast', cos.toggle_auto_trigger)
-- vim.keymap.set('n', '<leader>asl', cos.accept_word)
-- vim.keymap.set('n', '<leader>asw', cos.accept_line)
-- vim.keymap.set('n', '<leader>asn', cos.next)
-- vim.keymap.set('n', '<leader>asp', cos.prev)
-- vim.keymap.set('n', '<leader>asd', cos.dismiss)
-- vim.keymap.set('n', '<leader>ac', '<cmd>CopilotChatToggle<cr>')
-- vim.keymap.set('n', '<leader>acs', '<cmd>CopilotChatStop<cr>')
-- vim.keymap.set('n', '<leader>acr', '<cmd>CopilotChatReset<cr>')
-- vim.keymap.set('n', '<leader>acm', '<cmd>CopilotChatModels<cr>')
-- vim.keymap.set('n', '<leader>acp', '<cmd>CopilotChatPrompts<cr>')
-- Yanky
vim.keymap.set({"n","x"}, "p", "<Plug>(YankyPutAfter)")
vim.keymap.set({"n","x"}, "P", "<Plug>(YankyPutBefore)")
@@ -126,51 +134,9 @@ vim.keymap.set('n', "<leader>dw", function() require("dap.ui.widgets").hover() e
vim.keymap.set('n', "<leader>dv", function() require("dap-view").toggle() end)
vim.keymap.set('n', "<F5>", function() require("dap").continue() end)
vim.keymap.set('n', "<F2>", function() require("dap").step_into() end)
vim.keymap.set('n', "<F1>", function() require("dap").step_over() end)
vim.keymap.set('n', "<F2>", function() require("dap").step_into() end)
vim.keymap.set('n', "<F3>", function() require("dap").step_out() end)
vim.keymap.set('n', "<F4>", function() require("dap").run_to_cursor() end)
-- Tmux Navigator
vim.g.tmux_navigator_no_mappings = 1
local function tmux_navigate(direction)
local old_win = vim.api.nvim_get_current_win()
vim.cmd('wincmd ' .. direction)
local new_win = vim.api.nvim_get_current_win()
if old_win == new_win then
-- We are at the edge, let tmux handle it
-- This requires the tmux config to be set up to handle these keys when not in vim,
-- BUT since we are IN vim, we need to explicitly trigger the tmux action.
-- However, simply sending the key to tmux might just send it back to vim if we aren't careful,
-- or we can just run the tmux command directly.
local tmux_cmd = ""
if direction == 'h' then
tmux_cmd = 'if -F "#{pane_at_left}" "previous-window" "select-pane -L"'
elseif direction == 'j' then
tmux_cmd = 'if -F "#{pane_at_bottom}" "switch-client -n" "select-pane -D"'
elseif direction == 'k' then
tmux_cmd = 'if -F "#{pane_at_top}" "switch-client -p" "select-pane -U"'
elseif direction == 'l' then
tmux_cmd = 'if -F "#{pane_at_right}" "next-window" "select-pane -R"'
end
-- We use vim.fn.system to execute the tmux command
-- We need to wrap the command in 'tmux' call
vim.fn.system('tmux ' .. tmux_cmd)
end
end
vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
vim.diagnostic.open_float(nil, { focusable = false })
end,
})
vim.keymap.set('n', '<C-M-h>', function() tmux_navigate('h') end)
vim.keymap.set('n', '<C-M-j>', function() tmux_navigate('j') end)
vim.keymap.set('n', '<C-M-k>', function() tmux_navigate('k') end)
vim.keymap.set('n', '<C-M-l>', function() tmux_navigate('l') end)

View File

@@ -1,6 +1,6 @@
# Overlay to provide a pinned version of opencode
# This pins opencode to a specific nixpkgs commit to avoid issues
# with the latest unstable version (e.g., segfaults).
# with the latest unstable version (segfaults).
#
# Usage: Pass nixpkgs-opencode input when applying overlay:
# overlays = [ (import ./modules/overlays/opencode.nix nixpkgs-opencode) ];