Initial Commit
This commit is contained in:
commit
18da9560c6
31 changed files with 769 additions and 0 deletions
53
lua/plugins/blink-cmp.lua
Normal file
53
lua/plugins/blink-cmp.lua
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
return {
|
||||
"saghen/blink.cmp",
|
||||
-- optional: provides snippets for the snippet source
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
|
||||
-- use a release tag to download pre-built binaries
|
||||
version = "1.*",
|
||||
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||
-- build = 'cargo build --release',
|
||||
-- If you use nix, you can build from source using latest nightly rust with:
|
||||
-- build = 'nix run .#build-plugin',
|
||||
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||
-- 'enter' for enter to accept
|
||||
-- 'none' for no mappings
|
||||
--
|
||||
-- All presets have the following mappings:
|
||||
-- C-space: Open menu or open docs if already open
|
||||
-- C-n/C-p or Up/Down: Select next/previous item
|
||||
-- C-e: Hide menu
|
||||
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||
--
|
||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||
keymap = { preset = "default" },
|
||||
|
||||
appearance = {
|
||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||
-- Adjusts spacing to ensure icons are aligned
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
|
||||
-- (Default) Only show the documentation popup when manually triggered
|
||||
completion = { documentation = { auto_show = false } },
|
||||
|
||||
-- Default list of enabled providers defined so that you can extend it
|
||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "buffer" },
|
||||
},
|
||||
|
||||
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||
--
|
||||
-- See the fuzzy documentation for more information
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||
},
|
||||
opts_extend = { "sources.default" },
|
||||
}
|
||||
20
lua/plugins/conform.lua
Normal file
20
lua/plugins/conform.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
},
|
||||
formatters_by_ft = {
|
||||
javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
rust = { "rustfmt", lsp_format = "fallback" },
|
||||
java = { "spotless", "google-java-format" },
|
||||
lua = { "stylua" },
|
||||
cpp = { "clang-format" },
|
||||
},
|
||||
formatters = {
|
||||
spotless = {
|
||||
command = "mvn spotless:apply",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
92
lua/plugins/fzflua.lua
Normal file
92
lua/plugins/fzflua.lua
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
return {
|
||||
"ibhagwan/fzf-lua",
|
||||
dependencies = { "echasnovski/mini.icons" },
|
||||
opts = {},
|
||||
keys = {
|
||||
{
|
||||
"<leader>ff",
|
||||
function() require('fzf-lua').files() end,
|
||||
desc = "Find Files in project directory"
|
||||
},
|
||||
{
|
||||
"<leader>fg",
|
||||
function() require('fzf-lua').live_grep() end,
|
||||
desc = "Find by grepping in project directory"
|
||||
},
|
||||
{
|
||||
"<leader>fc",
|
||||
function() require('fzf-lua').files({ cwd = vim.fn.stdpath("config") }) end,
|
||||
desc = "Find in neovim configuration"
|
||||
},
|
||||
{
|
||||
"<leader>fh",
|
||||
function()
|
||||
require("fzf-lua").helptags()
|
||||
end,
|
||||
desc = "[F]ind [H]elp",
|
||||
},
|
||||
{
|
||||
"<leader>fk",
|
||||
function()
|
||||
require("fzf-lua").keymaps()
|
||||
end,
|
||||
desc = "[F]ind [K]eymaps",
|
||||
},
|
||||
{
|
||||
"<leader>fb",
|
||||
function()
|
||||
require("fzf-lua").builtin()
|
||||
end,
|
||||
desc = "[F]ind [B]uiltin FZF",
|
||||
},
|
||||
{
|
||||
"<leader>fw",
|
||||
function()
|
||||
require("fzf-lua").grep_cword()
|
||||
end,
|
||||
desc = "[F]ind current [W]ord",
|
||||
},
|
||||
{
|
||||
"<leader>fW",
|
||||
function()
|
||||
require("fzf-lua").grep_cWORD()
|
||||
end,
|
||||
desc = "[F]ind current [W]ORD",
|
||||
},
|
||||
{
|
||||
"<leader>fd",
|
||||
function()
|
||||
require("fzf-lua").diagnostics_document()
|
||||
end,
|
||||
desc = "[F]ind [D]iagnostics",
|
||||
},
|
||||
{
|
||||
"<leader>fr",
|
||||
function()
|
||||
require("fzf-lua").resume()
|
||||
end,
|
||||
desc = "[F]ind [R]esume",
|
||||
},
|
||||
{
|
||||
"<leader>fo",
|
||||
function()
|
||||
require("fzf-lua").oldfiles()
|
||||
end,
|
||||
desc = "[F]ind [O]ld Files",
|
||||
},
|
||||
{
|
||||
"<leader><leader>",
|
||||
function()
|
||||
require("fzf-lua").buffers()
|
||||
end,
|
||||
desc = "[<leader>] Find existing buffers",
|
||||
},
|
||||
{
|
||||
"<leader>/",
|
||||
function()
|
||||
require("fzf-lua").lgrep_curbuf()
|
||||
end,
|
||||
desc = "[/] Live grep the current buffer",
|
||||
},
|
||||
}
|
||||
}
|
||||
124
lua/plugins/lsp.lua
Normal file
124
lua/plugins/lsp.lua
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
return {
|
||||
-- Main LSP Configuration
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||
-- Mason must be loaded before its dependents so we need to set it up here.
|
||||
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
||||
{ "williamboman/mason.nvim", opts = {} },
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
|
||||
-- Useful status updates for LSP.
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or "n"
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
||||
end
|
||||
map("gd", require("fzf-lua").lsp_definitions, "[G]oto [D]efinition")
|
||||
map("gr", require("fzf-lua").lsp_references, "[G]oto [R]eferences")
|
||||
map("gI", require("fzf-lua").lsp_implementations, "[G]oto [I]mplementation")
|
||||
map("<leader>D", require("fzf-lua").lsp_typedefs, "Type [D]efinition")
|
||||
map("<leader>ds", require("fzf-lua").lsp_document_symbols, "[D]ocument [S]ymbols")
|
||||
map("<leader>ws", require("fzf-lua").lsp_live_workspace_symbols, "[W]orkspace [S]ymbols")
|
||||
map("<leader>cr", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction", { "n", "x" })
|
||||
map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
---@param client vim.lsp.Client
|
||||
---@param method vim.lsp.protocol.Method
|
||||
---@param bufnr? integer some lsp support methods only in specific files
|
||||
---@return boolean
|
||||
local function client_supports_method(client, method, bufnr)
|
||||
if vim.fn.has("nvim-0.11") == 1 then
|
||||
return client:supports_method(method, bufnr)
|
||||
else
|
||||
return client.supports_method(method, { bufnr = bufnr })
|
||||
end
|
||||
end
|
||||
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if
|
||||
client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf)
|
||||
then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false })
|
||||
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspDetach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }),
|
||||
callback = function(event2)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf })
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
||||
map("<leader>th", function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
|
||||
end, "[T]oggle Inlay [H]ints")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Diagnostic Config
|
||||
-- See :help vim.diagnostic.Opts
|
||||
vim.diagnostic.config({
|
||||
severity_sort = true,
|
||||
float = { border = "rounded", source = "if_many" },
|
||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = " ",
|
||||
[vim.diagnostic.severity.WARN] = " ",
|
||||
[vim.diagnostic.severity.INFO] = " ",
|
||||
[vim.diagnostic.severity.HINT] = " ",
|
||||
},
|
||||
},
|
||||
virtual_text = {
|
||||
source = "if_many",
|
||||
spacing = 2,
|
||||
format = function(diagnostic)
|
||||
local diagnostic_message = {
|
||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
||||
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
||||
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
||||
}
|
||||
return diagnostic_message[diagnostic.severity]
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
local servers = require("lsp")
|
||||
local ensure_installed = { "lua_ls" } --vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
"stylua", -- Used to format Lua code
|
||||
})
|
||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
||||
|
||||
for name, value in pairs(servers) do --pseudocode
|
||||
vim.lsp.config(name, value)
|
||||
end
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
||||
automatic_installation = false,
|
||||
})
|
||||
end,
|
||||
}
|
||||
16
lua/plugins/mini.lua
Normal file
16
lua/plugins/mini.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
{
|
||||
"echasnovski/mini.statusline",
|
||||
version = false,
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"echasnovski/mini.misc",
|
||||
version = false,
|
||||
config = function()
|
||||
local mini = require("mini.misc")
|
||||
mini.setup_termbg_sync()
|
||||
mini.setup_auto_root()
|
||||
end,
|
||||
},
|
||||
}
|
||||
15
lua/plugins/noice.lua
Normal file
15
lua/plugins/noice.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
cmdline = {},
|
||||
-- add any options here
|
||||
messages = {
|
||||
enabled = false,
|
||||
},
|
||||
notify = { enabled = false },
|
||||
},
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
}
|
||||
6
lua/plugins/nvim-jdtls.lua
Normal file
6
lua/plugins/nvim-jdtls.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
local java_filetypes = { 'java', 'kt' }
|
||||
|
||||
return {
|
||||
"mfussenegger/nvim-jdtls",
|
||||
ft = java_filetypes,
|
||||
}
|
||||
8
lua/plugins/oil.lua
Normal file
8
lua/plugins/oil.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
'stevearc/oil.nvim',
|
||||
---@module 'oil'
|
||||
---@type oil.SetupOpts
|
||||
opts = {},
|
||||
dependencies = { { "echasnovski/mini.icons", opts = {} } },
|
||||
lazy = false,
|
||||
}
|
||||
12
lua/plugins/showkeys.lua
Normal file
12
lua/plugins/showkeys.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
"nvzone/showkeys",
|
||||
cmd = "ShowkeysToggle",
|
||||
opts = {
|
||||
timeout = 1,
|
||||
maxkeys = 3,
|
||||
winopts = {
|
||||
height = 1
|
||||
},
|
||||
excluded_modes = { "i" }
|
||||
}
|
||||
}
|
||||
5
lua/plugins/sleuth-vim.lua
Normal file
5
lua/plugins/sleuth-vim.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"tpope/vim-sleuth",
|
||||
-- No further initialization needed, as this is a real "vim" not a lua
|
||||
-- plugin.
|
||||
}
|
||||
36
lua/plugins/snacks.lua
Normal file
36
lua/plugins/snacks.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
local header_string = [[
|
||||
__ __ ____ _____ _____
|
||||
\ \ /"/u / __"| u |_ " _| |"_ /u
|
||||
\ \ / // <\___ \/ | | U / //
|
||||
/\ V /_,-.u___) | /| |\ \/ /_
|
||||
U \_/-(_/ |____/>> u |_|U /____|
|
||||
// )( (__)_// \\_ _//<<,-
|
||||
(__) (__) (__) (__)(__) (_/ ]]
|
||||
|
||||
return {
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
opts = {
|
||||
dashboard = {
|
||||
enabled = true,
|
||||
preset = {
|
||||
header = header_string
|
||||
}
|
||||
},
|
||||
explorer = { enabled = true },
|
||||
input = { enabled = true },
|
||||
notifier = {
|
||||
enabled = true,
|
||||
timeout = 10000
|
||||
},
|
||||
lazygit = {
|
||||
enabled = true
|
||||
}
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>n", function() Snacks.picker.notifications() end, desc = "Notification History" },
|
||||
{ "<leader>e", function() Snacks.explorer() end, desc = "File Explorer" },
|
||||
{ "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" },
|
||||
}
|
||||
}
|
||||
36
lua/plugins/themes.lua
Normal file
36
lua/plugins/themes.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
return {
|
||||
"rebelot/kanagawa.nvim",
|
||||
config = function()
|
||||
require('kanagawa').setup({
|
||||
compile = true,
|
||||
transparent = true,
|
||||
colors = {
|
||||
theme = {
|
||||
all = {
|
||||
ui = {
|
||||
bg_gutter = "none",
|
||||
float = {
|
||||
bg = "none",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
overrides = function(colors)
|
||||
return {
|
||||
["@markup.link.url.markdown_inline"] = { link = "Special" }, -- (url)
|
||||
["@markup.link.label.markdown_inline"] = { link = "WarningMsg" }, -- [label]
|
||||
["@markup.italic.markdown_inline"] = { link = "Exception" }, -- *italic*
|
||||
["@markup.raw.markdown_inline"] = { link = "String" }, -- `code`
|
||||
["@markup.list.markdown"] = { link = "Function" }, -- + list
|
||||
["@markup.quote.markdown"] = { link = "Error" }, -- > blockcode
|
||||
["@markup.list.checked.markdown_inline"] = { link = "Error" } -- - [X] checked list item
|
||||
}
|
||||
end
|
||||
})
|
||||
vim.cmd("colorscheme kanagawa")
|
||||
end,
|
||||
build = function()
|
||||
vim.cmd("KanagawaCompile")
|
||||
end
|
||||
}
|
||||
40
lua/plugins/treesitter-textobjects.lua
Normal file
40
lua/plugins/treesitter-textobjects.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
init = function()
|
||||
local config = require 'nvim-treesitter.configs';
|
||||
config.setup({
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ao"] = "@comment.outer",
|
||||
["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" },
|
||||
["as"] = { query = "@local.scope", query_group = "locals", desc = "Select language scope" },
|
||||
},
|
||||
selection_modes = {
|
||||
['@parameter.outer'] = 'v', -- charwise
|
||||
['@function.outer'] = 'V', -- linewise
|
||||
['@class.outer'] = '<c-v>', -- blockwise
|
||||
},
|
||||
include_surrounding_whitespace = true,
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
["<leader>Ca"] = { query = "@parameter.inner", desc = "Swap with next parameter" },
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader>CA"] = "@parameter.inner",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
end
|
||||
}
|
||||
25
lua/plugins/treesitter.lua
Normal file
25
lua/plugins/treesitter.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
lazy = false,
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
|
||||
configs.setup({
|
||||
ensure_installed = { "lua", "markdown_inline" },
|
||||
auto_install = false,
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<Enter>", -- set to `false` to disable one of the mappings
|
||||
node_incremental = "<Enter>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<Backspace>",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
||||
18
lua/plugins/which-key.lua
Normal file
18
lua/plugins/which-key.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue