This commit is contained in:
Manuel
2025-08-25 17:42:37 +02:00
commit aed2435b50
31 changed files with 2269 additions and 0 deletions

64
lua/autocmds.lua Normal file
View File

@@ -0,0 +1,64 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: autocmds.lua
-- Description: Autocommand functions
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
-- Define autocommands with Lua APIs
-- See: h:api-autocmd, h:augroup
local autocmd = vim.api.nvim_create_autocmd -- Create autocommand
-- General settings
-- Highlight on yank
autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank {
higroup = "IncSearch",
timeout = "1000",
}
end,
})
-- Remove whitespace on save
autocmd("BufWritePre", {
pattern = "",
command = ":%s/\\s\\+$//e",
})
-- Auto format on save using the attached (optionally filtered) language servere clients
-- https://neovim.io/doc/user/lsp.html#vim.lsp.buf.format()
autocmd("BufWritePre", {
pattern = "",
command = ":silent lua vim.lsp.buf.format()",
})
-- Don"t auto commenting new lines
autocmd("BufEnter", {
pattern = "",
command = "set fo-=c fo-=r fo-=o",
})
autocmd("Filetype", {
pattern = { "xml", "html", "xhtml", "css", "scss", "javascript", "typescript", "yaml", "lua" },
command = "setlocal shiftwidth=2 tabstop=2",
})
-- Set colorcolumn
autocmd("Filetype", {
pattern = { "python", "rst", "c", "cpp" },
command = "set colorcolumn=80",
})
autocmd("Filetype", {
pattern = { "gitcommit", "markdown", "text" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})

85
lua/mappings.lua Normal file
View File

@@ -0,0 +1,85 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: mappings.lua
-- Description: Key mapping configs
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
-- <leader> is a space now
local map = vim.keymap.set
local cmd = vim.cmd
vim.keymap.set("n", "<leader>b", ":Telescope buffers<CR>", { noremap = true, silent = true })
map("n", "<S-Tab>", ":bprevious<CR>", { noremap = true, silent = true })
map("n", "<Tab>", ":bnext<CR>", { noremap = true, silent = true })
map("n", "<leader>q", ":qa!<CR>", {})
-- Fast saving with <leader> and s
map("n", "<leader>s", ":w<CR>", {})
-- Move around splits
map("n", "<leader>wh", "<C-w>h", { desc = "switch window left" })
map("n", "<leader>wj", "<C-w>j", { desc = "switch window right" })
map("n", "<leader>wk", "<C-w>k", { desc = "switch window up" })
map("n", "<leader>wl", "<C-w>l", { desc = "switch window down" })
-- Reload configuration without restart nvim
-- Or you don't want to use plenary.nvim, you can use this code
-- function _G.reload_config()
-- for name, _ in pairs(package.loaded) do
-- if name:match("^me") then
-- package.loaded[name] = nil
-- end
-- end
-- dofile(vim.env.MYVIMRC)
-- vim.notify("Nvim configuration reloaded!", vim.log.levels.INFO)
-- end
function _G.reload_config()
local reload = require("plenary.reload").reload_module
reload("me", false)
dofile(vim.env.MYVIMRC)
vim.notify("Nvim configuration reloaded!", vim.log.levels.INFO)
end
map("n", "rr", _G.reload_config, { desc = "Reload configuration without restart nvim" })
-- Telescope
local builtin = require "telescope.builtin"
map("n", "<leader>ff", builtin.find_files, { desc = "Open Telescope to find files" })
map("n", "<leader>fg", builtin.live_grep, { desc = "Open Telescope to do live grep" })
map("n", "<leader>fb", builtin.buffers, { desc = "Open Telescope to list buffers" })
map("n", "<leader>fh", builtin.help_tags, { desc = "Open Telescope to show help" })
map("n", "<leader>fo", builtin.oldfiles, { desc = "Open Telescope to list recent files" })
map("n", "<leader>cm", builtin.git_commits, { desc = "Open Telescope to list git commits" })
-- NvimTree
map("n", "<leader>n", ":NvimTreeToggle<CR>", { desc = "Toggle NvimTree sidebar" }) -- open/close
map("n", "<leader>nr", ":NvimTreeRefresh<CR>", { desc = "Refresh NvimTree" }) -- refresh
map("n", "<leader>nf", ":NvimTreeFindFile<CR>", { desc = "Search file in NvimTree" }) -- search file
-- LSP
map(
"n",
"<leader>gm",
function() require("conform").format { lsp_fallback = true } end,
{ desc = "General Format file" }
)
-- global lsp mappings
map("n", "<leader>ds", vim.diagnostic.setloclist, { desc = "LSP Diagnostic loclist" })
-- Comment
map("n", "mm", "gcc", { desc = "Toggle comment", remap = true })
map("v", "mm", "gc", { desc = "Toggle comment", remap = true })
-- Terminal
map("n", "tt", function()
local height = math.floor(vim.o.lines / 2)
cmd("belowright split | resize " .. height .. " | terminal")
end, { noremap = true, silent = true })

163
lua/options.lua Normal file
View File

@@ -0,0 +1,163 @@
--
-- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
-- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
-- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
-- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
-- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
-- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
--
-- File: options.lua
-- Description: General Neovim settings and configuration
-- Author: Kien Nguyen-Tuan <kiennt2609@gmail.com>
local cmd = vim.cmd
-- Set options (global/buffer/windows-scoped)
local opt = vim.opt
-- Global variables
local g = vim.g
local indent = 4
g.mapleader = " "
cmd [[
filetype plugin indent on
]]
opt.backspace = { "eol", "start", "indent" } -- allow backspacing over everything in insert mode
opt.clipboard = "unnamedplus" -- allow neovim to access the system clipboard
opt.fileencoding = "utf-8" -- the encoding written to a file
opt.encoding = "utf-8" -- the encoding
opt.matchpairs = { "(:)", "{:}", "[:]", "<:>" }
opt.syntax = "enable"
-- indention
opt.autoindent = true -- auto indentation
opt.expandtab = true -- convert tabs to spaces
opt.shiftwidth = indent -- the number of spaces inserted for each indentation
opt.smartindent = true -- make indenting smarter
opt.softtabstop = indent -- when hitting <BS>, pretend like a tab is removed, even if spaces
opt.tabstop = indent -- insert 2 spaces for a tab
opt.shiftround = true -- use multiple of shiftwidth when indenting with "<" and ">"
-- tabline
opt.showtabline = 2 -- always show tabs
opt.sessionoptions = "curdir,folds,globals,help,tabpages,terminal,winsize"
-- search
opt.hlsearch = true -- highlight all matches on previous search pattern
opt.ignorecase = true -- ignore case in search patterns
opt.smartcase = true -- smart case
opt.wildignore = opt.wildignore + { "*/node_modules/*", "*/.git/*", "*/vendor/*" }
opt.wildmenu = true -- make tab completion for files/buffers act like bash
-- ui
opt.cursorline = true -- highlight the current line
opt.laststatus = 2 -- only the last window will always have a status line
opt.lazyredraw = true -- don"t update the display while executing macros
opt.list = true
-- You can also add "space" or "eol", but I feel it"s quite annoying
opt.listchars = {
tab = "",
trail = "·",
extends = "»",
precedes = "«",
nbsp = "×",
}
-- Hide cmd line
opt.cmdheight = 0 -- more space in the neovim command line for displaying messages
opt.mouse = "a" -- allow the mouse to be used in neovim
opt.number = true -- set numbered lines
opt.scrolloff = 0 -- minimal number of screen lines to keep above and below the cursor
opt.sidescrolloff = 3 -- minimal number of screen columns to keep to the left and right (horizontal) of the cursor if wrap is `false`
opt.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time
opt.splitbelow = true -- open new split below
opt.splitright = true -- open new split to the right
opt.wrap = true -- display a wrapped line
-- backups
opt.backup = false -- create a backup file
opt.swapfile = false -- creates a swapfile
opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
-- autocomplete
opt.completeopt = { "menu", "menuone", "noselect" } -- mostly just for cmp
opt.shortmess = opt.shortmess + {
c = true,
} -- hide all the completion messages, e.g. "-- XXX completion (YYY)", "match 1 of 2", "The only match", "Pattern not found"
-- By the way, -- INSERT -- is unnecessary anymore because the mode information is displayed in the statusline.
opt.showmode = false
-- perfomance
-- remember N lines in history
opt.history = 100 -- keep 100 lines of history
opt.redrawtime = 1500
opt.timeoutlen = 250 -- time to wait for a mapped sequence to complete (in milliseconds)
opt.ttimeoutlen = 10
opt.updatetime = 100 -- signify default updatetime 4000ms is not good for async update
-- theme
opt.termguicolors = true -- enable 24-bit RGB colors
-- persistent undo
-- Don"t forget to create folder $HOME/.local/share/nvim/undo
local undodir = vim.fn.stdpath "data" .. "/undo"
opt.undofile = true -- enable persistent undo
opt.undodir = undodir
opt.undolevels = 1000
opt.undoreload = 10000
-- fold
opt.foldmethod = "marker"
opt.foldlevel = 99
-- Disable builtin plugins
local disabled_built_ins = {
"2html_plugin",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
}
for _, plugin in pairs(disabled_built_ins) do
g["loaded_" .. plugin] = 1
end
-- Colorscheme
-- By default, use rose-pine
cmd.colorscheme "rose-pine"
-- Enable virtual_lines feature if the current nvim version is 0.11+
if vim.fn.has "nvim-0.11" > 0 then
vim.diagnostic.config {
-- Use the default configuration
virtual_lines = true,
-- Alternatively, customize specific options
-- virtual_lines = {
-- -- Only show virtual line diagnostics for the current cursor line
-- current_line = true,
-- },
}
end

129
lua/plugins/configs/cmp.lua Normal file
View 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)

