Updated scripts
This commit is contained in:
parent
5a42f1357b
commit
251e601eb8
@ -73,9 +73,7 @@ local active_statusline = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local inactive_statusline = function()
|
local inactive_statusline = function()
|
||||||
return MiniStatusline.combine_groups({
|
return active_statusline()
|
||||||
{ hl = "MiniStatuslineDevinfo", strings = {} },
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
@ -93,20 +91,16 @@ vim.pack.add({
|
|||||||
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
||||||
{ src = "https://github.com/lewis6991/gitsigns.nvim" },
|
{ src = "https://github.com/lewis6991/gitsigns.nvim" },
|
||||||
{ src = "https://github.com/MunifTanjim/nui.nvim" },
|
{ src = "https://github.com/MunifTanjim/nui.nvim" },
|
||||||
-- { src = "https://github.com/folke/noice.nvim" },
|
|
||||||
{ src = "https://github.com/L3MON4D3/LuaSnip" },
|
{ src = "https://github.com/L3MON4D3/LuaSnip" },
|
||||||
{ src = "https://github.com/rafamadriz/friendly-snippets" },
|
{ src = "https://github.com/rafamadriz/friendly-snippets" },
|
||||||
{ src = "https://github.com/saghen/blink.cmp" },
|
{ src = "https://github.com/saghen/blink.cmp" },
|
||||||
{ src = "https://github.com/stevearc/conform.nvim" },
|
{ src = "https://github.com/stevearc/conform.nvim" },
|
||||||
{ src = "https://github.com/prichrd/netrw.nvim" },
|
|
||||||
{ src = "https://github.com/nvim-tree/nvim-tree.lua" },
|
{ src = "https://github.com/nvim-tree/nvim-tree.lua" },
|
||||||
})
|
})
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
-- Plugin config
|
-- Plugin config
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
-- require("noice").setup()
|
|
||||||
require("netrw").setup()
|
|
||||||
require("conform").setup({
|
require("conform").setup({
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
@ -183,13 +177,81 @@ require("blink.cmp").setup({
|
|||||||
},
|
},
|
||||||
fuzzy = { implementation = "lua" },
|
fuzzy = { implementation = "lua" },
|
||||||
})
|
})
|
||||||
require("nvim-tree").setup()
|
require("nvim-tree").setup({
|
||||||
|
view = {
|
||||||
|
-- Ensures files open in the window where nvim-tree was triggered
|
||||||
|
preserve_window_proportions = true,
|
||||||
|
},
|
||||||
|
update_focused_file = {
|
||||||
|
enable = true, -- update the tree to focus the current file
|
||||||
|
update_root = false, -- don't change the root dir automatically
|
||||||
|
ignore_list = {}, -- you can add filetypes to ignore (e.g. "help")
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
open_file = {
|
||||||
|
quit_on_open = true, -- auto-close tree when file is opened
|
||||||
|
resize_window = true,
|
||||||
|
window_picker = {
|
||||||
|
enable = false, -- disable asking which window to use
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
-- LSP config
|
-- LSP config
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
vim.lsp.enable({ "lua_ls", "rust_analyzer", "bashls", "pyright", "marksman", "clangd", "yamlls" })
|
vim.lsp.enable({ "lua_ls", "rust_analyzer", "bashls", "pyright", "marksman", "clangd", "yamlls" })
|
||||||
|
|
||||||
|
local Input = require("nui.input")
|
||||||
|
local event = require("nui.utils.autocmd").event
|
||||||
|
|
||||||
|
local function lsp_rename()
|
||||||
|
local curr_name = vim.fn.expand("<cword>")
|
||||||
|
|
||||||
|
local client = vim.lsp.get_clients({ bufnr = 0 })[1]
|
||||||
|
local offset_encoding = client and client.offset_encoding or "utf-16"
|
||||||
|
local pos_params = vim.lsp.util.make_position_params(0, offset_encoding)
|
||||||
|
|
||||||
|
local input = Input({
|
||||||
|
position = {
|
||||||
|
row = vim.fn.winline(),
|
||||||
|
col = vim.fn.wincol(),
|
||||||
|
},
|
||||||
|
size = #curr_name + 10,
|
||||||
|
border = {
|
||||||
|
style = "rounded",
|
||||||
|
text = { top = "Rename", top_align = "left" },
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
prompt = "",
|
||||||
|
default_value = curr_name,
|
||||||
|
on_submit = function(new_name)
|
||||||
|
if new_name and #new_name > 0 and new_name ~= curr_name then
|
||||||
|
local params = {
|
||||||
|
textDocument = pos_params.textDocument,
|
||||||
|
position = pos_params.position,
|
||||||
|
newName = new_name,
|
||||||
|
}
|
||||||
|
-- send to all clients attached to buffer
|
||||||
|
vim.lsp.buf_request(0, "textDocument/rename", params)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
input:mount()
|
||||||
|
|
||||||
|
input:on(event.BufLeave, function()
|
||||||
|
input:unmount()
|
||||||
|
end)
|
||||||
|
input:map("i", "<Esc>", function()
|
||||||
|
input:unmount()
|
||||||
|
end, { noremap = true, nowait = true })
|
||||||
|
input:map("n", "<Esc>", function()
|
||||||
|
input:unmount()
|
||||||
|
end, { noremap = true, nowait = true })
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
-- GUI config
|
-- GUI config
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
@ -235,16 +297,15 @@ map("n", "<leader>u", ":update<CR> :source<CR>", { noremap = true, silent = true
|
|||||||
map("n", "<leader>w", ":write<CR>", { noremap = true, silent = true })
|
map("n", "<leader>w", ":write<CR>", { noremap = true, silent = true })
|
||||||
map("n", "<leader>q", ":quit<CR>", { noremap = true, silent = true })
|
map("n", "<leader>q", ":quit<CR>", { noremap = true, silent = true })
|
||||||
map("n", "<leader>v", ":vsplit<CR>", { noremap = true, silent = true })
|
map("n", "<leader>v", ":vsplit<CR>", { noremap = true, silent = true })
|
||||||
map("n", "<C-d>", "<C-d>zz", { noremap = true, silent = true })
|
|
||||||
map("n", "<C-u>", "<C-u>zz", { noremap = true, silent = true })
|
|
||||||
map("n", "n", "nzzzv", { noremap = true, silent = true })
|
map("n", "n", "nzzzv", { noremap = true, silent = true })
|
||||||
map("n", "N", "Nzzzv", { noremap = true, silent = true })
|
map("n", "N", "Nzzzv", { noremap = true, silent = true })
|
||||||
|
|
||||||
|
-- vim.keymap.set("n", "grn", lsp_rename, { desc = "LSP Rename (popup)" })
|
||||||
|
|
||||||
-- Git
|
-- Git
|
||||||
map("n", "<leader>g", ":LazyGitCurrentFile<CR>", { noremap = true, silent = true })
|
map("n", "<leader>g", ":LazyGitCurrentFile<CR>", { noremap = true, silent = true })
|
||||||
|
|
||||||
-- File browser
|
-- File browser
|
||||||
-- map("n", "<leader>e", ":25Lex<CR>", { noremap = true, silent = true })
|
|
||||||
map("n", "<leader>e", ":NvimTreeToggle<CR>", { noremap = true, silent = true })
|
map("n", "<leader>e", ":NvimTreeToggle<CR>", { noremap = true, silent = true })
|
||||||
map("n", "<leader>f", ":Pick files<CR>", { noremap = true, silent = true })
|
map("n", "<leader>f", ":Pick files<CR>", { noremap = true, silent = true })
|
||||||
map("n", "<leader>h", ":Pick help<CR>", { noremap = true, silent = true })
|
map("n", "<leader>h", ":Pick help<CR>", { noremap = true, silent = true })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user