Initial Commit
This commit is contained in:
commit
18da9560c6
31 changed files with 769 additions and 0 deletions
3
.editorconfig
Normal file
3
.editorconfig
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[*.lua]
|
||||||
|
indent_style=space
|
||||||
|
indent_size=2
|
||||||
8
.gitignore
vendored
Executable file
8
.gitignore
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
tt.*
|
||||||
|
.tests
|
||||||
|
doc/tags
|
||||||
|
debug
|
||||||
|
.repro
|
||||||
|
foo.*
|
||||||
|
*.log
|
||||||
|
data
|
||||||
15
.neoconf.json
Executable file
15
.neoconf.json
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"neodev": {
|
||||||
|
"library": {
|
||||||
|
"enabled": true,
|
||||||
|
"plugins": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"neoconf": {
|
||||||
|
"plugins": {
|
||||||
|
"lua_ls": {
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
ftplugin/java.lua
Normal file
11
ftplugin/java.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
require 'jdtls'.start_or_attach {
|
||||||
|
cmd = {
|
||||||
|
'jdtls',
|
||||||
|
('--jvm-arg=-javaagent:%s'):format(vim.fn.expand '$HOME/.bin/agents/lombok.jar')
|
||||||
|
},
|
||||||
|
handlers = {
|
||||||
|
--["language/status"] = function(_, _) end,
|
||||||
|
["$/progress"] = function() end,
|
||||||
|
},
|
||||||
|
capabilities = nil, --require 'cmp_nvim_lsp'.default_capabilities()
|
||||||
|
}
|
||||||
1
init.lua
Normal file
1
init.lua
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
require("config.lazy")
|
||||||
26
lazy-lock.json
Normal file
26
lazy-lock.json
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" },
|
||||||
|
"conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" },
|
||||||
|
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||||
|
"fzf-lua": { "branch": "main", "commit": "fd6588ee052e150eb61f578fa8c40648def5b334" },
|
||||||
|
"kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" },
|
||||||
|
"mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
||||||
|
"mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" },
|
||||||
|
"mini.misc": { "branch": "main", "commit": "02de0d3fa53fcad1bee6c770b92a485769143155" },
|
||||||
|
"mini.statusline": { "branch": "main", "commit": "452d27d764720cddcb9909b786598bb9e80c1ce8" },
|
||||||
|
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||||
|
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||||
|
"nvim-jdtls": { "branch": "master", "commit": "4d77ff02063cf88963d5cf10683ab1fd15d072de" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "5e0e9c00d51fcb7efef0d4c49023f9593b38661e" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" },
|
||||||
|
"oil.nvim": { "branch": "master", "commit": "08c2bce8b00fd780fb7999dbffdf7cd174e896fb" },
|
||||||
|
"showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" },
|
||||||
|
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||||
|
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||||
|
}
|
||||||
9
lua/config/keymaps.lua
Normal file
9
lua/config/keymaps.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
vim.keymap.set("n", "-", "<CMD>Oil --float<CR>", { desc = "Open parent directory" })
|
||||||
|
vim.keymap.set("n", "gl", function()
|
||||||
|
vim.diagnostic.open_float()
|
||||||
|
end, { desc = "Open Diagnostics in Float" })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<M-BS>", "<CMD>e#<CR>", { desc = "Previous file" })
|
||||||
|
|
||||||
|
require("config.maps.maven")
|
||||||
|
require("config.maps.cpp")
|
||||||
39
lua/config/lazy.lua
Normal file
39
lua/config/lazy.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
-- Bootstrap lazy.nvim
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||||
|
-- loading lazy.nvim so that mappings are correct.
|
||||||
|
-- This is also a good place to setup other settings (vim.opt)
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = "\\"
|
||||||
|
|
||||||
|
require("config.options")
|
||||||
|
|
||||||
|
-- Setup lazy.nvim
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
-- import your plugins
|
||||||
|
{ import = "plugins" },
|
||||||
|
},
|
||||||
|
-- Configure any other settings here. See the documentation for more details.
|
||||||
|
-- colorscheme that will be used when installing plugins.
|
||||||
|
install = { colorscheme = { "kanagawa_wave" } },
|
||||||
|
-- automatically check for plugin updates
|
||||||
|
checker = { enabled = true, notify = false },
|
||||||
|
})
|
||||||
|
|
||||||
|
require("config.keymaps")
|
||||||
37
lua/config/maps/cpp.lua
Normal file
37
lua/config/maps/cpp.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
local function is_cpp_project()
|
||||||
|
local uv = vim.loop
|
||||||
|
local dir = uv.fs_realpath(vim.fn.expand("%:p:h"))
|
||||||
|
while dir do
|
||||||
|
if uv.fs_stat(dir .. "/vcpkg.json") then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
local parent_dir = uv.fs_realpath(dir .. "/..")
|
||||||
|
if parent_dir == dir then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
dir = parent_dir
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create autocommand on FileType java or whatever filetype you want
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "cppm", "h", "cpp", "CMakeLists.txt" },
|
||||||
|
callback = function()
|
||||||
|
if is_cpp_project() then
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<leader><F5>",
|
||||||
|
"<CMD>! mkdir -p build && cd build && CC=/usr/bin/clang && CXX=/usr/bin/clang++ && cmake .. -G Ninja && cmake --build . --target copy-compile-commands && cd ..<CR>",
|
||||||
|
{ desc = "CMake Create" }
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader><F6>", "<CMD>! cd build && cmake --build .<CR>", { desc = "Build Project" })
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<leader><F8>",
|
||||||
|
"<CMD>! cd build && cmake --build . --target run<CR>",
|
||||||
|
{ desc = "Run Project" }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
27
lua/config/maps/maven.lua
Normal file
27
lua/config/maps/maven.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
-- Function to check if pom.xml exists in current or parent directories
|
||||||
|
local function is_maven_project()
|
||||||
|
local uv = vim.loop
|
||||||
|
local dir = uv.fs_realpath(vim.fn.expand("%:p:h"))
|
||||||
|
while dir do
|
||||||
|
if uv.fs_stat(dir .. "/pom.xml") then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
local parent_dir = uv.fs_realpath(dir .. "/..")
|
||||||
|
if parent_dir == dir then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
dir = parent_dir
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create autocommand on FileType java or whatever filetype you want
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "java",
|
||||||
|
callback = function()
|
||||||
|
if is_maven_project() then
|
||||||
|
vim.keymap.set("n", "<leader><F5>", "<CMD>! mvn clean install -DskipTests<CR>", { desc = "Build Java" })
|
||||||
|
vim.keymap.set("n", "<leader><F7>", "<CMD>! mvn spotless:apply<CR>", { desc = "Format Java" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
42
lua/config/options.lua
Normal file
42
lua/config/options.lua
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
vim.g.have_nerd_font = true
|
||||||
|
|
||||||
|
vim.opt.langmap = "+]ü["
|
||||||
|
vim.keymap.set("n", "ü", "[", { remap = true })
|
||||||
|
|
||||||
|
vim.opt.expandtab = true -- Convert tabs to spaces
|
||||||
|
vim.opt.shiftwidth = 4 -- Amount to indent with << and >>
|
||||||
|
vim.opt.tabstop = 4 -- How many spaces are shown per Tab
|
||||||
|
vim.opt.softtabstop = 4 -- How many spaces are applied when pressing Tab
|
||||||
|
|
||||||
|
vim.opt.smarttab = true
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
vim.opt.autoindent = true -- Keep identation from previous line
|
||||||
|
|
||||||
|
vim.opt.breakindent = true
|
||||||
|
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
|
||||||
|
vim.opt.undofile = true
|
||||||
|
|
||||||
|
vim.opt.mouse = "a"
|
||||||
|
|
||||||
|
vim.opt.showmode = false
|
||||||
|
|
||||||
|
vim.opt.ignorecase = true
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
|
vim.opt.signcolumn = "yes"
|
||||||
|
|
||||||
|
vim.opt.splitright = true
|
||||||
|
vim.opt.splitbelow = true
|
||||||
|
|
||||||
|
vim.opt.list = true
|
||||||
|
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||||
|
|
||||||
|
vim.opt.scrolloff = 5
|
||||||
|
|
||||||
|
vim.opt.cmdheight = 0
|
||||||
|
vim.opt.clipboard = "unnamedplus"
|
||||||
6
lua/lsp/clangd.lua
Normal file
6
lua/lsp/clangd.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
cmd = {
|
||||||
|
"clangd",
|
||||||
|
"-experimental-modules-support",
|
||||||
|
},
|
||||||
|
}
|
||||||
5
lua/lsp/init.lua
Normal file
5
lua/lsp/init.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
return {
|
||||||
|
lua_ls = require("lsp.lua"),
|
||||||
|
jdtls = require("lsp.java"),
|
||||||
|
clangd = require("lsp.clangd"),
|
||||||
|
}
|
||||||
2
lua/lsp/java.lua
Normal file
2
lua/lsp/java.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
return {
|
||||||
|
}
|
||||||
7
lua/lsp/lua.lua
Normal file
7
lua/lsp/lua.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim", "describe", "it", "before_each", "after_each", "packer_plugins", "MiniTest", "Snacks" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
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)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
25
readme.md
Normal file
25
readme.md
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# My nvim config
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
fzf
|
||||||
|
|
||||||
|
|
||||||
|
## Plugins
|
||||||
|
|
||||||
|
- [ ] lazy.nvim
|
||||||
|
- [x] kanagawa.nvim
|
||||||
|
- [x] mini.statusline
|
||||||
|
- [x] oil.nvim
|
||||||
|
- [x] vim-sleuth
|
||||||
|
- [x] showkeys
|
||||||
|
- [x] treesitter
|
||||||
|
|
||||||
|
## Keymaps
|
||||||
|
|
||||||
|
### Normal
|
||||||
|
- `-` open OIL floating
|
||||||
|
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
- ShowkeysToggle
|
||||||
Loading…
Add table
Add a link
Reference in a new issue