This commit is contained in:
megit 2024-03-28 02:03:42 +08:00
commit f22207f3e2
16 changed files with 988 additions and 0 deletions

View file

@ -0,0 +1,7 @@
{
plugins = {
bufferline = {
enable = true;
};
};
}

View file

@ -0,0 +1,7 @@
{
plugins = {
comment = {
enable = true;
};
};
}

View file

@ -0,0 +1,7 @@
{
plugins = {
indent-blankline = {
enable = true;
};
};
}

27
config/plugins/leap.nix Normal file
View file

@ -0,0 +1,27 @@
{
plugins.leap = {
enable = true;
};
keymaps = [
{
mode = [ "n" "x" "o" ];
key = "<leader>ss";
action = "function() require('leap').leap { } end";
}
{
mode = [ "n" "x" "o" ];
key = "<leader>sS";
action = "<Plug>(leap-backward-to)";
}
{
mode = [ "n" "x" "o" ];
key = "<leader>sx";
action = "<Plug>(leap-forward-till)";
}
{
mode = [ "n" "x" "o" ];
key = "<leader>sX";
action = "<Plug>(leap-backward-till)";
}
];
}

View file

@ -0,0 +1,16 @@
{
lsp = {
enable = true;
servers = {
tsserver.enable = true;
lua-ls.enable = true;
rust-analyzer = {
enable = true;
installCargo = true;
installRustc = true;
};
};
};
}

168
config/plugins/lsp/lsp.nix Normal file
View file

@ -0,0 +1,168 @@
{
plugins = {
lsp-format = {
enable = false; # Enable it if you want lsp-format integration for none-ls
};
lsp = {
enable = true;
capabilities = "offsetEncoding = 'utf-16'";
servers = {
clangd = {enable = true;};
lua-ls = {
enable = true;
extraOptions = {
settings = {
Lua = {
completion = {
callSnippet = "Replace";
};
telemetry = {
enabled = false;
};
hint = {enable = true;};
};
};
};
};
nil_ls = {enable = true;};
tsserver = {
enable = false;
filetypes = ["javascript" "javascriptreact" "typescript" "typescriptreact"];
extraOptions = {
settings = {
javascript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
typescript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
};
};
};
eslint = {enable = true;};
pyright = {enable = true;};
ruff-lsp = {enable = true;};
texlab = {enable = true;};
rust-analyzer = {
enable = true;
installCargo = true;
installRustc = true;
settings = {
checkOnSave = true;
check = {
command = "clippy";
};
# inlayHints = {
# enable = true;
# showParameterNames = true;
# parameterHintsPrefix = "<- ";
# otherHintsPrefix = "=> ";
# };
procMacro = {
enable = true;
};
};
};
};
# keymaps = {
# silent = true;
# lspBuf = {
# gd = {
# action = "definition";
# desc = "Goto Definition";
# };
# gr = {
# action = "references";
# desc = "Goto References";
# };
# gD = {
# action = "declaration";
# desc = "Goto Declaration";
# };
# gI = {
# action = "implementation";
# desc = "Goto Implementation";
# };
# gT = {
# action = "type_definition";
# desc = "Type Definition";
# };
# K = {
# action = "hover";
# desc = "Hover";
# };
# "<leader>cw" = {
# action = "workspace_symbol";
# desc = "Workspace Symbol";
# };
# "<leader>cr" = {
# action = "rename";
# desc = "Rename";
# };
# "<leader>ca" = {
# action = "code_action";
# desc = "Code Action";
# };
# "<C-k>" = {
# action = "signature_help";
# desc = "Signature Help";
# };
# };
# diagnostic = {
# "<leader>cd" = {
# action = "open_float";
# desc = "Line Diagnostics";
# };
# "[d" = {
# action = "goto_next";
# desc = "Next Diagnostic";
# };
# "]d" = {
# action = "goto_prev";
# desc = "Previous Diagnostic";
# };
# };
# };
};
};
extraConfigLua = ''
local _border = "rounded"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = _border
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = _border
}
)
vim.diagnostic.config{
float={border=_border}
};
require('lspconfig.ui.windows').default_options = {
border = _border
}
'';
}

