init
This commit is contained in:
129
lua/plugins/configs/cmp.lua
Normal file
129
lua/plugins/configs/cmp.lua
Normal file
@@ -0,0 +1,129 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/configs/cmp.lua
|
||||
-- Description: cmp configuration
|
||||
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
|
||||
local cmp = require "cmp"
|
||||
|
||||
require("nvim-autopairs").setup {
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = { "string" }, -- it will not add a pair on that treesitter node
|
||||
javascript = { "template_string" },
|
||||
java = false, -- Don't check treesitter on java
|
||||
},
|
||||
|
||||
-- Don't add pairs if it already has a close pair in the same line
|
||||
enable_check_bracket_line = false,
|
||||
|
||||
-- Don't add pairs if the next char is alphanumeric
|
||||
ignored_next_char = "[%w%.]", -- will ignore alphanumeric and `.` symbol
|
||||
fast_wrap = {},
|
||||
disable_filetype = { "TelescopePrompt", "vim" },
|
||||
}
|
||||
|
||||
-- setup cmp for autopairs
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
local function border(hl_name)
|
||||
return {
|
||||
{ "╭", hl_name },
|
||||
{ "─", hl_name },
|
||||
{ "╮", hl_name },
|
||||
{ "│", hl_name },
|
||||
{ "╯", hl_name },
|
||||
{ "─", hl_name },
|
||||
{ "╰", hl_name },
|
||||
{ "│", hl_name },
|
||||
}
|
||||
end
|
||||
|
||||
local options = {
|
||||
completion = {
|
||||
completeopt = "menu,menuone",
|
||||
},
|
||||
|
||||
window = {
|
||||
completion = {
|
||||
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel",
|
||||
scrollbar = false,
|
||||
},
|
||||
documentation = {
|
||||
border = border "CmpDocBorder",
|
||||
winhighlight = "Normal:CmpDoc",
|
||||
},
|
||||
},
|
||||
|
||||
snippet = {
|
||||
expand = function(args) require("luasnip").lsp_expand(args.body) end,
|
||||
},
|
||||
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = require("lspkind").cmp_format {
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
mode = "symbol_text",
|
||||
symbol_map = {},
|
||||
},
|
||||
},
|
||||
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = 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 {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
},
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{
|
||||
name = "buffer",
|
||||
option = {
|
||||
-- Avoid accidentally running on big files
|
||||
get_bufnrs = function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf))
|
||||
if byte_size > 1024 * 1024 then -- 1 Megabyte max
|
||||
return {}
|
||||
end
|
||||
return { buf }
|
||||
end,
|
||||
},
|
||||
},
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
},
|
||||
}
|
||||
cmp.setup(options)
|
||||
57
lua/plugins/configs/gitsigns.lua
Normal file
57
lua/plugins/configs/gitsigns.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/configs/gitsigns.lua
|
||||
-- Description: Gitsigns configuration
|
||||
return {
|
||||
signs = {
|
||||
add = {
|
||||
text = " ",
|
||||
},
|
||||
change = {
|
||||
text = " ",
|
||||
},
|
||||
delete = {
|
||||
text = " ",
|
||||
},
|
||||
topdelete = {
|
||||
text = " ",
|
||||
},
|
||||
changedelete = {
|
||||
text = " ",
|
||||
},
|
||||
},
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true,
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = "eol", -- "eol" | "overlay" | "right_align"
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000,
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = "single",
|
||||
style = "minimal",
|
||||
relative = "cursor",
|
||||
row = 0,
|
||||
col = 1,
|
||||
},
|
||||
}
|
||||
43
lua/plugins/configs/image.lua
Normal file
43
lua/plugins/configs/image.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
return
|
||||
{
|
||||
|
||||
require("image").setup({
|
||||
backend = "kitty",
|
||||
processor = "magick_cli", -- or "magick_rock"
|
||||
integrations = {
|
||||
markdown = {
|
||||
enabled = true,
|
||||
clear_in_insert_mode = false,
|
||||
download_remote_images = true,
|
||||
only_render_image_at_cursor = false,
|
||||
only_render_image_at_cursor_mode = "inline",
|
||||
floating_windows = false, -- if true, images will be rendered in floating markdown windows
|
||||
filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
|
||||
},
|
||||
neorg = {
|
||||
enabled = true,
|
||||
filetypes = { "norg" },
|
||||
},
|
||||
typst = {
|
||||
enabled = true,
|
||||
filetypes = { "typst" },
|
||||
},
|
||||
html = {
|
||||
enabled = false,
|
||||
},
|
||||
css = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
max_width = 300,
|
||||
max_height = 12,
|
||||
max_width_window_percentage = math.huge,
|
||||
max_height_window_percentage = math.huge,
|
||||
window_overlap_clear_enabled = false, -- toggles images when windows are overlapped
|
||||
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "snacks_notif", "scrollview", "scrollview_sign" },
|
||||
editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus
|
||||
tmux_show_only_in_active_window = false, -- auto show/hide images in the correct Tmux window (needs visual-activity off)
|
||||
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened
|
||||
})
|
||||
|
||||
}
|
||||
106
lua/plugins/configs/lspconfig.lua
Normal file
106
lua/plugins/configs/lspconfig.lua
Normal file
@@ -0,0 +1,106 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/configs/lspconfig.lua
|
||||
-- Description: LSP setup and config
|
||||
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
|
||||
local merge_tables = require("utils").merge_tables
|
||||
|
||||
local exist, custom = pcall(require, "custom")
|
||||
local custom_formatting_servers = exist and type(custom) == "table" and custom.formatting_servers or {}
|
||||
local formatting_servers = {
|
||||
jsonls = {},
|
||||
dockerls = {},
|
||||
bashls = {},
|
||||
gopls = {},
|
||||
ruff_lsp = {},
|
||||
vimls = {},
|
||||
yamlls = {},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Merge
|
||||
merge_tables(formatting_servers, custom_formatting_servers)
|
||||
|
||||
local opts = {
|
||||
-- Automatically format on save
|
||||
autoformat = true,
|
||||
-- options for vim.lsp.buf.format
|
||||
-- `bufnr` and `filter` is handled by the LazyVim formatter,
|
||||
-- but can be also overridden when specified
|
||||
format = {
|
||||
formatting_options = nil,
|
||||
timeout_ms = nil,
|
||||
},
|
||||
-- LSP Server Settings
|
||||
servers = formatting_servers,
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don"t want this server to be setup with lspconfig
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
-- tsserver = function(_, opts)
|
||||
-- require("typescript").setup({ server = opts })
|
||||
-- return true
|
||||
-- end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
}
|
||||
|
||||
local servers = opts.servers
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
local function setup(server)
|
||||
local server_opts = vim.tbl_deep_extend("force", {
|
||||
capabilities = vim.deepcopy(capabilities),
|
||||
}, servers[server] or {})
|
||||
|
||||
if opts.setup[server] then
|
||||
if opts.setup[server](server, server_opts) then return end
|
||||
elseif opts.setup["*"] then
|
||||
if opts.setup["*"](server, server_opts) then return end
|
||||
end
|
||||
require("lspconfig")[server].setup(server_opts)
|
||||
end
|
||||
|
||||
local mlsp = require "mason-lspconfig"
|
||||
local available = mlsp.get_available_servers()
|
||||
|
||||
local ensure_installed = {} ---@type string[]
|
||||
for server, server_opts in pairs(servers) do
|
||||
if server_opts then
|
||||
server_opts = server_opts == true and {} or server_opts
|
||||
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
|
||||
if server_opts.mason == false or not vim.tbl_contains(available, server) then
|
||||
setup(server)
|
||||
else
|
||||
ensure_installed[#ensure_installed + 1] = server
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup {
|
||||
ensure_installed = ensure_installed,
|
||||
automatic_installation = true,
|
||||
}
|
||||
328
lua/plugins/configs/lualine.lua
Normal file
328
lua/plugins/configs/lualine.lua
Normal file
@@ -0,0 +1,328 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/configs/lualine.lua
|
||||
-- Description: Pacman config for lualine
|
||||
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
|
||||
-- Credit: shadmansaleh & his evil theme: https://github.com/nvim-lualine/lualine.nvim/blob/master/examples/evil_lualine.lua
|
||||
local lualine = require "lualine"
|
||||
local lualine_require = require "lualine_require"
|
||||
local utils = require "utils"
|
||||
|
||||
local function loadcolors()
|
||||
-- Rose-pine palette
|
||||
local rosepine = require "rose-pine.palette"
|
||||
local colors = {
|
||||
bg = rosepine.base,
|
||||
fg = rosepine.text,
|
||||
yellow = rosepine.gold,
|
||||
cyan = rosepine.foam,
|
||||
black = rosepine.subtled,
|
||||
green = rosepine.pine,
|
||||
white = rosepine.text,
|
||||
magenta = rosepine.iris,
|
||||
blue = rosepine.rose,
|
||||
red = rosepine.love,
|
||||
}
|
||||
|
||||
-- Try to load pywal colors
|
||||
local modules = lualine_require.lazy_require {
|
||||
utils_notices = "lualine.utils.notices",
|
||||
}
|
||||
local sep = package.config:sub(1, 1)
|
||||
local wal_colors_path = table.concat({ os.getenv "HOME", ".cache", "wal", "colors.sh" }, sep)
|
||||
local wal_colors_file = io.open(wal_colors_path, "r")
|
||||
|
||||
if wal_colors_file == nil then
|
||||
modules.utils_notices.add_notice("lualine.nvim: " .. wal_colors_path .. " not found")
|
||||
return colors
|
||||
end
|
||||
|
||||
local ok, wal_colors_text = pcall(wal_colors_file.read, wal_colors_file, "*a")
|
||||
wal_colors_file:close()
|
||||
|
||||
if not ok then
|
||||
modules.utils_notices.add_notice(
|
||||
"lualine.nvim: " .. wal_colors_path .. " could not be read: " .. wal_colors_text
|
||||
)
|
||||
return colors
|
||||
end
|
||||
|
||||
local wal = {}
|
||||
|
||||
for line in vim.gsplit(wal_colors_text, "\n") do
|
||||
if line:match "^[a-z0-9]+='#[a-fA-F0-9]+'$" ~= nil then
|
||||
local i = line:find "="
|
||||
local key = line:sub(0, i - 1)
|
||||
local value = line:sub(i + 2, #line - 1)
|
||||
wal[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
-- Color table for highlights
|
||||
colors = {
|
||||
bg = wal.background,
|
||||
fg = wal.foreground,
|
||||
yellow = wal.color3,
|
||||
cyan = wal.color4,
|
||||
black = wal.color0,
|
||||
green = wal.color2,
|
||||
white = wal.color7,
|
||||
magenta = wal.color5,
|
||||
blue = wal.color6,
|
||||
red = wal.color1,
|
||||
}
|
||||
|
||||
return colors
|
||||
end
|
||||
|
||||
local colors = loadcolors()
|
||||
|
||||
local conditions = {
|
||||
buffer_not_empty = function() return vim.fn.empty(vim.fn.expand "%:t") ~= 1 end,
|
||||
hide_in_width = function() return vim.fn.winwidth(0) > 80 end,
|
||||
check_git_workspace = function()
|
||||
local filepath = vim.fn.expand "%:p:h"
|
||||
local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
||||
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||
end,
|
||||
}
|
||||
|
||||
-- Config
|
||||
local config = {
|
||||
options = {
|
||||
-- Disable sections and component separators
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
disabled_filetypes = { "Lazy", "NvimTree" },
|
||||
theme = {
|
||||
-- We are going to use lualine_c an lualine_x as left and
|
||||
-- right section. Both are highlighted by c theme . So we
|
||||
-- are just setting default looks o statusline
|
||||
normal = {
|
||||
c = {
|
||||
fg = colors.fg,
|
||||
bg = colors.bg,
|
||||
},
|
||||
},
|
||||
inactive = {
|
||||
c = {
|
||||
fg = colors.fg,
|
||||
bg = colors.bg,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
-- These will be filled later
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
inactive_sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {
|
||||
{
|
||||
"buffers",
|
||||
max_length = vim.o.columns * 2 / 3,
|
||||
show_filename_only = false,
|
||||
mode = 0, -- 0: Shows buffer name
|
||||
-- 1: Shows buffer index
|
||||
-- 2: Shows buffer name + buffer index
|
||||
-- 3: Shows buffer number
|
||||
-- 4: Shows buffer name + buffer number
|
||||
|
||||
right_padding = 5,
|
||||
left_padding = 5,
|
||||
|
||||
-- Automatically updates active buffer color to match color of other components (will be overidden if buffers_color is set)
|
||||
use_mode_colors = true,
|
||||
buffers_color = {
|
||||
-- Same values as the general color option can be used here.
|
||||
active = {
|
||||
fg = colors.fg,
|
||||
bg = colors.bg,
|
||||
gui = "bold",
|
||||
}, -- Color for active buffer.
|
||||
inactive = {
|
||||
fg = utils.darken(colors.fg, 0.3),
|
||||
bg = utils.darken(colors.bg, 0.3),
|
||||
}, -- Color for inactive buffer.
|
||||
},
|
||||
symbols = {
|
||||
modified = " ●", -- Text to show when the buffer is modified
|
||||
alternate_file = "", -- Text to show to identify the alternate file
|
||||
directory = "", -- Text to show when the buffer is a directory
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
extensions = {
|
||||
"nvim-tree",
|
||||
"mason",
|
||||
"fzf",
|
||||
},
|
||||
}
|
||||
|
||||
-- Inserts a component in lualine_c at left section
|
||||
local function ins_left(component) table.insert(config.sections.lualine_c, component) end
|
||||
|
||||
-- Inserts a component in lualine_x ot right section
|
||||
local function ins_right(component) table.insert(config.sections.lualine_x, component) end
|
||||
|
||||
ins_left {
|
||||
-- mode component
|
||||
function() return "" end,
|
||||
color = function()
|
||||
-- auto change color according to neovims mode
|
||||
local mode_color = {
|
||||
n = colors.fg,
|
||||
i = colors.green,
|
||||
v = colors.blue,
|
||||
[""] = colors.blue,
|
||||
V = colors.blue,
|
||||
c = colors.magenta,
|
||||
no = colors.red,
|
||||
s = colors.yellow,
|
||||
S = colors.yellow,
|
||||
[""] = colors.yellow,
|
||||
ic = colors.yellow,
|
||||
R = colors.white,
|
||||
Rv = colors.white,
|
||||
cv = colors.red,
|
||||
ce = colors.red,
|
||||
r = colors.cyan,
|
||||
rm = colors.cyan,
|
||||
["r?"] = colors.cyan,
|
||||
["!"] = colors.red,
|
||||
t = colors.red,
|
||||
}
|
||||
return {
|
||||
fg = mode_color[vim.fn.mode()],
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
ins_left {
|
||||
"branch",
|
||||
icon = " ",
|
||||
color = {
|
||||
fg = colors.magenta,
|
||||
gui = "bold",
|
||||
},
|
||||
}
|
||||
|
||||
ins_left {
|
||||
"diff",
|
||||
-- Is it me or the symbol for modified us really weird
|
||||
symbols = { added = " ", modified = " ", removed = " " },
|
||||
diff_color = {
|
||||
added = {
|
||||
fg = colors.green,
|
||||
},
|
||||
modified = {
|
||||
fg = colors.yellow,
|
||||
},
|
||||
removed = {
|
||||
fg = colors.red,
|
||||
},
|
||||
},
|
||||
cond = conditions.hide_in_width,
|
||||
}
|
||||
|
||||
-- Insert mid section. You can make any number of sections in neovim :)
|
||||
-- for lualine it"s any number greater then 2
|
||||
ins_left { function() return "%=" end }
|
||||
|
||||
ins_right {
|
||||
-- Lsp server name .
|
||||
function()
|
||||
local msg = "null"
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then return msg end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then return client.name end
|
||||
end
|
||||
return msg
|
||||
end,
|
||||
icon = " LSP:",
|
||||
color = {
|
||||
fg = colors.cyan,
|
||||
gui = "bold",
|
||||
},
|
||||
}
|
||||
|
||||
ins_right {
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
symbols = {
|
||||
error = " ",
|
||||
warn = " ",
|
||||
info = " ",
|
||||
hints = " ",
|
||||
},
|
||||
diagnostics_color = {
|
||||
color_error = {
|
||||
fg = colors.red,
|
||||
},
|
||||
color_warn = {
|
||||
fg = colors.yellow,
|
||||
},
|
||||
color_info = {
|
||||
fg = colors.cyan,
|
||||
},
|
||||
color_hints = {
|
||||
fg = colors.magenta,
|
||||
},
|
||||
},
|
||||
always_visible = false,
|
||||
}
|
||||
|
||||
ins_right {
|
||||
"fileformat",
|
||||
fmt = string.upper,
|
||||
icons_enabled = true,
|
||||
color = {
|
||||
fg = colors.green,
|
||||
gui = "bold",
|
||||
},
|
||||
}
|
||||
|
||||
ins_right {
|
||||
"location",
|
||||
color = {
|
||||
fg = colors.fg,
|
||||
gui = "bold",
|
||||
},
|
||||
}
|
||||
|
||||
ins_right {
|
||||
"progress",
|
||||
color = {
|
||||
fg = colors.fg,
|
||||
gui = "bold",
|
||||
},
|
||||
}
|
||||
|
||||
-- Now don"t forget to initialize lualine
|
||||
lualine.setup(config)
|
||||
33
lua/plugins/configs/luasnip.lua
Normal file
33
lua/plugins/configs/luasnip.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/configs/luasnsip.lua
|
||||
-- Description: luasnip configuration
|
||||
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
|
||||
-- vscode format
|
||||
require("luasnip.loaders.from_vscode").lazy_load { exclude = vim.g.vscode_snippets_exclude or {} }
|
||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
|
||||
|
||||
-- snipmate format
|
||||
require("luasnip.loaders.from_snipmate").load()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
|
||||
|
||||
-- lua format
|
||||
require("luasnip.loaders.from_lua").load()
|
||||
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
callback = function()
|
||||
if
|
||||
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
and not require("luasnip").session.jump_active
|
||||
then
|
||||
require("luasnip").unlink_current()
|
||||
end
|
||||
end,
|
||||
})
|
||||
40
lua/plugins/configs/mason.lua
Normal file
40
lua/plugins/configs/mason.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/configs/mason.lua
|
||||
-- Description: mason
|
||||
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
|
||||
return {
|
||||
{ "mason-org/mason.nvim", version = "*" },
|
||||
{ "mason-org/mason-lspconfig.nvim", version = "*" },
|
||||
"neovim/nvim-lspconfig",
|
||||
|
||||
require("mason").setup {
|
||||
PATH = "prepend",
|
||||
ui = {
|
||||
icons = {
|
||||
package_pending = " ",
|
||||
package_installed = " ",
|
||||
package_uninstalled = " ",
|
||||
},
|
||||
|
||||
keymaps = {
|
||||
toggle_server_expand = "<CR>",
|
||||
install_server = "i",
|
||||
update_server = "u",
|
||||
check_server_version = "c",
|
||||
update_all_servers = "U",
|
||||
check_outdated_servers = "C",
|
||||
uninstall_server = "X",
|
||||
cancel_installation = "<C-c>",
|
||||
},
|
||||
},
|
||||
|
||||
max_concurrent_installers = 10,
|
||||
},
|
||||
}
|
||||
22
lua/plugins/configs/null-ls.lua
Normal file
22
lua/plugins/configs/null-ls.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/configs/null-ls.lua
|
||||
-- Description: null-ls configuration
|
||||
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
|
||||
local null_ls = require "null-ls"
|
||||
|
||||
-- Load custom configurations
|
||||
local exist, custom = pcall(require, "custom")
|
||||
local sources = exist and type(custom) == "table" and custom.setup_sources and custom.setup_sources(null_ls.builtins)
|
||||
or {}
|
||||
|
||||
null_ls.setup {
|
||||
debug = false,
|
||||
sources = sources,
|
||||
}
|
||||
33
lua/plugins/configs/telescope.lua
Normal file
33
lua/plugins/configs/telescope.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/configs/telescope.lua
|
||||
-- Description: nvim-telescope config
|
||||
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
|
||||
return {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
sorting_strategy = "ascending",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
preview_width = 0.55,
|
||||
},
|
||||
width = 0.87,
|
||||
height = 0.80,
|
||||
},
|
||||
mappings = {
|
||||
n = { ["q"] = require("telescope.actions").close },
|
||||
},
|
||||
},
|
||||
|
||||
extensions_list = { "themes", "terms" },
|
||||
extensions = {},
|
||||
}
|
||||
85
lua/plugins/configs/tree.lua
Normal file
85
lua/plugins/configs/tree.lua
Normal file
@@ -0,0 +1,85 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/configs/tree.lua
|
||||
-- Description: nvim-tree config
|
||||
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
|
||||
return {
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
hijack_cursor = true,
|
||||
hijack_unnamed_buffer_when_opening = false,
|
||||
sync_root_with_cwd = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = false,
|
||||
},
|
||||
view = {
|
||||
adaptive_size = false,
|
||||
side = "left",
|
||||
width = 30,
|
||||
preserve_window_proportions = true,
|
||||
},
|
||||
git = {
|
||||
enable = false,
|
||||
ignore = true,
|
||||
},
|
||||
filesystem_watchers = {
|
||||
enable = true,
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
resize_window = true,
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
root_folder_label = false,
|
||||
highlight_git = false,
|
||||
highlight_opened_files = "none",
|
||||
|
||||
indent_markers = {
|
||||
enable = false,
|
||||
},
|
||||
|
||||
icons = {
|
||||
show = {
|
||||
file = true,
|
||||
folder = true,
|
||||
folder_arrow = true,
|
||||
git = false,
|
||||
},
|
||||
|
||||
glyphs = {
|
||||
default = "",
|
||||
symlink = "",
|
||||
folder = {
|
||||
default = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
arrow_open = "",
|
||||
arrow_closed = "",
|
||||
},
|
||||
git = {
|
||||
unstaged = "✗",
|
||||
staged = "✓",
|
||||
unmerged = "",
|
||||
renamed = "➜",
|
||||
untracked = "★",
|
||||
deleted = "",
|
||||
ignored = "◌",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
56
lua/plugins/configs/treesitter.lua
Normal file
56
lua/plugins/configs/treesitter.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/configs/treesitter.lua
|
||||
-- Description: nvim-treesitter configuration
|
||||
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
|
||||
|
||||
-- Load custom configurations
|
||||
local exist, custom = pcall(require, "custom")
|
||||
local ensure_installed = exist and type(custom) == "table" and custom.ensure_installed or {}
|
||||
|
||||
return {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = {
|
||||
"go",
|
||||
"python",
|
||||
"dockerfile",
|
||||
"json",
|
||||
"yaml",
|
||||
"markdown",
|
||||
"html",
|
||||
"scss",
|
||||
"css",
|
||||
"vim",
|
||||
"lua",
|
||||
ensure_installed,
|
||||
},
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false,
|
||||
},
|
||||
refactor = {
|
||||
highlight_definitions = {
|
||||
enable = true,
|
||||
},
|
||||
highlight_current_scope = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
316
lua/plugins/init.lua
Normal file
316
lua/plugins/init.lua
Normal file
@@ -0,0 +1,316 @@
|
||||
--
|
||||
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
--
|
||||
-- File: plugins/init.lua
|
||||
-- Description: init plugins config
|
||||
|
||||
-- Built-in plugins
|
||||
local builtin_plugins = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
-- File explore
|
||||
-- nvim-tree.lua - A file explorer tree for neovim written in lua
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
opt = true,
|
||||
},
|
||||
opts = function() require "plugins.configs.tree" end,
|
||||
},
|
||||
-- Formatter
|
||||
-- Lightweight yet powerful formatter plugin for Neovim
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
formatters_by_ft = { lua = { "stylua" } },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
'kmontocam/nvim-conda',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' }
|
||||
},
|
||||
|
||||
|
||||
-- Git integration for buffers
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPost", "BufNewFile", "BufWritePost" },
|
||||
opts = function() require "plugins.configs.gitsigns" end,
|
||||
},
|
||||
|
||||
-- in your `plugins.lua` (lazy.nvim)
|
||||
{
|
||||
"goerz/jupytext.nvim",
|
||||
version = "0.2.0",
|
||||
opts = {
|
||||
format = "markdown", -- or "hydrogen" style etc.
|
||||
autosync = true,
|
||||
sync_patterns = { "*.md", "*.py" },
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
-- see the image.nvim readme for more information about configuring this plugin
|
||||
"3rd/image.nvim",
|
||||
build = false,
|
||||
opts = {
|
||||
processor = "magick_cli",
|
||||
integrations = {
|
||||
markdown = {
|
||||
enabled = true,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
opts = function() require "plugins.configs.image" end,
|
||||
},
|
||||
|
||||
{
|
||||
"benlubas/molten-nvim",
|
||||
version = "^2.0.0", -- use version <2.0.0 to avoid breaking changes
|
||||
dependencies = { "3rd/image.nvim" },
|
||||
build = ":UpdateRemotePlugins",
|
||||
init = function()
|
||||
-- these are examples, not defaults. Please see the readme
|
||||
vim.g.molten_image_provider = "image.nvim"
|
||||
vim.g.molten_output_win_max_height = 20
|
||||
end,
|
||||
},
|
||||
|
||||
-- Treesitter interface
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
version = false, -- last release is way too old and doesn't work on Windows
|
||||
evevent = { "BufReadPost", "BufNewFile", "BufWritePost" },
|
||||
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
|
||||
build = ":TSUpdate",
|
||||
opts = function() require "plugins.configs.treesitter" end,
|
||||
},
|
||||
-- Telescope
|
||||
-- Find, Filter, Preview, Pick. All lua, all the time.
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
},
|
||||
},
|
||||
cmd = "Telescope",
|
||||
config = function(_)
|
||||
require("telescope").setup()
|
||||
-- To get fzf loaded and working with telescope, you need to call
|
||||
-- load_extension, somewhere after setup function:
|
||||
require("telescope").load_extension "fzf"
|
||||
require "plugins.configs.telescope"
|
||||
end,
|
||||
},
|
||||
-- Statusline
|
||||
-- A blazing fast and easy to configure neovim statusline plugin written in pure lua.
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
opts = function() require "plugins.configs.lualine" end,
|
||||
},
|
||||
-- colorscheme
|
||||
{
|
||||
-- Rose-pine - Soho vibes for Neovim
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
opts = {
|
||||
dark_variant = "main",
|
||||
},
|
||||
},
|
||||
-- LSP stuffs
|
||||
-- Portable package manager for Neovim that runs everywhere Neovim runs.
|
||||
-- Easily install and manage LSP servers, DAP servers, linters, and formatters.
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
|
||||
config = function() require "plugins.configs.mason" end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { "nvimtools/none-ls-extras.nvim" },
|
||||
lazy = true,
|
||||
config = function() require "plugins.configs.null-ls" end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = "VimEnter",
|
||||
lazy = false,
|
||||
config = function() require "plugins.configs.lspconfig" end,
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
{
|
||||
-- snippet plugin
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
|
||||
config = function(_, opts)
|
||||
require("luasnip").config.set_config(opts)
|
||||
require "plugins.configs.luasnip"
|
||||
end,
|
||||
},
|
||||
|
||||
-- autopairing of (){}[] etc
|
||||
{ "windwp/nvim-autopairs" },
|
||||
|
||||
{
|
||||
"xiyaowong/transparent.nvim",
|
||||
lazy = false, -- ensure it runs at startup
|
||||
opts = {}, -- you can pass `groups` / `extra_groups` / `excludes` here
|
||||
},
|
||||
|
||||
{
|
||||
'tidalcycles/vim-tidal',
|
||||
lazy = false
|
||||
},
|
||||
{ 'lervag/vimtex' },
|
||||
{ 'neovim/nvim-lspconfig' },
|
||||
{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
|
||||
{ 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim' } },
|
||||
{ 'neovim/nvim-lspconfig' },
|
||||
|
||||
|
||||
|
||||
|
||||
-- cmp sources plugins
|
||||
{
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"onsails/lspkind.nvim",
|
||||
},
|
||||
},
|
||||
opts = function() require "plugins.configs.cmp" end,
|
||||
},
|
||||
-- Colorizer
|
||||
{
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
config = function(_)
|
||||
require("colorizer").setup()
|
||||
|
||||
-- execute colorizer as soon as possible
|
||||
vim.defer_fn(function() require("colorizer").attach_to_buffer(0) end, 0)
|
||||
end,
|
||||
},
|
||||
-- Keymappings
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function() require("which-key").setup() end,
|
||||
},
|
||||
}
|
||||
|
||||
local exist, custom = pcall(require, "custom")
|
||||
local custom_plugins = exist and type(custom) == "table" and custom.plugins or {}
|
||||
|
||||
-- Check if there is any custom plugins
|
||||
-- local ok, custom_plugins = pcall(require, "plugins.custom")
|
||||
require("lazy").setup {
|
||||
spec = { builtin_plugins, custom_plugins },
|
||||
lockfile = vim.fn.stdpath "config" .. "/lazy-lock.json", -- lockfile generated after running update.
|
||||
defaults = {
|
||||
lazy = false, -- should plugins be lazy-loaded?
|
||||
version = nil,
|
||||
-- version = "*", -- enable this to try installing the latest stable versions of plugins
|
||||
},
|
||||
ui = {
|
||||
icons = {
|
||||
ft = "",
|
||||
lazy = "",
|
||||
loaded = "",
|
||||
not_loaded = "",
|
||||
},
|
||||
},
|
||||
install = {
|
||||
-- install missing plugins on startup
|
||||
missing = true,
|
||||
-- try to load one of these colorschemes when starting an installation during startup
|
||||
colorscheme = { "rose-pine", "habamax" },
|
||||
},
|
||||
checker = {
|
||||
-- automatically check for plugin updates
|
||||
enabled = true,
|
||||
-- get a notification when new updates are found
|
||||
-- disable it as it's too annoying
|
||||
notify = false,
|
||||
-- check for updates every day
|
||||
frequency = 86400,
|
||||
},
|
||||
change_detection = {
|
||||
-- automatically check for config file changes and reload the ui
|
||||
enabled = true,
|
||||
-- get a notification when changes are found
|
||||
-- disable it as it's too annoying
|
||||
notify = false,
|
||||
},
|
||||
performance = {
|
||||
cache = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
state = vim.fn.stdpath "state" .. "/lazy/state.json", -- state info for checker and other things
|
||||
}
|
||||
|
||||
|
||||
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = { 'latex', 'bibtex', 'comment' },
|
||||
highlight = { enable = true },
|
||||
}
|
||||
|
||||
|
||||
local nvim_lsp = require('lspconfig')
|
||||
nvim_lsp.texlab.setup {
|
||||
settings = {
|
||||
texlab = {
|
||||
auxDirectory = "", -- optionally set build dir
|
||||
build = {
|
||||
executable = "latexmk",
|
||||
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
|
||||
onSave = true, -- build on save
|
||||
},
|
||||
forwardSearch = {
|
||||
executable = "zathura",
|
||||
args = { "--synctex-forward", "%l:1:%f", "%p" },
|
||||
},
|
||||
chktex = { onOpen = false, onEdit = false }, -- optional lint settings
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Basic nvim-cmp setup (LSP completion)
|
||||
local cmp = require('cmp')
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args) require('luasnip').lsp_expand(args.body) end,
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
},
|
||||
mapping = require('cmp').mapping.preset.insert({
|
||||
['<C-Space>'] = require('cmp').mapping.complete(),
|
||||
['<CR>'] = require('cmp').mapping.confirm({ select = true }),
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user