Removed uneeded configs
This commit is contained in:
+8
-14
@@ -49,20 +49,6 @@ map("n", "<C-e>", ":Lex<CR>")
|
|||||||
map("n", "<C-backspace>", ":bd<CR>")
|
map("n", "<C-backspace>", ":bd<CR>")
|
||||||
map("i", "<C-h>", vim.lsp.buf.signature_help)
|
map("i", "<C-h>", vim.lsp.buf.signature_help)
|
||||||
-- -----------------------------
|
-- -----------------------------
|
||||||
-- @PLUGINS
|
|
||||||
-- -----------------------------
|
|
||||||
vim.pack.add({
|
|
||||||
{ src = 'https://github.com/ibhagwan/fzf-lua' },
|
|
||||||
{ src = "https://github.com/saghen/blink.lib" },
|
|
||||||
{ src = "https://github.com/Saghen/blink.cmp" },
|
|
||||||
{ src = 'https://github.com/neovim/nvim-lspconfig' },
|
|
||||||
{ src = 'https://github.com/romus204/tree-sitter-manager.nvim' },
|
|
||||||
{ src = 'https://github.com/lukas-reineke/indent-blankline.nvim' },
|
|
||||||
{ src = 'https://github.com/xiyaowong/transparent.nvim' },
|
|
||||||
{ src = "https://github.com/nvim-tree/nvim-tree.lua" },
|
|
||||||
})
|
|
||||||
require("plugins")()
|
|
||||||
-- -----------------------------
|
|
||||||
-- @AUTOCMDS
|
-- @AUTOCMDS
|
||||||
-- -----------------------------
|
-- -----------------------------
|
||||||
-- Terminals should open with insert mode
|
-- Terminals should open with insert mode
|
||||||
@@ -93,3 +79,11 @@ vim.api.nvim_create_autocmd("BufWritePre", {
|
|||||||
vim.fn.setpos(".", save_cursor)
|
vim.fn.setpos(".", save_cursor)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_augroup('AutoResizeWindows', { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd('VimResized', {
|
||||||
|
group = 'AutoResizeWindows',
|
||||||
|
callback = function()
|
||||||
|
vim.cmd('wincmd =')
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
local map = vim.keymap.set
|
|
||||||
|
|
||||||
local blink = require("blink.cmp")
|
|
||||||
|
|
||||||
blink.setup({
|
|
||||||
keymap = {
|
|
||||||
["<Tab>"] = {
|
|
||||||
"select_next",
|
|
||||||
"fallback",
|
|
||||||
},
|
|
||||||
|
|
||||||
["<S-Tab>"] = {
|
|
||||||
"select_prev",
|
|
||||||
"fallback",
|
|
||||||
},
|
|
||||||
|
|
||||||
["<C-n>"] = {
|
|
||||||
"select_next",
|
|
||||||
"fallback",
|
|
||||||
},
|
|
||||||
|
|
||||||
["<C-p>"] = {
|
|
||||||
"select_prev",
|
|
||||||
"fallback",
|
|
||||||
},
|
|
||||||
|
|
||||||
["<CR>"] = {
|
|
||||||
"accept",
|
|
||||||
"fallback",
|
|
||||||
},
|
|
||||||
|
|
||||||
["<C-Space>"] = {
|
|
||||||
"show",
|
|
||||||
"show_documentation",
|
|
||||||
"hide_documentation",
|
|
||||||
},
|
|
||||||
|
|
||||||
["<Esc>"] = {
|
|
||||||
"hide",
|
|
||||||
"fallback",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
appearance = {
|
|
||||||
nerd_font_variant = "normal",
|
|
||||||
},
|
|
||||||
|
|
||||||
completion = {
|
|
||||||
menu = {
|
|
||||||
border = "single",
|
|
||||||
},
|
|
||||||
|
|
||||||
documentation = {
|
|
||||||
auto_show = true,
|
|
||||||
auto_show_delay_ms = 200,
|
|
||||||
|
|
||||||
window = {
|
|
||||||
border = "single",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
ghost_text = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
signature = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = {
|
|
||||||
default = {
|
|
||||||
"lsp",
|
|
||||||
"path",
|
|
||||||
"buffer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
fuzzy = { implementation = "lua", },
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
local function build(args)
|
|
||||||
if vim.fn.filereadable("build.sh") == 0 then
|
|
||||||
vim.notify("No build.sh found in current directory.", vim.log.levels.WARN)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.cmd("wall")
|
|
||||||
|
|
||||||
local command = "./build.sh"
|
|
||||||
|
|
||||||
if #args > 0 then
|
|
||||||
command = command .. " " .. table.concat(args, " ")
|
|
||||||
end
|
|
||||||
|
|
||||||
require("terminal").send("clear && " .. command)
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
vim.api.nvim_create_user_command(
|
|
||||||
"Build",
|
|
||||||
function(opts) build(opts.fargs) end,
|
|
||||||
{
|
|
||||||
nargs = "*",
|
|
||||||
desc = "Run project build.sh",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
local map = vim.keymap.set
|
|
||||||
map("n", "<C-Space>", function() build({}) end, { desc = "Build project", })
|
|
||||||
map("t", "<C-Space>", function() build({}) end, { desc = "Build project", })
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
local map = vim.keymap.set
|
|
||||||
|
|
||||||
require("nvim-tree").setup({
|
|
||||||
view = {
|
|
||||||
width = 35,
|
|
||||||
side = "left",
|
|
||||||
},
|
|
||||||
renderer = {
|
|
||||||
icons = {
|
|
||||||
show = {
|
|
||||||
file = false,
|
|
||||||
folder = false,
|
|
||||||
folder_arrow = false,
|
|
||||||
git = false,
|
|
||||||
diagnostics = false,
|
|
||||||
modified = false,
|
|
||||||
bookmarks = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
filters = {
|
|
||||||
dotfiles = false,
|
|
||||||
},
|
|
||||||
git = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
diagnostics = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
update_focused_file = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
on_attach = function(bufnr)
|
|
||||||
local api = require("nvim-tree.api")
|
|
||||||
api.config.mappings.default_on_attach(bufnr)
|
|
||||||
vim.keymap.del("n", "<C-e>", { buffer = bufnr })
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
map("n", "<C-e>", "<Cmd>NvimTreeToggle<CR>", { desc = "Toggle file tree", })
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
local map = vim.keymap.set
|
|
||||||
|
|
||||||
require("fzf-lua").setup({})
|
|
||||||
|
|
||||||
map("n", "<C-p>", "<Cmd>FzfLua files<CR>")
|
|
||||||
map("n", "<C-m>", "<Cmd>FzfLua buffers<CR>")
|
|
||||||
map("n", "<C-i>", "<Cmd>FzfLua diagnostics_workspace<CR>")
|
|
||||||
map("n", "<C-f>", "<Cmd>FzfLua live_grep<CR>")
|
|
||||||
map("n", "<C-b>", "<Cmd>FzfLua grep_curbuf<CR>")
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
require("ibl").setup({
|
|
||||||
indent = {
|
|
||||||
char = "│",
|
|
||||||
},
|
|
||||||
|
|
||||||
scope = {
|
|
||||||
show_start = false,
|
|
||||||
show_end = false,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
local map = vim.keymap.set
|
|
||||||
|
|
||||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
|
||||||
|
|
||||||
vim.lsp.config("gopls", {
|
|
||||||
capabilities = capabilities,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.lsp.config("ols", {
|
|
||||||
capabilities = capabilities,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.lsp.enable({
|
|
||||||
"gopls",
|
|
||||||
"ols",
|
|
||||||
})
|
|
||||||
|
|
||||||
map("n", "gd", vim.lsp.buf.definition)
|
|
||||||
map("n", "gD", vim.lsp.buf.declaration)
|
|
||||||
map("n", "gi", vim.lsp.buf.implementation)
|
|
||||||
map("n", "gr", vim.lsp.buf.references)
|
|
||||||
|
|
||||||
map("n", "K", vim.lsp.buf.hover)
|
|
||||||
map("i", "<C-h>", vim.lsp.buf.signature_help)
|
|
||||||
|
|
||||||
map("n", "<leader>rn", vim.lsp.buf.rename)
|
|
||||||
map("n", "<leader>ca", vim.lsp.buf.code_action)
|
|
||||||
|
|
||||||
map("n", "[d", vim.diagnostic.goto_prev)
|
|
||||||
map("n", "]d", vim.diagnostic.goto_next)
|
|
||||||
|
|
||||||
map("n", "<leader>d", vim.diagnostic.open_float)
|
|
||||||
map("n", "<leader>q", vim.diagnostic.setloclist)
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
return function()
|
|
||||||
require("fuzzyfinder").setup()
|
|
||||||
require("treesitter").setup()
|
|
||||||
require("indent").setup()
|
|
||||||
require("autocomplete").setup()
|
|
||||||
require("lsp").setup()
|
|
||||||
require("terminal").setup()
|
|
||||||
require("filetree").setup()
|
|
||||||
require("build").setup()
|
|
||||||
require("statusbar").setup({
|
|
||||||
bg = "#111111",
|
|
||||||
fg = "#ffffff",
|
|
||||||
separator = " │ ",
|
|
||||||
})
|
|
||||||
end
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
local config = {
|
|
||||||
bg = "#202020",
|
|
||||||
fg = "#ffffff",
|
|
||||||
separator = " │ ",
|
|
||||||
}
|
|
||||||
|
|
||||||
local mode_names = {
|
|
||||||
["n"] = "NORMAL",
|
|
||||||
["no"] = "NORMAL",
|
|
||||||
["nov"] = "NORMAL",
|
|
||||||
["noV"] = "NORMAL",
|
|
||||||
["no\22"] = "NORMAL",
|
|
||||||
["niI"] = "NORMAL",
|
|
||||||
["niR"] = "NORMAL",
|
|
||||||
["niV"] = "NORMAL",
|
|
||||||
|
|
||||||
["i"] = "INSERT",
|
|
||||||
["ic"] = "INSERT",
|
|
||||||
["ix"] = "INSERT",
|
|
||||||
|
|
||||||
["v"] = "VISUAL",
|
|
||||||
["V"] = "V-LINE",
|
|
||||||
["\22"] = "V-BLOCK",
|
|
||||||
|
|
||||||
["s"] = "SELECT",
|
|
||||||
["S"] = "S-LINE",
|
|
||||||
["\19"] = "S-BLOCK",
|
|
||||||
|
|
||||||
["R"] = "REPLACE",
|
|
||||||
["Rc"] = "REPLACE",
|
|
||||||
["Rv"] = "V-REPLACE",
|
|
||||||
|
|
||||||
["c"] = "COMMAND",
|
|
||||||
["cv"] = "COMMAND",
|
|
||||||
["ce"] = "COMMAND",
|
|
||||||
|
|
||||||
["r"] = "PROMPT",
|
|
||||||
["rm"] = "MORE",
|
|
||||||
["r?"] = "CONFIRM",
|
|
||||||
|
|
||||||
["!"] = "SHELL",
|
|
||||||
["t"] = "TERMINAL",
|
|
||||||
}
|
|
||||||
|
|
||||||
local function mode()
|
|
||||||
return mode_names[vim.fn.mode()] or "UNKNOWN"
|
|
||||||
end
|
|
||||||
|
|
||||||
local function filename()
|
|
||||||
local name = vim.fn.expand("%:t")
|
|
||||||
|
|
||||||
if name == "" then
|
|
||||||
return "[No Name]"
|
|
||||||
end
|
|
||||||
|
|
||||||
return name
|
|
||||||
end
|
|
||||||
|
|
||||||
local function git_branch()
|
|
||||||
local branch = vim.b.gitsigns_head
|
|
||||||
|
|
||||||
if branch and branch ~= "" then
|
|
||||||
return " " .. branch
|
|
||||||
end
|
|
||||||
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
|
|
||||||
local function filetype()
|
|
||||||
if vim.bo.filetype == "" then
|
|
||||||
return "text"
|
|
||||||
end
|
|
||||||
|
|
||||||
return vim.bo.filetype
|
|
||||||
end
|
|
||||||
|
|
||||||
local function active_lsp()
|
|
||||||
local clients = vim.lsp.get_clients({
|
|
||||||
bufnr = 0,
|
|
||||||
})
|
|
||||||
|
|
||||||
if #clients == 0 then
|
|
||||||
return "-"
|
|
||||||
end
|
|
||||||
|
|
||||||
local names = {}
|
|
||||||
|
|
||||||
for _, client in ipairs(clients) do
|
|
||||||
table.insert(names, client.name)
|
|
||||||
end
|
|
||||||
|
|
||||||
return table.concat(names, ",")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function diagnostics()
|
|
||||||
local errors = #vim.diagnostic.get(0, {
|
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
|
||||||
})
|
|
||||||
|
|
||||||
if errors > 0 then
|
|
||||||
return "%#StatusError#●%*"
|
|
||||||
end
|
|
||||||
|
|
||||||
local warnings = #vim.diagnostic.get(0, {
|
|
||||||
severity = vim.diagnostic.severity.WARN,
|
|
||||||
})
|
|
||||||
|
|
||||||
if warnings > 0 then
|
|
||||||
return "%#StatusWarn#●%*"
|
|
||||||
end
|
|
||||||
|
|
||||||
return "%#StatusNormal#●%*"
|
|
||||||
end
|
|
||||||
|
|
||||||
local function position()
|
|
||||||
return string.format("%d:%d", vim.fn.line("."), vim.fn.col("."))
|
|
||||||
end
|
|
||||||
|
|
||||||
local function build()
|
|
||||||
local left = table.concat({
|
|
||||||
" ",
|
|
||||||
mode(),
|
|
||||||
config.separator,
|
|
||||||
diagnostics(),
|
|
||||||
config.separator,
|
|
||||||
filename(),
|
|
||||||
})
|
|
||||||
|
|
||||||
local right = {}
|
|
||||||
|
|
||||||
local branch = git_branch()
|
|
||||||
|
|
||||||
if branch ~= "" then
|
|
||||||
table.insert(right, branch)
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(right, filetype())
|
|
||||||
table.insert(right, active_lsp())
|
|
||||||
table.insert(right, position())
|
|
||||||
|
|
||||||
return left
|
|
||||||
.. "%="
|
|
||||||
.. " "
|
|
||||||
.. table.concat(right, config.separator)
|
|
||||||
.. " "
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.setup(opts)
|
|
||||||
config = vim.tbl_extend("force", config, opts or {})
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "StatusLine", {
|
|
||||||
fg = config.fg,
|
|
||||||
bg = config.bg,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "StatusLineNC", {
|
|
||||||
fg = config.fg,
|
|
||||||
bg = config.bg,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "StatusNormal", {
|
|
||||||
fg = "#808080",
|
|
||||||
bg = config.bg,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "StatusLsp", {
|
|
||||||
fg = "#61afef",
|
|
||||||
bg = config.bg,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "StatusWarn", {
|
|
||||||
fg = "#e5c07b",
|
|
||||||
bg = config.bg,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "StatusError", {
|
|
||||||
fg = "#e06c75",
|
|
||||||
bg = config.bg,
|
|
||||||
})
|
|
||||||
|
|
||||||
_G.StatusBar = build
|
|
||||||
|
|
||||||
vim.o.statusline = "%!v:lua.StatusBar()"
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
local term_buf = nil
|
|
||||||
|
|
||||||
local function open_term_split()
|
|
||||||
vim.cmd("botright vsplit")
|
|
||||||
|
|
||||||
local win = vim.api.nvim_get_current_win()
|
|
||||||
|
|
||||||
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
|
||||||
vim.api.nvim_win_set_buf(win, term_buf)
|
|
||||||
else
|
|
||||||
vim.cmd("terminal")
|
|
||||||
term_buf = vim.api.nvim_get_current_buf()
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_win_set_width(win, math.floor(vim.o.columns * 0.37))
|
|
||||||
vim.cmd("startinsert")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function toggle_term()
|
|
||||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
|
||||||
if vim.api.nvim_win_get_buf(win) == term_buf then
|
|
||||||
vim.api.nvim_win_close(win, false)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
open_term_split()
|
|
||||||
end
|
|
||||||
|
|
||||||
local function open_term_fullscreen()
|
|
||||||
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
|
||||||
vim.api.nvim_set_current_buf(term_buf)
|
|
||||||
else
|
|
||||||
vim.cmd("terminal")
|
|
||||||
term_buf = vim.api.nvim_get_current_buf()
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.cmd("startinsert")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function prev_non_term_buf()
|
|
||||||
local current = vim.api.nvim_get_current_buf()
|
|
||||||
local buffers = vim.fn.getbufinfo({ buflisted = 1 })
|
|
||||||
local candidates = {}
|
|
||||||
|
|
||||||
for _, buffer in ipairs(buffers) do
|
|
||||||
if buffer.bufnr ~= current and vim.bo[buffer.bufnr].buftype ~= "terminal" then
|
|
||||||
table.insert(candidates, buffer)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if #candidates == 0 then
|
|
||||||
print("No previous non-terminal buffer")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
table.sort(candidates, function(a, b)
|
|
||||||
return a.lastused > b.lastused
|
|
||||||
end)
|
|
||||||
|
|
||||||
vim.api.nvim_set_current_buf(candidates[1].bufnr)
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
local map = vim.keymap.set
|
|
||||||
|
|
||||||
map("n", "<C-j>", toggle_term, { desc = "Toggle terminal split", })
|
|
||||||
map("n", "<C-o>", open_term_fullscreen, { desc = "Open terminal fullscreen", })
|
|
||||||
map("t", "<C-j>", toggle_term, { desc = "Toggle terminal split", })
|
|
||||||
map("t", "<C-o>", prev_non_term_buf, { desc = "Return to previous buffer", })
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.send(command)
|
|
||||||
local terminal_visible = false
|
|
||||||
|
|
||||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
|
||||||
if term_buf and vim.api.nvim_win_get_buf(win) == term_buf then
|
|
||||||
terminal_visible = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if not terminal_visible then
|
|
||||||
open_term_split()
|
|
||||||
end
|
|
||||||
|
|
||||||
local job = vim.b[term_buf].terminal_job_id
|
|
||||||
|
|
||||||
if job then
|
|
||||||
vim.api.nvim_chan_send(job, command .. "\n")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
require("tree-sitter-manager").setup()
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
Reference in New Issue
Block a user