Added base folke setup
This commit is contained in:
12
lua/plugins/autopairs.lua
Normal file
12
lua/plugins/autopairs.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
module = "nvim-autopairs",
|
||||
config = function()
|
||||
local npairs = require("nvim-autopairs")
|
||||
npairs.setup({
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = { "string", "comment" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
56
lua/plugins/bufferline.lua
Normal file
56
lua/plugins/bufferline.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
local M = {
|
||||
event = "BufReadPre",
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local signs = require("plugins.lsp.diagnostics").signs
|
||||
|
||||
signs = {
|
||||
error = signs.Error,
|
||||
warning = signs.Warn,
|
||||
info = signs.Info,
|
||||
hint = signs.Hint,
|
||||
}
|
||||
|
||||
local severities = {
|
||||
"error",
|
||||
"warning",
|
||||
-- "info",
|
||||
-- "hint",
|
||||
}
|
||||
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
show_close_icon = true,
|
||||
diagnostics = "nvim_lsp",
|
||||
always_show_bufferline = false,
|
||||
separator_style = "thick",
|
||||
diagnostics_indicator = function(_, _, diag)
|
||||
local s = {}
|
||||
for _, severity in ipairs(severities) do
|
||||
if diag[severity] then
|
||||
table.insert(s, signs[severity] .. diag[severity])
|
||||
end
|
||||
end
|
||||
return table.concat(s, " ")
|
||||
end,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "neo-tree",
|
||||
text = "Neo Tree",
|
||||
highlight = "Directory",
|
||||
text_align = "left",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
-- function M.init()
|
||||
-- vim.keymap.set("n", "<leader>bp", "<cmd>:BufferLineCyclePrev<CR>", { desc = "Previous Buffer" })
|
||||
-- vim.keymap.set("n", "<leader>bn", "<cmd>:BufferLineCycleNext<CR>", { desc = "Next Buffer" })
|
||||
-- vim.keymap.set("n", "[b", "<cmd>:BufferLineCyclePrev<CR>", { desc = "Previous Buffer" })
|
||||
-- vim.keymap.set("n", "]b", "<cmd>:BufferLineCycleNext<CR>", { desc = "Next Buffer" })
|
||||
-- end
|
||||
|
||||
return M
|
60
lua/plugins/cmp.lua
Normal file
60
lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,60 @@
|
||||
local M = {
|
||||
event = "InsertEnter",
|
||||
module = "cmp",
|
||||
requires = {
|
||||
{ "hrsh7th/cmp-nvim-lsp", module = "cmp_nvim_lsp" },
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"dmitmel/cmp-cmdline-history",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
|
||||
-- Setup nvim-cmp.
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
{ name = "emoji" },
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
}),
|
||||
formatting = {
|
||||
format = require("plugins.lsp.kind").cmp_format(),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "LspCodeLens",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||
end
|
||||
|
||||
return M
|
26
lua/plugins/colorizer.lua
Normal file
26
lua/plugins/colorizer.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
return {
|
||||
event = "BufReadPre",
|
||||
config = function()
|
||||
require("colorizer").setup({
|
||||
user_default_options = {
|
||||
RGB = true, -- #RGB hex codes
|
||||
RRGGBB = true, -- #RRGGBB hex codes
|
||||
names = false, -- "Name" codes like Blue
|
||||
RRGGBBAA = true, -- #RRGGBBAA hex codes
|
||||
AARRGGBB = false, -- 0xAARRGGBB hex codes
|
||||
rgb_fn = true, -- CSS rgb() and rgba() functions
|
||||
hsl_fn = true, -- CSS hsl() and hsla() functions
|
||||
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
-- Available modes: foreground, background
|
||||
-- Available modes for `mode`: foreground, background, virtualtext
|
||||
mode = "background", -- Set the display mode.
|
||||
virtualtext = "■",
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd(
|
||||
[[autocmd ColorScheme * lua package.loaded['colorizer'] = nil; require('colorizer').setup(); require('colorizer').attach_to_buffer(0)]]
|
||||
)
|
||||
end,
|
||||
}
|
33
lua/plugins/dashboard.lua
Normal file
33
lua/plugins/dashboard.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
return {
|
||||
opt = false,
|
||||
config = function()
|
||||
local db = require("dashboard")
|
||||
|
||||
local logo = [[
|
||||
███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗
|
||||
████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║
|
||||
██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║
|
||||
██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║
|
||||
██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║
|
||||
╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝
|
||||
]]
|
||||
local lines = {}
|
||||
for line in logo:gmatch("[^\n]+") do
|
||||
table.insert(lines, line)
|
||||
end
|
||||
|
||||
db.custom_header = lines
|
||||
|
||||
vim.g.dashboard_custom_header = lines
|
||||
|
||||
vim.g.dashboard_custom_shortcut = {
|
||||
["last_session"] = "SPC s l",
|
||||
["find_history"] = "SPC f r",
|
||||
["find_file"] = "SPC spc",
|
||||
["new_file"] = "SPC f n",
|
||||
["change_colorscheme"] = "SPC h c",
|
||||
["find_word"] = "SPC f g",
|
||||
["book_marks"] = "SPC f b",
|
||||
}
|
||||
end,
|
||||
}
|
53
lua/plugins/indent-blankline.lua
Normal file
53
lua/plugins/indent-blankline.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
local M = {}
|
||||
|
||||
M.event = "BufReadPre"
|
||||
|
||||
function M.config()
|
||||
local indent = require("indent_blankline")
|
||||
|
||||
--- PERF: debounce indent-blankline refresh
|
||||
local refresh = indent.refresh
|
||||
indent.refresh = require("util").debounce(100, refresh)
|
||||
|
||||
indent.setup({
|
||||
buftype_exclude = { "terminal", "nofile" },
|
||||
filetype_exclude = {
|
||||
"help",
|
||||
"startify",
|
||||
"dashboard",
|
||||
"packer",
|
||||
"neogitstatus",
|
||||
"NvimTree",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
},
|
||||
char = "│",
|
||||
use_treesitter_scope = false,
|
||||
show_trailing_blankline_indent = false,
|
||||
show_current_context = true,
|
||||
context_patterns = {
|
||||
"class",
|
||||
"return",
|
||||
"function",
|
||||
"method",
|
||||
"^if",
|
||||
"^while",
|
||||
"jsx_element",
|
||||
"^for",
|
||||
"^object",
|
||||
"^table",
|
||||
"block",
|
||||
"arguments",
|
||||
"if_statement",
|
||||
"else_clause",
|
||||
"jsx_element",
|
||||
"jsx_self_closing_element",
|
||||
"try_statement",
|
||||
"catch_clause",
|
||||
"import_statement",
|
||||
"operation_type",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
26
lua/plugins/lsp/diagnostics.lua
Normal file
26
lua/plugins/lsp/diagnostics.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
local M = {}
|
||||
|
||||
M.signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
|
||||
function M.setup()
|
||||
-- Automatically update diagnostics
|
||||
vim.diagnostic.config({
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = { spacing = 4, prefix = "●" },
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
vim.lsp.handlers["workspace/diagnostic/refresh"] = function(_, _, ctx)
|
||||
local ns = vim.lsp.diagnostic.get_namespace(ctx.client_id)
|
||||
pcall(vim.diagnostic.reset, ns)
|
||||
return true
|
||||
end
|
||||
|
||||
for type, icon in pairs(M.signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
59
lua/plugins/lsp/formatting.lua
Normal file
59
lua/plugins/lsp/formatting.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
local util = require("util")
|
||||
|
||||
local M = {}
|
||||
|
||||
-- vim.lsp.handlers["textDocument/hover"] = function(_, method, result)
|
||||
-- print(vim.inspect(result))
|
||||
-- end
|
||||
|
||||
M.autoformat = true
|
||||
|
||||
function M.toggle()
|
||||
M.autoformat = not M.autoformat
|
||||
if M.autoformat then
|
||||
util.info("enabled format on save", "Formatting")
|
||||
else
|
||||
util.warn("disabled format on save", "Formatting")
|
||||
end
|
||||
end
|
||||
|
||||
function M.format()
|
||||
if M.autoformat then
|
||||
if vim.lsp.buf.format then
|
||||
vim.lsp.buf.format()
|
||||
else
|
||||
vim.lsp.buf.formatting_sync()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup(client, buf)
|
||||
local ft = vim.api.nvim_buf_get_option(buf, "filetype")
|
||||
local nls = require("plugins.null-ls")
|
||||
|
||||
local enable = false
|
||||
if nls.has_formatter(ft) then
|
||||
enable = client.name == "null-ls"
|
||||
else
|
||||
enable = not (client.name == "null-ls")
|
||||
end
|
||||
|
||||
if client.name == "tsserver" then
|
||||
enable = false
|
||||
end
|
||||
|
||||
-- util.info(client.name .. " " .. (enable and "yes" or "no"), "format")
|
||||
|
||||
client.server_capabilities.documentFormattingProvider = enable
|
||||
-- format on save
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.cmd([[
|
||||
augroup LspFormat
|
||||
autocmd! * <buffer>
|
||||
autocmd BufWritePre <buffer> lua require("plugins.lsp.formatting").format()
|
||||
augroup END
|
||||
]])
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
91
lua/plugins/lsp/init.lua
Normal file
91
lua/plugins/lsp/init.lua
Normal file
@@ -0,0 +1,91 @@
|
||||
local M = {
|
||||
event = "BufReadPre"
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require("lua-dev").setup({
|
||||
library = {
|
||||
runtime = "~/projects/neovim/runtime/"
|
||||
}
|
||||
})
|
||||
require("mason")
|
||||
require("plugins.lsp.diagnostics").setup()
|
||||
require("fidget").setup({text = {spinner = "dots"} })
|
||||
local function on_attach(client, bufnr)
|
||||
--require("nvim-navic").attach(client, bufnr)
|
||||
require("plugins.lsp.formatting").setup(client, bufnr)
|
||||
--require("plugins.lsp.keys").setup(client, bufnr)
|
||||
end
|
||||
|
||||
---@type lspconfig.options
|
||||
local servers = {
|
||||
sumneko_lua = {
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
completion = {
|
||||
workspaceWord = false,
|
||||
},
|
||||
misc = {
|
||||
parameters = {
|
||||
"--log-level=trace",
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
groupFileStatus = {
|
||||
["ambiguity"] = "Opened",
|
||||
["await"] = "Opened",
|
||||
["codestyle"] = "None",
|
||||
["duplicate"] = "Opened",
|
||||
["global"] = "Opened",
|
||||
["luadoc"] = "Opened",
|
||||
["redefined"] = "Opened",
|
||||
["strict"] = "Opened",
|
||||
["strong"] = "Opened",
|
||||
["type-check"] = "Opened",
|
||||
["unbalanced"] = "Opened",
|
||||
["unused"] = "Opened",
|
||||
},
|
||||
unusedLocalExclude = { "_*" },
|
||||
},
|
||||
format = {
|
||||
enable = false,
|
||||
defaultConfig = {
|
||||
indent_style = "space",
|
||||
indent_size = "2",
|
||||
continuation_indent_size = "2",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
vimls = {},
|
||||
}
|
||||
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dymanicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
|
||||
---@type _.lspconfig.options
|
||||
local options = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_change = 150,
|
||||
}
|
||||
}
|
||||
|
||||
for server, opts in pairs(servers) do
|
||||
opts = vim.tbl_deep_extend("force", {}, options, opts or {})
|
||||
require("lspconfig")[server].setup(opts)
|
||||
end
|
||||
|
||||
require("plugins.null-ls").setup(options)
|
||||
|
||||
end
|
||||
|
||||
return M
|
36
lua/plugins/lsp/kind.lua
Normal file
36
lua/plugins/lsp/kind.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
local M = {}
|
||||
|
||||
M.icons = {
|
||||
Class = " ",
|
||||
Color = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Enum = "了 ",
|
||||
EnumMember = " ",
|
||||
Field = " ",
|
||||
File = " ",
|
||||
Folder = " ",
|
||||
Function = " ",
|
||||
Interface = "ﰮ ",
|
||||
Keyword = " ",
|
||||
Method = "ƒ ",
|
||||
Module = " ",
|
||||
Property = " ",
|
||||
Snippet = " ",
|
||||
Struct = " ",
|
||||
Text = " ",
|
||||
Unit = " ",
|
||||
Value = " ",
|
||||
Variable = " ",
|
||||
}
|
||||
|
||||
function M.cmp_format()
|
||||
return function(_entry, vim_item)
|
||||
if M.icons[vim_item.kind] then
|
||||
vim_item.kind = M.icons[vim_item.kind] .. vim_item.kind
|
||||
end
|
||||
return vim_item
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
86
lua/plugins/lualine.lua
Normal file
86
lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,86 @@
|
||||
local M = {
|
||||
module = "lualine",
|
||||
event = "User PackerDefered",
|
||||
}
|
||||
|
||||
local function clock()
|
||||
return " " .. os.date("%H:%M")
|
||||
end
|
||||
|
||||
local function holidays()
|
||||
return "🌴🌊"
|
||||
-- return "\U0001f385\U0001f384\U0001f31f\U0001f381"
|
||||
end
|
||||
|
||||
function M.config()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "auto",
|
||||
section_separators = { left = "", right = "" },
|
||||
component_separators = { left = "", right = "" },
|
||||
icons_enabled = true,
|
||||
globalstatus = true,
|
||||
disabled_filetypes = { statusline = { "dashboard" } },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch" },
|
||||
lualine_c = {
|
||||
{ "diagnostics", sources = { "nvim_diagnostic" } },
|
||||
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||
{ "filename", path = 1, symbols = { modified = " ", readonly = "", unnamed = "" } },
|
||||
{
|
||||
function()
|
||||
local navic = require("nvim-navic")
|
||||
local ret = navic.get_location()
|
||||
return ret:len() > 2000 and "navic error" or ret
|
||||
end,
|
||||
cond = function()
|
||||
local navic = require("nvim-navic")
|
||||
return navic.is_available()
|
||||
end,
|
||||
color = { fg = "#ff9e64" },
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
-- {
|
||||
-- require("noice.status").message.get_hl,
|
||||
-- cond = require("noice.status").message.has,
|
||||
-- },
|
||||
-- {
|
||||
-- require("noice.status").command.get,
|
||||
-- cond = require("noice.status").command.has,
|
||||
-- color = { fg = "#ff9e64" },
|
||||
-- },
|
||||
-- {
|
||||
-- require("noice.status").mode.get,
|
||||
-- cond = require("noice.status").mode.has,
|
||||
-- color = { fg = "#ff9e64" },
|
||||
-- },
|
||||
-- {
|
||||
-- require("noice.status").search.get,
|
||||
-- cond = require("noice.status").search.has,
|
||||
-- color = { fg = "#ff9e64" },
|
||||
-- },
|
||||
-- function()
|
||||
-- return require("messages.view").status
|
||||
-- end,
|
||||
-- { require("github-notifications").statusline_notification_count },
|
||||
{ holidays },
|
||||
},
|
||||
lualine_y = { "location" },
|
||||
lualine_z = { clock },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
extensions = { "nvim-tree" },
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
49
lua/plugins/luasnip.lua
Normal file
49
lua/plugins/luasnip.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
local M = {
|
||||
module = "luasnip",
|
||||
requires = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
local util = require("util")
|
||||
local luasnip = require("luasnip")
|
||||
require("neogen")
|
||||
|
||||
luasnip.config.setup({
|
||||
history = true,
|
||||
enable_autosnippets = true,
|
||||
-- Update more often, :h events for more info.
|
||||
-- updateevents = "TextChanged,TextChangedI",
|
||||
})
|
||||
|
||||
--- <tab> to jump to next snippet's placeholder
|
||||
local function on_tab()
|
||||
return luasnip.jump(1) and "" or util.t("<Tab>")
|
||||
end
|
||||
|
||||
--- <s-tab> to jump to next snippet's placeholder
|
||||
local function on_s_tab()
|
||||
return luasnip.jump(-1) and "" or util.t("<S-Tab>")
|
||||
end
|
||||
|
||||
-- vim.keymap.set("i", "<Tab>", on_tab, { expr = true })
|
||||
-- vim.keymap.set("s", "<Tab>", on_tab, { expr = true })
|
||||
-- vim.keymap.set("i", "<S-Tab>", on_s_tab, { expr = true })
|
||||
-- vim.keymap.set("s", "<S-Tab>", on_s_tab, { expr = true })
|
||||
|
||||
vim.cmd([[
|
||||
" press <Tab> to expand or jump in a snippet. These can also be mapped separately
|
||||
" via <Plug>luasnip-expand-snippet and <Plug>luasnip-jump-next.
|
||||
imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>'
|
||||
" -1 for jumping backwards.
|
||||
inoremap <silent> <S-Tab> <cmd>lua require'luasnip'.jump(-1)<Cr>
|
||||
snoremap <silent> <Tab> <cmd>lua require('luasnip').jump(1)<Cr>
|
||||
snoremap <silent> <S-Tab> <cmd>lua require('luasnip').jump(-1)<Cr>
|
||||
]])
|
||||
end
|
||||
|
||||
return M
|
28
lua/plugins/mason.lua
Normal file
28
lua/plugins/mason.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
local M = {
|
||||
module = "mason",
|
||||
}
|
||||
|
||||
M.tools = {
|
||||
"stylua",
|
||||
"selene",
|
||||
}
|
||||
|
||||
function M.check()
|
||||
local mr = require("mason-registry")
|
||||
for _, tool in ipairs(M.tools) do
|
||||
local p = mr.get_package(tool)
|
||||
if not p:is_installed() then
|
||||
p:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.config()
|
||||
require("mason").setup()
|
||||
M.check()
|
||||
require("mason-lspconfig").setup({
|
||||
automatic_installation = true,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
@@ -1,8 +1,8 @@
|
||||
return {
|
||||
cmd = "Neotree",
|
||||
config = function()
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
cmd = "Neotree",
|
||||
config = function()
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
|
||||
require("neo-tree").setup({filesystem = {follow_current_file = true}})
|
||||
end,
|
||||
require("neo-tree").setup({ filesystem = { follow_current_file = true } })
|
||||
end,
|
||||
}
|
||||
|
19
lua/plugins/neoscroll.lua
Normal file
19
lua/plugins/neoscroll.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
keys = { "<C-u>", "<C-d>", "gg", "G" },
|
||||
config = function()
|
||||
require("neoscroll").setup({})
|
||||
local map = {}
|
||||
|
||||
map["<C-u>"] = { "scroll", { "-vim.wo.scroll", "true", "80" } }
|
||||
map["<C-d>"] = { "scroll", { "vim.wo.scroll", "true", "80" } }
|
||||
map["<C-b>"] = { "scroll", { "-vim.api.nvim_win_get_height(0)", "true", "250" } }
|
||||
map["<C-f>"] = { "scroll", { "vim.api.nvim_win_get_height(0)", "true", "250" } }
|
||||
map["<C-y>"] = { "scroll", { "-0.10", "false", "80" } }
|
||||
map["<C-e>"] = { "scroll", { "0.10", "false", "80" } }
|
||||
map["zt"] = { "zt", { "150" } }
|
||||
map["zz"] = { "zz", { "150" } }
|
||||
map["zb"] = { "zb", { "150" } }
|
||||
|
||||
require("neoscroll.config").set_mappings(map)
|
||||
end,
|
||||
}
|
34
lua/plugins/null-ls.lua
Normal file
34
lua/plugins/null-ls.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
local M = { module = "null-ls" }
|
||||
|
||||
function M.setup(options)
|
||||
local nls = require("null-ls")
|
||||
nls.setup({
|
||||
debounce = 150,
|
||||
save_after_format = false,
|
||||
sources = {
|
||||
-- nls.builtins.formatting.prettierd,
|
||||
nls.builtins.formatting.stylua,
|
||||
nls.builtins.formatting.fish_indent,
|
||||
-- nls.builtins.formatting.fixjson.with({ filetypes = { "jsonc" } }),
|
||||
-- nls.builtins.formatting.eslint_d,
|
||||
-- nls.builtins.diagnostics.shellcheck,
|
||||
--nls.builtins.formatting.shfmt,
|
||||
--nls.builtins.diagnostics.markdownlint,
|
||||
-- nls.builtins.formatting.deno_fmt.with({
|
||||
-- filetypes = { "markdown" }, -- only runs `deno fmt` for markdown
|
||||
-- }),
|
||||
-- nls.builtins.diagnostics.selene,
|
||||
-- nls.builtins.code_actions.gitsigns,
|
||||
},
|
||||
on_attach = options.on_attach,
|
||||
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".nvim.settings.json", ".git"),
|
||||
})
|
||||
end
|
||||
|
||||
function M.has_formatter(ft)
|
||||
local sources = require("null-ls.sources")
|
||||
local available = sources.get_available(ft, "NULL_LS_FORMATTING")
|
||||
return #available > 0
|
||||
end
|
||||
|
||||
return M
|
123
lua/plugins/telescope.lua
Normal file
123
lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,123 @@
|
||||
local M = {
|
||||
cmd = { "Telescope" },
|
||||
module = "telescope",
|
||||
requires = {
|
||||
{ "nvim-telescope/telescope-file-browser.nvim", module = "telescope._extensions.file_browser" },
|
||||
{ "nvim-telescope/telescope-z.nvim", module = "telescope._extensions.z" },
|
||||
{ "nvim-telescope/telescope-project.nvim", module = "telescope._extensions.project" },
|
||||
{ "nvim-telescope/telescope-symbols.nvim", module = "telescope._extensions.symbols" },
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", module = "telescope._extensions.fzf", run = "make" },
|
||||
},
|
||||
}
|
||||
|
||||
function M.project_files(opts)
|
||||
opts = opts or {}
|
||||
opts.show_untracked = true
|
||||
local ok = pcall(require("telescope.builtin").git_files, opts)
|
||||
if not ok then
|
||||
local client = vim.lsp.get_active_clients()[1]
|
||||
if client then
|
||||
opts.cwd = client.config.root_dir
|
||||
end
|
||||
require("telescope.builtin").find_files(opts)
|
||||
end
|
||||
end
|
||||
|
||||
function M.config()
|
||||
-- local actions = require("telescope.actions")
|
||||
local trouble = require("trouble.providers.telescope")
|
||||
|
||||
local telescope = require("telescope")
|
||||
local borderless = true
|
||||
telescope.setup({
|
||||
extensions = {
|
||||
-- fzf = {
|
||||
-- fuzzy = true, -- false will only do exact matching
|
||||
-- override_generic_sorter = true, -- override the generic sorter
|
||||
-- override_file_sorter = true, -- override the file sorter
|
||||
-- case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- -- the default case_mode is "smart_case"
|
||||
-- },
|
||||
},
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
prompt_position = "top",
|
||||
},
|
||||
sorting_strategy = "ascending",
|
||||
mappings = { i = { ["<c-t>"] = trouble.open_with_trouble } },
|
||||
-- mappings = { i = { ["<esc>"] = actions.close } },
|
||||
-- vimgrep_arguments = {
|
||||
-- 'rg',
|
||||
-- '--color=never',
|
||||
-- '--no-heading',
|
||||
-- '--with-filename',
|
||||
-- '--line-number',
|
||||
-- '--column',
|
||||
-- '--smart-case'
|
||||
-- },
|
||||
-- prompt_position = "bottom",
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
-- entry_prefix = " ",
|
||||
-- initial_mode = "insert",
|
||||
-- selection_strategy = "reset",
|
||||
-- sorting_strategy = "descending",
|
||||
-- layout_strategy = "horizontal",
|
||||
-- layout_defaults = {
|
||||
-- horizontal = {
|
||||
-- mirror = false,
|
||||
-- },
|
||||
-- vertical = {
|
||||
-- mirror = false,
|
||||
-- },
|
||||
-- },
|
||||
-- file_sorter = require"telescope.sorters".get_fzy_file
|
||||
-- file_ignore_patterns = {},
|
||||
-- generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
|
||||
-- shorten_path = true,
|
||||
winblend = borderless and 0 or 10,
|
||||
-- width = 0.7,
|
||||
-- preview_cutoff = 120,
|
||||
-- results_height = 1,
|
||||
-- results_width = 0.8,
|
||||
-- border = false,
|
||||
-- color_devicons = true,
|
||||
-- use_less = true,
|
||||
-- set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil,
|
||||
-- file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
|
||||
-- grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
|
||||
-- qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
|
||||
|
||||
-- -- Developer configurations: Not meant for general override
|
||||
-- buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
|
||||
},
|
||||
})
|
||||
|
||||
-- telescope.load_extension("frecency")
|
||||
telescope.load_extension("fzf")
|
||||
telescope.load_extension("z")
|
||||
telescope.load_extension("file_browser")
|
||||
telescope.load_extension("neoclip")
|
||||
-- telescope.load_extension("project")
|
||||
end
|
||||
|
||||
function M.init()
|
||||
vim.keymap.set("n", "<leader><space>", function()
|
||||
require("plugins.telescope").project_files()
|
||||
end, { desc = "Find File" })
|
||||
|
||||
vim.keymap.set("n", "<leader>fd", function()
|
||||
require("telescope.builtin").git_files({ cwd = "~/dot" })
|
||||
end, { desc = "Find Dot File" })
|
||||
|
||||
vim.keymap.set("n", "<leader>fz", function()
|
||||
require("telescope").extensions.z.list({ cmd = { vim.o.shell, "-c", "zoxide query -ls" } })
|
||||
end, { desc = "Find Zoxide" })
|
||||
|
||||
vim.keymap.set("n", "<leader>pp", function()
|
||||
require("telescope").extensions.project.project({})
|
||||
end, { desc = "Find Project" })
|
||||
end
|
||||
|
||||
return M
|
59
lua/plugins/tokyonight.lua
Normal file
59
lua/plugins/tokyonight.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
return {
|
||||
opt = false,
|
||||
config = function()
|
||||
-- vim.o.background = "dark"
|
||||
local tokyonight = require("tokyonight")
|
||||
tokyonight.setup({
|
||||
style = "moon",
|
||||
-- transparent = true,
|
||||
-- hide_inactive_statusline = false,
|
||||
sidebars = {
|
||||
"qf",
|
||||
"vista_kind",
|
||||
"terminal",
|
||||
"packer",
|
||||
"spectre_panel",
|
||||
"NeogitStatus",
|
||||
"help",
|
||||
"startuptime",
|
||||
"Outline",
|
||||
},
|
||||
on_colors = function(c) end,
|
||||
on_highlights = function(hl, c)
|
||||
-- make the current line cursor orange
|
||||
hl.CursorLineNr = { fg = c.orange, bold = true }
|
||||
|
||||
-- borderless telescope
|
||||
local prompt = "#2d3149"
|
||||
hl.TelescopeNormal = {
|
||||
bg = c.bg_dark,
|
||||
fg = c.fg_dark,
|
||||
}
|
||||
hl.TelescopeBorder = {
|
||||
bg = c.bg_dark,
|
||||
fg = c.bg_dark,
|
||||
}
|
||||
hl.TelescopePromptNormal = {
|
||||
bg = prompt,
|
||||
}
|
||||
hl.TelescopePromptBorder = {
|
||||
bg = prompt,
|
||||
fg = prompt,
|
||||
}
|
||||
hl.TelescopePromptTitle = {
|
||||
bg = c.fg_gutter,
|
||||
fg = c.orange,
|
||||
}
|
||||
hl.TelescopePreviewTitle = {
|
||||
bg = c.bg_dark,
|
||||
fg = c.bg_dark,
|
||||
}
|
||||
hl.TelescopeResultsTitle = {
|
||||
bg = c.bg_dark,
|
||||
fg = c.bg_dark,
|
||||
}
|
||||
end,
|
||||
})
|
||||
tokyonight.load()
|
||||
end,
|
||||
}
|
@@ -1,23 +1,115 @@
|
||||
local M = {
|
||||
run = ":TSUpdate",
|
||||
event = "User PackerDefered",
|
||||
requires = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
"RRethy/nvim-treesitter-textsubjects",
|
||||
"nvim-treesitter/nvim-treesitter-refactor",
|
||||
},
|
||||
run = ":TSUpdate",
|
||||
event = "User PackerDefered",
|
||||
module = "nvim-treesitter",
|
||||
requires = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
"RRethy/nvim-treesitter-textsubjects",
|
||||
"nvim-treesitter/nvim-treesitter-refactor",
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"css",
|
||||
"go",
|
||||
"lua",
|
||||
},
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
})
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"css",
|
||||
"go",
|
||||
"lua",
|
||||
"vim",
|
||||
"help",
|
||||
"fish",
|
||||
"gitignore",
|
||||
},
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = false },
|
||||
context_commentstring = { enable = true, enable_autocmd = false },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-n>",
|
||||
node_incremental = "<C-n>",
|
||||
scope_incremental = "<C-s>",
|
||||
node_decremental = "<C-r>",
|
||||
},
|
||||
},
|
||||
refactor = {
|
||||
smart_rename = {
|
||||
enable = true,
|
||||
client = {
|
||||
smart_rename = "<leader>cr",
|
||||
},
|
||||
},
|
||||
navigation = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
-- goto_definition = "gd",
|
||||
-- list_definitions = "gnD",
|
||||
-- list_definitions_toc = "gO",
|
||||
-- goto_next_usage = "<a-*>",
|
||||
-- goto_previous_usage = "<a-#>",
|
||||
},
|
||||
},
|
||||
},
|
||||
query_linter = {
|
||||
enable = true,
|
||||
use_virtual_text = true,
|
||||
lint_events = { "BufWrite", "CursorHold" },
|
||||
},
|
||||
textsubjects = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
["."] = "textsubjects-smart",
|
||||
[";"] = "textsubjects-container-outer",
|
||||
},
|
||||
},
|
||||
playground = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||
persist_queries = true, -- Whether the query persists across vim sessions
|
||||
keybindings = {
|
||||
toggle_query_editor = "o",
|
||||
toggle_hl_groups = "i",
|
||||
toggle_injected_languages = "t",
|
||||
toggle_anonymous_nodes = "a",
|
||||
toggle_language_display = "I",
|
||||
focus_language = "f",
|
||||
unfocus_language = "F",
|
||||
update = "R",
|
||||
goto_node = "<cr>",
|
||||
show_help = "?",
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.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" },
|
||||
},
|
||||
lsp_interop = {
|
||||
enable = true,
|
||||
peek_definition_code = {
|
||||
["gD"] = "@function.outer",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
|
21
lua/plugins/windows.lua
Normal file
21
lua/plugins/windows.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
local M = {
|
||||
event = "User PackerDefered",
|
||||
requires = {
|
||||
{ "anuvyklack/middleclass", module = "middleclass" },
|
||||
{ "anuvyklack/animation.nvim", module = "animation" },
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
vim.o.winwidth = 5
|
||||
vim.o.winminwidth = 5
|
||||
vim.o.equalalways = false
|
||||
require("windows").setup({
|
||||
animation = {
|
||||
duration = 150,
|
||||
},
|
||||
})
|
||||
vim.keymap.set("n", "<leader>Z", "<Cmd>WindowsMaximize<CR>")
|
||||
end
|
||||
|
||||
return M
|
Reference in New Issue
Block a user