View file

@ -0,0 +1,7 @@
{
plugins = {
lualine = {
enable = true;
};
};
}

View file

@ -0,0 +1,7 @@
{
plugins = {
nvim-tree = {
enable = true;
};
};
}

View file

@ -0,0 +1,190 @@
{
plugins.telescope = {
enable = true;
extensions = {
fzf-native = {
enable = true;
};
# project-nvim = {
# enable = true;
# };
# ui-select = {
# settings = {
# specific_opts = {
# codeactions = true;
# };
# };
# };
undo = {
enable = true;
mappings = {
i = {
"<cr>" = "yank_additions";
"<s-cr>" = "yank_deletions";
"<c-cr>" = "restore";
};
n = {
"y" = "yank_additions";
"Y" = "yank_deletions";
"u" = "restore";
};
};
};
};
# If you'd prefer Telescope not to enter a normal-like mode when hitting escape (and instead exiting), you can map <Esc> to do so via:
defaults = {
mappings = {
i = {
"<esc>" = {
__raw = ''
function(...)
return require("telescope.actions").close(...)
end'';
};
};
};
};
keymaps = {
"<leader><space>" = {
action = "find_files, {}";
desc = "Find project files";
};
"<leader>/" = {
action = "live_grep";
desc = "Grep (root dir)";
};
"<leader>:" = {
action = "command_history, {}";
desc = "Command History";
};
"<leader>b" = {
action = "buffers, {}";
desc = "+buffer";
};
"<leader>ff" = {
action = "find_files, {}";
desc = "Find project files";
};
"<leader>fr" = {
action = "oldfiles, {}";
desc = "Recent";
};
"<leader>fb" = {
action = "buffers, {}";
desc = "Buffers";
};
"<C-p>" = {
action = "git_files, {}";
desc = "Search git files";
};
"<leader>gc" = {
action = "git_commits, {}";
desc = "Commits";
};
"<leader>gs" = {
action = "git_status, {}";
desc = "Status";
};
"<leader>sa" = {
action = "autocommands, {}";
desc = "Auto Commands";
};
"<leader>sb" = {
action = "current_buffer_fuzzy_find, {}";
desc = "Buffer";
};
"<leader>sc" = {
action = "command_history, {}";
desc = "Command History";
};
"<leader>sC" = {
action = "commands, {}";
desc = "Commands";
};
"<leader>sD" = {
action = "diagnostics, {}";
desc = "Workspace diagnostics";
};
"<leader>sh" = {
action = "help_tags, {}";
desc = "Help pages";
};
"<leader>sH" = {
action = "highlights, {}";
desc = "Search Highlight Groups";
};
"<leader>sk" = {
action = "keymaps, {}";
desc = "Keymaps";
};
"<leader>sM" = {
action = "man_pages, {}";
desc = "Man pages";
};
"<leader>sm" = {
action = "marks, {}";
desc = "Jump to Mark";
};
"<leader>so" = {
action = "vim_options, {}";
desc = "Options";
};
"<leader>sR" = {
action = "resume, {}";
desc = "Resume";
};
"<leader>uC" = {
action = "colorscheme, {}";
desc = "Colorscheme preview";
};
};
};
keymaps = [
{
mode = "n";
key = "<leader>fp";
action = "<cmd>Telescope projects<CR>";
options = {
desc = "Projects";
};
}
{
mode = "n";
key = "<leader>sd";
action = "<cmd>Telescope diagnostics bufnr=0<cr>";
options = {
desc = "Document diagnostics";
};
}
{
mode = "n";
key = "<leader>st";
action = "<cmd>TodoTelescope<cr>";
options = {
silent = true;
desc = "Todo (Telescope)";
};
}
# {
# mode = "n";
# key = "<leader>,";
# action = "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>";
# options = {
# desc = "Switch Buffer";
# };
# }
];
extraConfigLua = ''
local telescope = require('telescope')
telescope.setup{
pickers = {
colorscheme = {
enable_preview = true
}
}
}
'';
}