View 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,
},
}

View 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
})
}

View 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,
}

View 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)

View 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,
})

View 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,
},
}

View 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,
}

View 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 = {},
}

View 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 = "",
},
},
},
},
}

View 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
View 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 }),
})
})

56
lua/sample_custom.lua Normal file
View File

@@ -0,0 +1,56 @@
local M = {}
-- add extra plugins here
M.plugins = {
{ "Shatur/neovim-ayu" },
{ 'tidalcycles/vim-tidal' },
{ 'lervag/vimtex' },
{ 'neovim/nvim-lspconfig' },
{ 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim' } },
{ 'jremmen/vim-ripgrep' }, -- or use ripgrep CLI
{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
{
"xiyaowong/transparent.nvim",
lazy = false, -- ensure it runs at startup
opts = {}, -- you can pass `groups` / `extra_groups` / `excludes` here
},
{
"dccsillag/magma-nvim",
build = ":UpdateRemotePlugins",
ft = { "python", "julia" },
config = function()
require("magma").setup {}
end
}
}
-- add extra configuration options here, like extra autocmds etc.
-- feel free to create your own separate files and require them in here
M.configs = function() require("ayu").colorscheme() end
-- add servers to be used for auto formatting here
M.formatting_servers = {
rust_analyzer = {},
lua_ls = {},
}
-- add Tree-sitter to auto-install
M.ensure_installed = { "toml" }
-- add any null-ls sources you want here
M.setup_sources = function(b)
return {
b.formatting.autopep8,
b.formatting.prettier.with {
extra_filetypes = { "toml" },
extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" },
},
b.formatting.black.with {
extra_args = { "--fast" },
},
b.formatting.stylua,
}
end
return M

46
lua/utils.lua Normal file
View File

@@ -0,0 +1,46 @@
local M = {}
M.merge_tables = function(t1, t2)
if type(t1) ~= "table" or type(t2) ~= "table" then return end
for k, v in pairs(t2) do
t1[k] = v
end
end
M.lighten = function(hex, factor)
-- Remove # if present
hex = hex:gsub("#", "")
-- Convert hex to RGB
local r = tonumber(hex:sub(1, 2), 16)
local g = tonumber(hex:sub(3, 4), 16)
local b = tonumber(hex:sub(5, 6), 16)
-- Apply lighten factor
r = math.min(255, math.floor(r + (255 - r) * factor))
g = math.min(255, math.floor(g + (255 - g) * factor))
b = math.min(255, math.floor(b + (255 - b) * factor))
-- Convert back to hex
return string.format("#%02X%02X%02X", r, g, b)
end
M.darken = function(hex, factor)
-- Remove # if present
hex = hex:gsub("#", "")
-- Convert hex to RGB
local r = tonumber(hex:sub(1, 2), 16)
local g = tonumber(hex:sub(3, 4), 16)
local b = tonumber(hex:sub(5, 6), 16)
-- Apply darken factor
r = math.max(0, math.floor(r * (1 - factor)))
g = math.max(0, math.floor(g * (1 - factor)))
b = math.max(0, math.floor(b * (1 - factor)))
-- Convert back to hex
return string.format("#%02X%02X%02X", r, g, b)
end
return M