configurations for fish, nvim, tmux and starship
This commit is contained in:
111
nvim/.config/nvim/after/plugin/lualine.lua
Normal file
111
nvim/.config/nvim/after/plugin/lualine.lua
Normal file
@@ -0,0 +1,111 @@
|
||||
local lualine = require("lualine")
|
||||
|
||||
local colors = {
|
||||
aqua = "#89B482",
|
||||
green = "#A9B665",
|
||||
blue = "#7DAEA3",
|
||||
violet = "#D3869B",
|
||||
yellow = "#D8A657",
|
||||
red = "#Ea6962",
|
||||
cream = "#DDC7A1",
|
||||
bg1 = "#3C3836",
|
||||
bg2 = "#32302F",
|
||||
bg_dim = "#252423",
|
||||
}
|
||||
|
||||
local gruv_material = {
|
||||
normal = {
|
||||
a = { bg = colors.aqua, fg = colors.bg_dim, gui = "bold" },
|
||||
b = { bg = colors.bg1, fg = colors.cream, gui = "bold" },
|
||||
c = { bg = colors.bg2, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
insert = {
|
||||
a = { bg = colors.blue, fg = colors.bg_dim, gui = "bold" },
|
||||
c = { bg = colors.bg2, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
visual = {
|
||||
a = { bg = colors.violet, fg = colors.black, gui = "bold" },
|
||||
c = { bg = colors.bg2, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
command = {
|
||||
a = { bg = colors.aqua, fg = colors.black, gui = "bold" },
|
||||
c = { bg = colors.bg2, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
terminal = {
|
||||
a = { bg = colors.red, fg = colors.black, gui = "bold" },
|
||||
c = { bg = colors.bg2, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
replace = {
|
||||
a = { bg = colors.blue, fg = colors.black, gui = "bold" },
|
||||
c = { bg = colors.bg2, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
inactive = {
|
||||
a = { bg = colors.green, fg = colors.black, gui = "bold" },
|
||||
c = { bg = colors.bg_dim, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
}
|
||||
|
||||
lualine.setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = gruv_material,
|
||||
section_separators = "",
|
||||
component_separators = "", -- { left = "│", right = "│" },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
-- ignore_focus = {},
|
||||
-- always_divide_middle = true,
|
||||
globalstatus = true,
|
||||
always_show_tabline = true,
|
||||
refresh = {
|
||||
statusline = 100,
|
||||
tabline = 100,
|
||||
winbar = 100,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { { "mode", icon = "" } },
|
||||
lualine_b = {
|
||||
{
|
||||
"buffers",
|
||||
show_filename_only = true,
|
||||
show_modified_status = true,
|
||||
mode = 0,
|
||||
max_length = vim.o.columns * 2 / 3,
|
||||
filetype_names = {
|
||||
TelescopePrompt = "Telescope",
|
||||
dashboard = "Dashboard",
|
||||
packer = "Packer",
|
||||
fzf = "FZF",
|
||||
alpha = "Alpha",
|
||||
},
|
||||
buffers_color = {
|
||||
active = { bg = colors.yellow, fg = colors.bg_dim },
|
||||
inactive = { bg = colors.bg1, fg = colors.cream },
|
||||
},
|
||||
symbols = {
|
||||
alternate_file = "",
|
||||
directory = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
"filename",
|
||||
file_status = true,
|
||||
path = 3,
|
||||
shorting_target = 0,
|
||||
},
|
||||
},
|
||||
lualine_x = {},
|
||||
lualine_y = { "searchcount", "selectioncount", "encoding", "filetpe" },
|
||||
lualine_z = { "progress", "location" },
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
})
|
||||
vim.opt.laststatus = 3
|
81
nvim/.config/nvim/after/plugin/telescope.lua
Executable file
81
nvim/.config/nvim/after/plugin/telescope.lua
Executable file
@@ -0,0 +1,81 @@
|
||||
local telescope = require("telescope")
|
||||
local builtin = require("telescope.builtin")
|
||||
local actions = require("telescope.actions")
|
||||
local map = vim.keymap.set
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "flex",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
},
|
||||
},
|
||||
file_ignore_patterns = {
|
||||
"^%.git/",
|
||||
"^%.git$",
|
||||
".DS_Store",
|
||||
},
|
||||
mappings = {
|
||||
n = {
|
||||
["<C-c"] = actions.close,
|
||||
},
|
||||
i = {
|
||||
["<C-s>"] = "select_horizontal",
|
||||
},
|
||||
},
|
||||
border = true,
|
||||
borderchars = { " ", " ", " ", " ", " ", " ", " ", " " },
|
||||
color_devicons = true,
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
},
|
||||
live_grep = {
|
||||
additional_args = { "--hidden" },
|
||||
},
|
||||
buffers = {
|
||||
sort_mru = true,
|
||||
},
|
||||
oldfiles = {
|
||||
cwd_only = true,
|
||||
},
|
||||
lsp_document_symbol = {
|
||||
symbol_width = 40,
|
||||
},
|
||||
},
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case",
|
||||
},
|
||||
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
layout_config = {
|
||||
width = 100,
|
||||
height = 30,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_set_hl(0, "TelescopeNormal", { bg = "#3c3836" })
|
||||
vim.api.nvim_set_hl(0, "TelescopeBorder", { bg = "#3c3836", fg = "#3c3836" })
|
||||
vim.api.nvim_set_hl(0, "TelescopePromptNormal", { bg = "#3c3836" })
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
telescope.load_extension("ui-select")
|
||||
|
||||
map("n", "<C-p>", ":Telescope<CR>")
|
||||
map("n", "<leader>fb", builtin.buffers)
|
||||
map("n", "<leader>ff", builtin.find_files)
|
||||
map("n", "<leader>fg", builtin.live_grep)
|
||||
map("n", "<leader>f/", "<cmd>Telescope current_buffer_fuzzy_find fuzzy=false case_mode=smart_case<cr>")
|
||||
map("n", "<leader>fk", "<cmd>Telescope quickfix<cr>")
|
||||
map("n", "<leader>fd", "<cmd>Telescope diagnostics bufnr=0 sort_by=severity<cr>")
|
69
nvim/.config/nvim/after/plugin/treesitter.lua
Normal file
69
nvim/.config/nvim/after/plugin/treesitter.lua
Normal file
@@ -0,0 +1,69 @@
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"c",
|
||||
"javascript",
|
||||
"python",
|
||||
"lua",
|
||||
"vim",
|
||||
"markdown",
|
||||
},
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<leader>i",
|
||||
node_incremental = "<leader>i",
|
||||
scope_incremental = "<C-s>",
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
["a="] = "@assignment.outer",
|
||||
["i="] = "@assignment.inner",
|
||||
["al"] = "@loop.outer",
|
||||
["il"] = "@loop.inner",
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
["]f"] = "@function.outer",
|
||||
["]c"] = "@class.outer",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]F"] = "@function.outer",
|
||||
["]C"] = "@class.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[f"] = "@function.outer",
|
||||
["[c"] = "@class.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[F"] = "@function.outer",
|
||||
["[C"] = "@class.outer",
|
||||
},
|
||||
},
|
||||
},
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
1
nvim/.config/nvim/init.lua
Executable file
1
nvim/.config/nvim/init.lua
Executable file
@@ -0,0 +1 @@
|
||||
require('config')
|
35
nvim/.config/nvim/lazy-lock.json
Normal file
35
nvim/.config/nvim/lazy-lock.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
|
||||
"conform.nvim": { "branch": "master", "commit": "a4bb5d6c4ae6f32ab13114e62e70669fa67745b9" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gruvbox-material": { "branch": "master", "commit": "f5f912fbc7cf2d45da6928b792d554f85c7aa89a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "920b1253e1a26732e53fac78412f6da7f674671d" },
|
||||
"lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "75d60a8f928decd8b38897f80849768b7c540a5b" },
|
||||
"mason.nvim": { "branch": "main", "commit": "888d6ee499d8089a3a4be4309d239d6be1c1e6c0" },
|
||||
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
|
||||
"nui.nvim": { "branch": "main", "commit": "f535005e6ad1016383f24e39559833759453564e" },
|
||||
"nvim-dap": { "branch": "master", "commit": "8df427aeba0a06c6577dc3ab82de3076964e3b8d" },
|
||||
"nvim-java": { "branch": "main", "commit": "f92cadf7bdd01f5cfe383c8e725a283ffcc3685d" },
|
||||
"nvim-java-core": { "branch": "main", "commit": "401bf7683012a25929a359deec418f36beb876e2" },
|
||||
"nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" },
|
||||
"nvim-java-refactor": { "branch": "main", "commit": "b51a57d862338999059e1d1717df3bc80a3a15c0" },
|
||||
"nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "b0debd5c424969b4baeabdc8f54db3036c691732" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
||||
"oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }
|
||||
}
|
3
nvim/.config/nvim/lua/config.lua
Executable file
3
nvim/.config/nvim/lua/config.lua
Executable file
@@ -0,0 +1,3 @@
|
||||
require('core.options')
|
||||
require('core.keymaps')
|
||||
require('plugins.init')
|
63
nvim/.config/nvim/lua/core/keymaps.lua
Executable file
63
nvim/.config/nvim/lua/core/keymaps.lua
Executable file
@@ -0,0 +1,63 @@
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true, silent = true }
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
-- leader and localleader setup
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- jj for normal mode
|
||||
map({ "i", "v" }, "jj", "<Esc>", { desc = "return to normal mode" })
|
||||
|
||||
-- window navigation
|
||||
map("n", "<A-h>", "<C-w>h")
|
||||
map("n", "<A-j>", "<C-w>j")
|
||||
map("n", "<A-k>", "<C-w>k")
|
||||
map("n", "<A-l>", "<C-w>l")
|
||||
|
||||
-- buffer navigation
|
||||
map("n", "<S-l>", ":bnext<CR>")
|
||||
map("n", "<S-h>", ":bprevious<CR>")
|
||||
|
||||
-- clear highlights
|
||||
map("n", "<leader>h", ":nohlsearch<CR>")
|
||||
|
||||
-- indentations
|
||||
map("v", "<", "<gv")
|
||||
map("v", ">", ">gv")
|
||||
|
||||
-- move text up down
|
||||
map("v", "J", ":m '>+1<CR>gv=gv")
|
||||
map("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- cusor centered when jumping
|
||||
map("n", "n", "nzzzv")
|
||||
|
||||
-- save and quit
|
||||
map("n", "<leader>w", ":w<CR>", { desc = "save file" })
|
||||
map("n", "<leader>q", ":q<CR>", { desc = "quit window" })
|
||||
map("n", "<leader>Q", ":qa<CR>", { desc = "quit neovim" })
|
||||
map("n", "<leader>bd", ":bd<CR>", { desc = "close buffer" })
|
||||
-- map("n", "gf", ":lua OpenFile()<cr>", { desc = "Open or create file under cursor" })
|
||||
|
||||
-- others
|
||||
map("n", "<leader><leader>S", ":source %<CR>", { desc = "source buffer" })
|
||||
map("n", "j", "gj", { desc = "down in wrapped line" })
|
||||
map("n", "k", "gk", { desc = "up in wrapped line" })
|
||||
map("n", "<C-S-H>", "3<C-w>>", { desc = "Resize Left" })
|
||||
map("n", "<C-S-J>", "3<C-w>-", { desc = "Resize Right" })
|
||||
map("n", "<C-S-K>", "3<C-w>+", { desc = "Resize Up" })
|
||||
map("n", "<C-S-L>", "3<C-w><", { desc = "Resize Down" })
|
||||
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
vim.lsp.buf.format({
|
||||
async = true,
|
||||
filter = function(client)
|
||||
return client.name == "null-ls"
|
||||
end,
|
||||
})
|
||||
end, { desc = "Format with null-ls" })
|
17
nvim/.config/nvim/lua/core/options.lua
Executable file
17
nvim/.config/nvim/lua/core/options.lua
Executable file
@@ -0,0 +1,17 @@
|
||||
-- appearance
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.sidescrolloff = 8
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.cmdheight = 0
|
||||
vim.opt.pumheight = 10
|
||||
vim.opt.wrap = false
|
||||
|
||||
-- editing
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.smartindent = true
|
242
nvim/.config/nvim/lua/plugins/init.lua
Normal file
242
nvim/.config/nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,242 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- colorscheme
|
||||
{
|
||||
"sainnhe/gruvbox-material",
|
||||
priroty = 1000,
|
||||
config = function()
|
||||
vim.cmd([[colorscheme gruvbox-material]])
|
||||
end,
|
||||
},
|
||||
-- lualine
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
},
|
||||
-- telescope
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
},
|
||||
},
|
||||
-- treesitter
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
"windwp/nvim-ts-autotag",
|
||||
},
|
||||
},
|
||||
-- LSP
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
"saghen/blink.cmp",
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-java/nvim-java",
|
||||
},
|
||||
{ -- Autoformat
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_format = "fallback" })
|
||||
end,
|
||||
mode = "",
|
||||
desc = "[F]ormat buffer",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
return nil
|
||||
else
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
}
|
||||
end
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{ -- Autocompletion
|
||||
"saghen/blink.cmp",
|
||||
event = "VimEnter",
|
||||
version = "1.*",
|
||||
dependencies = {
|
||||
-- Snippet Engine
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "2.*",
|
||||
build = (function()
|
||||
-- Build Step is needed for regex support in snippets.
|
||||
-- This step is not supported in many windows environments.
|
||||
-- Remove the below condition to re-enable on windows.
|
||||
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
|
||||
return
|
||||
end
|
||||
return "make install_jsregexp"
|
||||
end)(),
|
||||
dependencies = {
|
||||
{
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
"folke/lazydev.nvim",
|
||||
},
|
||||
--- @module 'blink.cmp'
|
||||
--- @type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
-- 'default' (recommended) for mappings similar to built-in completions
|
||||
-- <c-y> to accept ([y]es) the completion.
|
||||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
-- 'super-tab' for tab to accept
|
||||
-- 'enter' for enter to accept
|
||||
-- 'none' for no mappings
|
||||
--
|
||||
-- For an understanding of why the 'default' preset is recommended,
|
||||
-- you will need to read `:help ins-completion`
|
||||
--
|
||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||
--
|
||||
-- All presets have the following mappings:
|
||||
-- <tab>/<s-tab>: move to right/left of your snippet expansion
|
||||
-- <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
|
||||
--
|
||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||
preset = "default",
|
||||
|
||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
},
|
||||
|
||||
appearance = {
|
||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||
-- Adjusts spacing to ensure icons are aligned
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
|
||||
completion = {
|
||||
-- By default, you may press `<c-space>` to show the documentation.
|
||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "lazydev" },
|
||||
providers = {
|
||||
lazydev = { module = "lazydev.integrations.blink", score_offset = 100 },
|
||||
},
|
||||
},
|
||||
|
||||
snippets = { preset = "luasnip" },
|
||||
|
||||
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
|
||||
-- which automatically downloads a prebuilt binary when enabled.
|
||||
--
|
||||
-- By default, we use the Lua implementation instead, but you may enable
|
||||
-- the rust implementation via `'prefer_rust_with_warning'`
|
||||
--
|
||||
-- See :h blink-cmp-config-fuzzy for more information
|
||||
fuzzy = { implementation = "lua" },
|
||||
|
||||
-- Shows a signature help window while you type arguments for a function
|
||||
signature = { enabled = true },
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvimdev/lspsaga.nvim",
|
||||
event = "LspAttach",
|
||||
config = function()
|
||||
require("lspsaga").setup({})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
---@module 'oil'
|
||||
---@type oil.SetupOpts
|
||||
opts = {},
|
||||
-- Optional dependencies
|
||||
dependencies = { { "echasnovski/mini.icons", opts = {} } },
|
||||
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons
|
||||
-- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations.
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("oil").setup({
|
||||
default_file_explorer = true,
|
||||
})
|
||||
vim.keymap.set("n", "-", "<cmd>Oil<CR>", { desc = "open parent directory" })
|
||||
end,
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
lazy = false,
|
||||
version = false,
|
||||
},
|
||||
checker = { enbaled = true },
|
||||
performance = {
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("plugins.lsp")
|
54
nvim/.config/nvim/lua/plugins/lsp.lua
Normal file
54
nvim/.config/nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("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("<leader>rn", "<cmd>Lspsaga rename<CR>", "rename")
|
||||
map("<leader>ca", "<cmd>Lspsaga code_action<CR>", "goto code action", { "n", "x" })
|
||||
map("gd", "<cmd>Lspsaga peek_definition<CR>", "goto definition")
|
||||
map("K", "<cmd>Lspsaga hover_doc<CR>", "hover doc")
|
||||
map("]d", "<cmd>Lspsaga diagnostic_jump_next<CR>", "diagnostic jump next")
|
||||
map("[d", "<cmd>Lspsaga diagnostic_jump_prev<CR>", "diagnostic jump prev")
|
||||
end,
|
||||
})
|
||||
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
|
||||
local servers = {
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ts_ls = {},
|
||||
}
|
||||
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, { "stylua", "prettier", "eslint" })
|
||||
|
||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {},
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
|
||||
if server_name == "jdtls" then
|
||||
require("java").setup()
|
||||
end
|
||||
require("lspconfig")[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user