mirror of
https://github.com/nmasur/dotfiles
synced 2024-12-05 01:19:09 +00:00
Compare commits
2 Commits
dee7c7302a
...
7a39acef1a
Author | SHA1 | Date | |
---|---|---|---|
|
7a39acef1a | ||
|
3438446347 |
@ -179,6 +179,7 @@
|
||||
./modules/neovim/plugins/lsp.nix
|
||||
./modules/neovim/plugins/completion.nix
|
||||
./modules/neovim/plugins/toggleterm.nix
|
||||
./modules/neovim/plugins/tree.nix
|
||||
./modules/colorscheme/gruvbox/neovim-gruvbox.nix
|
||||
];
|
||||
};
|
||||
|
10
modules/neovim/plugins/lsp.lua
Normal file
10
modules/neovim/plugins/lsp.lua
Normal file
@ -0,0 +1,10 @@
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
||||
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation)
|
||||
vim.keymap.set("n", "gh", vim.lsp.buf.hover)
|
||||
-- vim.keymap.set("n", "gr", telescope.lsp_references)
|
||||
vim.keymap.set("n", "<Leader>R", vim.lsp.buf.rename)
|
||||
vim.keymap.set("n", "]e", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "[e", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "<Leader>de", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "<Leader>E", vim.lsp.buf.code_action)
|
@ -51,46 +51,36 @@
|
||||
# };
|
||||
|
||||
lua = ''
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
||||
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation)
|
||||
vim.keymap.set("n", "gh", vim.lsp.buf.hover)
|
||||
-- vim.keymap.set("n", "gr", telescope.lsp_references)
|
||||
vim.keymap.set("n", "<Leader>R", vim.lsp.buf.rename)
|
||||
vim.keymap.set("n", "]e", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "[e", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "<Leader>de", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "<Leader>E", vim.lsp.buf.code_action)
|
||||
|
||||
${builtins.readFile ./lsp.lua}
|
||||
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require('null-ls').builtins.formatting.stylua.with({ command = "${pkgs.stylua}/bin/stylua" }),
|
||||
require('null-ls').builtins.formatting.black.with({ command = "${pkgs.black}/bin/black" }),
|
||||
require('null-ls').builtins.diagnostics.flake8.with({ command = "${pkgs.python310Packages.flake8}/bin/flake8" }),
|
||||
require('null-ls').builtins.formatting.fish_indent.with({ command = "${pkgs.fish}/bin/fish_indent" }),
|
||||
require('null-ls').builtins.formatting.nixfmt.with({ command = "${pkgs.nixfmt}/bin/nixfmt" }),
|
||||
require('null-ls').builtins.formatting.rustfmt.with({ command = "${pkgs.rustfmt}/bin/rustfmt" }),
|
||||
require('null-ls').builtins.diagnostics.shellcheck.with({ command = "${pkgs.shellcheck}/bin/shellcheck" }),
|
||||
require('null-ls').builtins.formatting.shfmt.with({
|
||||
require("null-ls").builtins.formatting.stylua.with({ command = "${pkgs.stylua}/bin/stylua" }),
|
||||
require("null-ls").builtins.formatting.black.with({ command = "${pkgs.black}/bin/black" }),
|
||||
require("null-ls").builtins.diagnostics.flake8.with({ command = "${pkgs.python310Packages.flake8}/bin/flake8" }),
|
||||
require("null-ls").builtins.formatting.fish_indent.with({ command = "${pkgs.fish}/bin/fish_indent" }),
|
||||
require("null-ls").builtins.formatting.nixfmt.with({ command = "${pkgs.nixfmt}/bin/nixfmt" }),
|
||||
require("null-ls").builtins.formatting.rustfmt.with({ command = "${pkgs.rustfmt}/bin/rustfmt" }),
|
||||
require("null-ls").builtins.diagnostics.shellcheck.with({ command = "${pkgs.shellcheck}/bin/shellcheck" }),
|
||||
require("null-ls").builtins.formatting.shfmt.with({
|
||||
command = "${pkgs.shfmt}/bin/shfmt",
|
||||
extra_args = { '-i', '4', '-ci' },
|
||||
extra_args = { "-i", "4", "-ci" },
|
||||
}),
|
||||
require('null-ls').builtins.formatting.terraform_fmt.with({ command = "${pkgs.terraform}/bin/terraform" }),
|
||||
require("null-ls").builtins.formatting.terraform_fmt.with({ command = "${pkgs.terraform}/bin/terraform" }),
|
||||
},
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
'';
|
||||
|
||||
|
@ -6,9 +6,12 @@
|
||||
pkgs.vimPlugins.vim-repeat # Better repeat using .
|
||||
pkgs.vimPlugins.comment-nvim # Smart comment commands
|
||||
pkgs.vimPlugins.impatient-nvim # Faster load times
|
||||
pkgs.vimPlugins.glow-nvim # Markdown preview popup
|
||||
pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews
|
||||
];
|
||||
|
||||
setup.Comment = { };
|
||||
setup.colorizer = { };
|
||||
|
||||
vim.o.termguicolors = true; # Set to truecolor
|
||||
vim.o.hidden = true; # Don't unload buffers when leaving them
|
||||
|
69
modules/neovim/plugins/telescope.lua
Normal file
69
modules/neovim/plugins/telescope.lua
Normal file
@ -0,0 +1,69 @@
|
||||
local telescope = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<Leader>k", telescope.keymaps)
|
||||
vim.keymap.set("n", "<Leader>/", telescope.live_grep)
|
||||
vim.keymap.set("n", "<Leader>ff", telescope.find_files)
|
||||
vim.keymap.set("n", "<Leader>fp", telescope.git_files)
|
||||
vim.keymap.set("n", "<Leader>fw", telescope.grep_string)
|
||||
vim.keymap.set("n", "<Leader>b", telescope.buffers)
|
||||
vim.keymap.set("n", "<Leader>hh", telescope.help_tags)
|
||||
vim.keymap.set("n", "<Leader>fr", telescope.oldfiles)
|
||||
vim.keymap.set("n", "<Leader>cc", telescope.commands)
|
||||
vim.keymap.set("n", "<Leader>gc", telescope.git_commits)
|
||||
vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
|
||||
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
|
||||
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
|
||||
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
|
||||
|
||||
vim.keymap.set("n", "<Leader>N", function()
|
||||
local opts = {
|
||||
prompt_title = "Search Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.live_grep(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>fN", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.find_files(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>cr", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 15,
|
||||
},
|
||||
},
|
||||
})
|
||||
telescope.command_history(opts)
|
||||
end)
|
||||
|
||||
-- Zoxide
|
||||
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
|
||||
|
||||
-- Project
|
||||
require("telescope").load_extension("project")
|
||||
vim.keymap.set("n", "<C-p>", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 10,
|
||||
},
|
||||
},
|
||||
})
|
||||
require("telescope").extensions.project.project(opts)
|
||||
end)
|
||||
|
||||
-- File browser
|
||||
require("telescope").load_extension("file_browser")
|
||||
vim.keymap.set("n", "<Leader>fa", require("telescope").extensions.file_browser.file_browser)
|
||||
vim.keymap.set("n", "<Leader>fD", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Downloads",
|
||||
cwd = "~/downloads",
|
||||
}
|
||||
require("telescope").extensions.file_browser.file_browser(opts)
|
||||
end)
|
@ -29,76 +29,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
lua = ''
|
||||
local telescope = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<Leader>k", telescope.keymaps)
|
||||
vim.keymap.set("n", "<Leader>/", telescope.live_grep)
|
||||
vim.keymap.set("n", "<Leader>ff", telescope.find_files)
|
||||
vim.keymap.set("n", "<Leader>fp", telescope.git_files)
|
||||
vim.keymap.set("n", "<Leader>fw", telescope.grep_string)
|
||||
vim.keymap.set("n", "<Leader>b", telescope.buffers)
|
||||
vim.keymap.set("n", "<Leader>hh", telescope.help_tags)
|
||||
vim.keymap.set("n", "<Leader>fr", telescope.oldfiles)
|
||||
vim.keymap.set("n", "<Leader>cc", telescope.commands)
|
||||
vim.keymap.set("n", "<Leader>gc", telescope.git_commits)
|
||||
vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
|
||||
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
|
||||
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
|
||||
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
|
||||
|
||||
vim.keymap.set("n", "<Leader>N", function()
|
||||
local opts = {
|
||||
prompt_title = "Search Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.live_grep(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>fN", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.find_files(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>cr", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 15,
|
||||
},
|
||||
},
|
||||
})
|
||||
telescope.command_history(opts)
|
||||
end)
|
||||
|
||||
-- zoxide
|
||||
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
|
||||
|
||||
-- project
|
||||
require("telescope").load_extension("project")
|
||||
vim.keymap.set("n", "<C-p>", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 10,
|
||||
},
|
||||
},
|
||||
})
|
||||
require("telescope").extensions.project.project(opts)
|
||||
end)
|
||||
|
||||
-- file browser
|
||||
require("telescope").load_extension("file_browser")
|
||||
vim.keymap.set("n", "<Leader>fa", require("telescope").extensions.file_browser.file_browser)
|
||||
vim.keymap.set("n", "<Leader>fD", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Downloads",
|
||||
cwd = "~/downloads",
|
||||
}
|
||||
require("telescope").extensions.file_browser.file_browser(opts)
|
||||
end)
|
||||
'';
|
||||
lua = builtins.readFile ./telescope.lua;
|
||||
|
||||
}
|
||||
|
75
modules/neovim/plugins/tree.nix
Normal file
75
modules/neovim/plugins/tree.nix
Normal file
@ -0,0 +1,75 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ];
|
||||
|
||||
# Disable netrw eagerly
|
||||
# https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
|
||||
vim.g.loaded = 1;
|
||||
vim.g.loaded_netrwPlugin = 1;
|
||||
|
||||
setup.nvim-tree = {
|
||||
disable_netrw = true;
|
||||
hijack_netrw = true;
|
||||
update_focused_file = {
|
||||
enable = true;
|
||||
update_cwd = true;
|
||||
ignore_list = { };
|
||||
};
|
||||
diagnostics = {
|
||||
enable = true;
|
||||
icons = {
|
||||
hint = "";
|
||||
info = "";
|
||||
warning = "";
|
||||
error = "";
|
||||
};
|
||||
};
|
||||
renderer = {
|
||||
icons = {
|
||||
glyphs = {
|
||||
git = {
|
||||
unstaged = "~";
|
||||
staged = "+";
|
||||
unmerged = "";
|
||||
renamed = "➜";
|
||||
deleted = "";
|
||||
untracked = "?";
|
||||
ignored = "◌";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
view = {
|
||||
width = 30;
|
||||
hide_root_folder = false;
|
||||
side = "left";
|
||||
mappings = {
|
||||
custom_only = false;
|
||||
list = [
|
||||
{
|
||||
key = [ "l" "<CR>" "o" ];
|
||||
cb = dsl.rawLua
|
||||
"require('nvim-tree.config').nvim_tree_callback('edit')";
|
||||
}
|
||||
{
|
||||
key = "h";
|
||||
cb = dsl.rawLua
|
||||
"require('nvim-tree.config').nvim_tree_callback('close_node')";
|
||||
}
|
||||
{
|
||||
key = "v";
|
||||
cb = dsl.rawLua
|
||||
"require('nvim-tree.config').nvim_tree_callback('vsplit')";
|
||||
}
|
||||
];
|
||||
};
|
||||
number = false;
|
||||
relativenumber = false;
|
||||
};
|
||||
};
|
||||
|
||||
lua = ''
|
||||
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
|
||||
'';
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user