Compare commits

...

4 commits

10 changed files with 132 additions and 83 deletions

View file

@ -1,6 +1,6 @@
# Nixvim
## TODO
[ ] Open last active buffer after :bd
[ ] Code action
[ ] DAP support
- [ ] Open last active buffer after :bd
- [ ] Code action
- [ ] DAP support

40
config/blink.nix Normal file
View file

@ -0,0 +1,40 @@
{
plugins = {
blink-cmp = {
enable = true;
settings = {
keymap = {
"<C-p>" = [
"scroll_documentation_up"
"fallback"
];
"<C-n>" = [
"scroll_documentation_down"
"fallback"
];
"<C-j>" = [
"select_next"
"fallback"
];
"<C-k>" = [
"select_prev"
"fallback"
];
"<C-space>" = [
"show"
"show_documentation"
"hide_documentation"
"fallback"
];
"<Tab>" = [
"select_and_accept"
"fallback"
];
};
};
};
cmp-nvim-lsp.enable = true;
cmp.enable = true;
};
}

View file

@ -0,0 +1,23 @@
{ helpers, ... }:
{
plugins = {
bufdelete = {
enable = true;
};
};
keymaps = [
{
mode = [ "n" ];
key = "<C-x>";
action = helpers.mkRaw ''
function()
require("bufdelete").bufdelete(0, false)
end
'';
options = {
desc = "Toggle terminal";
};
}
];
}

View file

@ -1,6 +1,8 @@
{
# Import all your configuration modules here
imports = [
./buffer/bufdelete.nix
./blink.nix
./bufferline.nix
./comment.nix
./core.nix
@ -14,7 +16,6 @@
./lsp
./lualine.nix
./neo-tree.nix
./nvim-cmp.nix
# ./project.nix
./rainbow-delimiters.nix
./telescope.nix
@ -22,6 +23,5 @@
./treesitter.nix
./which-key.nix
];
plugins.web-devicons.enable = true;
}

View file

@ -1,5 +1,53 @@
{ pkgs, ... }:
{
plugins.harpoon = {
enable = true;
};
# keymaps for this plugin are difined in config/keymaps/window-movements module
extraPlugins = with pkgs.vimPlugins; [
harpoon2
];
extraConfigLua = ''
local harpoon = require("harpoon")
harpoon:setup(
{
settings = {
save_on_toggle = true,
sync_on_ui_close = true,
key = function()
return vim.loop.cwd()
end,
},
}
)
-- basic telescope configuration
-- local conf = require("telescope.config").values
-- local function toggle_telescope(harpoon_files)
-- local file_paths = {}
-- for _, item in ipairs(harpoon_files.items) do
-- table.insert(file_paths, item.value)
-- end
--
-- require("telescope.pickers").new({}, {
-- prompt_title = "Harpoon",
-- finder = require("telescope.finders").new_table({
-- results = file_paths,
-- }),
-- previewer = conf.file_previewer({}),
-- sorter = conf.generic_sorter({}),
-- layout_strategy = getLayoutStrategy()
-- }):find()
-- end
--
-- vim.keymap.set("n", "<C-e>", function() toggle_telescope(harpoon:list()) end,
-- { desc = "Open harpoon window" })
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<C-a>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-s>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-f>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-g>", function() harpoon:list():select(4) end)
-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set("n", "<C-S-k>", function() harpoon:list():prev() end)
vim.keymap.set("n", "<C-S-j>", function() harpoon:list():next() end)
'';
}

View file

@ -83,14 +83,5 @@
desc = "Next Buffer";
};
}
{
mode = [ "n" "i" ];
key = "<S-Tab>";
action = "<cmd>tabprevious<cr>";
options = {
desc = "Previous Tab";
};
}
];
}

View file

@ -24,6 +24,9 @@
terraformls = {
enable = true;
};
gopls = {
enable = true;
};
};
inlayHints = true;
keymaps = {

View file

@ -1,61 +0,0 @@
{
plugins = {
cmp = {
enable = true;
settings = {
sources = [
{ name = "nvim_lsp"; }
{
name = "buffer"; # text within current buffer
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
keywordLength = 3;
}
{
name = "path"; # file system paths
keywordLength = 3;
}
{
name = "luasnip"; # snippets
keywordLength = 3;
}
];
mapping = {
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<C-j>" = "cmp.mapping.select_next_item()";
"<C-k>" = "cmp.mapping.select_prev_item()";
"<C-e>" = "cmp.mapping.abort()";
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
};
};
};
cmp-nvim-lsp.enable = true;
cmp-path.enable = true;
cmp-buffer.enable = true;
};
keymaps = [
# Need to map macro recording to another key due to:
# https://github.com/hrsh7th/nvim-cmp/issues/1692
{
mode = [ "n" ];
key = "<leader>q";
action = "q";
options = {
noremap = true;
silent = true;
};
}
{
mode = [ "n" ];
key = "q";
action = "<Nop>";
options = {
noremap = true;
silent = true;
};
}
];
}

View file

@ -6,7 +6,10 @@
};
keymaps = [
{
mode = [ "n" "i" ];
mode = [
"n"
"i"
];
key = "<C-p>";
action = helpers.mkRaw ''
function()
@ -18,11 +21,14 @@
};
}
{
mode = [ "n" "i" ];
mode = [
"n"
"i"
];
key = "<C-S-p>";
action = helpers.mkRaw ''
function()
require("telescope.builtin").help_tags()
require("telescope.builtin").live_grep()
end
'';
}

View file

@ -4,8 +4,7 @@
};
keymaps = [
{
{
mode = [ "n" ];
key = "<leader>tt";
action = "<cmd>ToggleTerm<cr>";