add: update config v2.1.0

This commit is contained in:
asep.komarudin 2024-05-20 08:42:59 +07:00
parent 63de9b2074
commit 90a34ec6e9
41 changed files with 2492 additions and 1287 deletions

View file

@ -0,0 +1,10 @@
return {
"SmiteshP/nvim-navic",
lazy = true,
dependencies = "neovim/nvim-lspconfig",
event = "InsertEnter",
config = function()
require("user.breadcrumb")
require("user.winbar")
end,
}

168
lua/plugins/bufferline.lua Normal file
View file

@ -0,0 +1,168 @@
return {
"akinsho/bufferline.nvim",
branch = "main",
event = { "BufRead", "InsertEnter", "BufNewFile" },
config = function()
local status_ok, bufferline = pcall(require, "bufferline")
if not status_ok then
return
end
local icons = require("user.icons")
local use_icons = true
-- get folder name from current directory
local _get_folder_name = function()
local str = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
return " " .. icons.ui.ProjekFolder .. " " .. str:lower():gsub("^%l", string.upper) .. " "
end
local function diagnostics_indicator(num, _, diagnostics, _)
local result = {}
local symbols = {
error = icons.diagnostics.Error,
warning = icons.diagnostics.Warning,
info = icons.diagnostics.Information,
}
if not use_icons then
return "(" .. num .. ")"
end
for name, count in pairs(diagnostics) do
if symbols[name] and count > 0 then
table.insert(result, symbols[name] .. " " .. count)
end
end
result = table.concat(result, " ")
return #result > 0 and result or ""
end
vim.opt.termguicolors = true
bufferline.setup({
options = {
color_icons = true,
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
close_command = function(bufnum)
require("user.utils").bufremove(bufnum)
end,
right_mouse_command = function(bufnum)
require("user.utils").bufremove(bufnum)
end,
-- close_command = "bdelete! %d",
-- right_mouse_command = "bdelete! %d",
left_mouse_command = "buffer %d",
middle_mouse_command = nil,
indicator_icon = nil,
indicator = { style = "icon", icon = icons.ui.BoldLineLeft },
buffer_close_icon = icons.ui.Close,
modified_icon = icons.ui.Circle,
close_icon = icons.ui.BoldClose,
left_trunc_marker = icons.ui.ArrowCircleLeft,
right_trunc_marker = icons.ui.ArrowCircleRight,
max_name_length = 30,
max_prefix_length = 30,
tab_size = 21,
diagnostics = false, -- | "nvim_lsp" | "coc",
diagnostics_update_in_insert = false,
diagnostics_indicator = diagnostics_indicator,
offsets = {
{
filetype = "NvimTree",
text = _get_folder_name(),
highlight = "Directory",
text_align = "left",
padding = 1,
},
{
filetype = "neo-tree",
text = _get_folder_name(),
highlight = "Directory",
text_align = "left",
padding = 1,
},
},
show_buffer_icons = true,
show_buffer_close_icons = true,
show_close_icon = true,
show_tab_indicators = true,
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
separator_style = { "", "" }, -- | "thick" | "thin" | { 'any', 'any' },
enforce_regular_tabs = true,
always_show_bufferline = true,
},
highlights = {
background = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "none", highlight = "TabLine" },
},
buffer_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "none", highlight = "TabLine" },
},
close_button = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "none", highlight = "TabLine" },
},
close_button_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "none", highlight = "TabLine" },
},
tab_selected = {
fg = { attribute = "fg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},
tab = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
tab_close = {
-- fg = {attribute='fg',highlight='LspDiagnosticsDefaultError'},
fg = { attribute = "fg", highlight = "TabLineSel" },
bg = { attribute = "bg", highlight = "Normal" },
},
duplicate_selected = {
fg = { attribute = "fg", highlight = "TabLineSel" },
bg = { attribute = "bg", highlight = "TabLineSel" },
underline = true,
},
duplicate_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
underline = true,
},
duplicate = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
underline = true,
},
modified = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
modified_selected = {
fg = { attribute = "fg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},
modified_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
separator = {
fg = { attribute = "bg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
separator_selected = {
fg = { attribute = "bg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},
indicator_selected = {
fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
bg = { attribute = "bg", highlight = "Normal" },
},
},
})
end,
}

View file

@ -0,0 +1,58 @@
local rfile = {
java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
python = "python3 -u",
--typescript = "deno run",
typescript = "ts-node $dir/$fileName", -- npm install -g ts-node
rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt",
-- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt"
cpp = "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css",
javascript = 'node "$dir/$fileName"',
}
local data_exists, runscript = pcall(require, "core.config")
if data_exists then
if runscript.coderunner ~= nil then
rfile = vim.tbl_deep_extend("force", runscript.coderunner, rfile)
end
end
return {
"CRAG666/code_runner.nvim",
lazy = true,
cmd = { "RunCode", "RunFile", "RunProject", "RunClose" },
opts = {
-- put here the commands by filetype
filetype = rfile,
-- mode = "term",
mode = "float",
focus = true,
startinsert = true,
term = {
--position = "vert",
position = "bot",
size = 50,
},
float = {
-- Key that close the code_runner floating window
close_key = "<ESC>",
-- Window border (see ':h nvim_open_win')
border = "rounded",
-- Num from `0 - 1` for measurements
height = 0.8,
width = 0.8,
x = 0.5,
y = 0.5,
-- Highlight group for floating window/border (see ':h winhl')
border_hl = "FloatBorder",
float_hl = "Normal",
-- Transparency (see ':h winblend')
blend = 0,
},
},
config = function(_, opts)
require("code_runner").setup(opts)
end,
}

25
lua/plugins/colorizer.lua Normal file
View file

@ -0,0 +1,25 @@
return {
"NvChad/nvim-colorizer.lua",
lazy = true,
event = { "BufRead", "InsertEnter", "BufNewFile" },
opts = {
user_default_options = {
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
names = true, -- "Name" codes like Blue
RRGGBBAA = true, -- #RRGGBBAA hex codes
rgb_fn = true, -- CSS rgb() and rgba() functions
hsl_fn = true, -- CSS hsl() and hsla() functions
css = true, -- 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
mode = "background", -- Set the display mode.
tailwind = true,
},
filetypes = {
"*", -- Highlight all files, but customize some others.
css = { rgb_fn = true }, -- Enable parsing rgb(...) functions in css.
html = { names = false }, -- Disable parsing "names" like Blue or Gray
},
},
}

View file

@ -250,7 +250,9 @@ return {
["@keyword"] = { fg = colors.pink, italic = true },
["@keyword.function"] = { fg = colors.cyan, italic = true },
["@function"] = { fg = colors.green, italic = true },
["@tag.javascript"] = { fg = colors.cyan },
["@tag.attribute"] = { fg = colors.green, italic = true },
-- ["@tag.attribute.javascript"] = { fg = colors.orange, italic = true },
NvimTreeFolderIcon = { fg = "#6776a7" },
CmpItemAbbr = { fg = "#ABB2BF" },
CmpItemKind = { fg = "#ABB2BF" },
@ -259,17 +261,18 @@ return {
htmlLink = { fg = "#BD93F9", underline = false },
Underlined = { fg = "#8BE9FD" },
NvimTreeSpecialFile = { fg = "#FF79C6" },
MatchParen = { fg = "#F8F8F2" },
SpellBad = { fg = "#FF6E6E" },
illuminatedWord = { bg = "#3b4261" },
illuminatedCurWord = { bg = "#3b4261" },
IlluminatedWordText = { bg = "#3b4261" },
IlluminatedWordRead = { bg = "#3b4261" },
IlluminatedWordWrite = { bg = "#3b4261" },
StatusLine = { fg = "#f8f8f2", bg = colors.bg },
StatusLineTerm = { fg = "#f8f8f2", bg = colors.bg },
DiffChange = { fg = colors.fg },
StatusLine = { fg = colors.fg, bg = colors.bg },
StatusLineTerm = { fg = colors.fg, bg = colors.bg },
BufferLineFill = { bg = colors.bg },
Pmenu = { fg = colors.white, bg = colors.bg },
Pmenu = { fg = colors.fg, bg = colors.bg },
WinBarNC = { fg = colors.fg, bg = colors.bg },
},
transparent_bg = transparent,
-- transparent_bg = is_transparent,
@ -317,7 +320,7 @@ return {
-- "eyeliner",
"fidget",
-- "flash",
-- "gitsigns",
"gitsigns",
-- "harpoon",
-- "hop",
"illuminate",
@ -333,7 +336,7 @@ return {
"nvim-navic",
"nvim-tree",
"nvim-web-devicons",
-- "rainbow-delimiters",
"rainbow-delimiters",
-- "sneak",
"telescope",
-- "trouble",
@ -344,6 +347,7 @@ return {
BufferLineFill = { bg = colors.bg },
StatusLine = { fg = "#f8f8f2", bg = colors.bg },
StatusLineTerm = { fg = "#f8f8f2", bg = colors.bg },
WinBarNC = { fg = colors.fg, bg = colors.bg },
},
})
end,
@ -464,6 +468,7 @@ return {
-- UfoPreviewNormal = { fg = "#373d48", bg = "$bg0" },
-- UfoPreviewBorder = { fg = "#373d48", bg = "$bg0" },
-- UfoPreviewCursorLine = { fg = "#373d48", bg = "$bg0" },
WinBarNC = { fg = "$fg", bg = "NONE" },
},
transparent = transparent,
lualine = {

12
lua/plugins/comment.lua Normal file
View file

@ -0,0 +1,12 @@
return {
"numToStr/Comment.nvim",
lazy = true,
opts = function()
return {
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
}
end,
config = function(_, opts)
require("Comment").setup(opts)
end,
}

22
lua/plugins/dap.lua Normal file
View file

@ -0,0 +1,22 @@
return {
{
"rcarriga/nvim-dap-ui",
lazy = true,
event = "BufRead",
dependencies = "mfussenegger/nvim-dap",
enabled = vim.fn.has("win32") == 0,
config = function()
require("user.dapui")
end,
},
{
"jay-babu/mason-nvim-dap.nvim",
lazy = true,
event = "BufRead",
dependencies = { "williamboman/mason.nvim", "mfussenegger/nvim-dap" },
enabled = vim.fn.has("win32") == 0,
config = function()
require("user.mason_dap")
end,
},
}

34
lua/plugins/dressing.lua Normal file
View file

@ -0,0 +1,34 @@
return {
"stevearc/dressing.nvim",
lazy = true,
init = function()
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.select = function(...)
require("lazy").load({ plugins = { "dressing.nvim" } })
return vim.ui.select(...)
end
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.input = function(...)
require("lazy").load({ plugins = { "dressing.nvim" } })
return vim.ui.input(...)
end
end,
opts = {
input = {
title_pos = "center",
relative = "editor",
default_prompt = "",
win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" },
prefer_width = 30,
max_width = { 140, 0.9 },
min_width = { 50, 0.2 },
},
select = {
backend = { "telescope", "builtin" },
builtin = { win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" } },
},
},
config = function(_, opts)
require("dressing").setup(opts)
end,
}

75
lua/plugins/gitsigns.lua Normal file
View file

@ -0,0 +1,75 @@
local icons = require("user.icons")
return {
"lewis6991/gitsigns.nvim",
lazy = true,
enabled = vim.fn.executable("git") == 1,
ft = "gitcommit",
event = "BufRead",
opts = {
signs = {
add = {
hl = "GitSignsAdd",
text = icons.ui.BoldLineLeft,
numhl = "GitSignsAddNr",
linehl = "GitSignsAddLn",
},
change = {
hl = "GitSignsChange",
text = icons.ui.BoldLineLeft,
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
delete = {
hl = "GitSignsDelete",
text = icons.ui.Triangle,
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
topdelete = {
hl = "GitSignsDelete",
text = icons.ui.Triangle,
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
changedelete = {
hl = "GitSignsChange",
text = icons.ui.BoldLineLeft,
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
},
signcolumn = true,
numhl = false,
linehl = false,
word_diff = false,
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,
},
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
sign_priority = 6,
status_formatter = nil, -- Use default
update_debounce = 200,
max_file_length = 40000,
preview_config = {
-- Options passed to nvim_open_win
border = "rounded",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
yadm = { enable = false },
},
config = function(_, opts)
require("gitsigns").setup(opts)
end,
}

View file

@ -0,0 +1,39 @@
return {
"lukas-reineke/indent-blankline.nvim",
-- version = "3.5.4",
event = { "BufRead", "InsertEnter", "BufNewFile" },
lazy = true,
opts = {
indent = {
char = "",
tab_char = "",
},
scope = { enabled = false },
exclude = {
buftypes = {
"nofile",
"prompt",
"quickfix",
"terminal",
},
filetypes = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
"NvimTree",
"aerial",
"neogitstatus",
"startify",
},
},
},
main = "ibl",
}

279
lua/plugins/lualine.lua Normal file
View file

@ -0,0 +1,279 @@
return {
{
"nvim-lualine/lualine.nvim",
event = { "InsertEnter", "BufRead", "BufNewFile" },
config = function()
local hide_in_width = function()
return vim.fn.winwidth(0) > 80
end
local icons = require("user.icons")
local getLeftSubstring = function(word, length)
if #word > length then
return string.sub(word, 1, length) .. "..."
else
return word
end
end
-- start for lsp
local list_registered_providers_names = function(filetype)
local s = require("null-ls.sources")
local available_sources = s.get_available(filetype)
local registered = {}
for _, source in ipairs(available_sources) do
for method in pairs(source.methods) do
registered[method] = registered[method] or {}
table.insert(registered[method], source.name)
end
end
return registered
end
local null_ls = require("null-ls")
-- for formatter
local list_registered = function(filetype)
local method = null_ls.methods.FORMATTING
local registered_providers = list_registered_providers_names(filetype)
return registered_providers[method] or {}
end
--- for linter
local alternative_methods = {
null_ls.methods.DIAGNOSTICS,
null_ls.methods.DIAGNOSTICS_ON_OPEN,
null_ls.methods.DIAGNOSTICS_ON_SAVE,
}
local linter_list_registered = function(filetype)
local registered_providers = list_registered_providers_names(filetype)
local providers_for_methods = vim.iter(vim.tbl_map(function(m)
return registered_providers[m] or {}
end, alternative_methods))
return providers_for_methods
end
-- end for lsp
local lsp_info = {
function()
local msg = "LS Inactive"
local buf_ft = vim.bo.filetype
-- start register
local buf_clients = {}
buf_clients = vim.lsp.get_clients({ bufnr = 0 })
local buf_client_names = {}
if next(buf_clients) == nil then
-- TODO: clean up this if statement
if type(msg) == "boolean" or #msg == 0 then
return "LSP Inactive"
end
return msg
end
-- add client
for _, client in pairs(buf_clients) do
if client.name ~= "null-ls" and client.name ~= "copilot" then
table.insert(buf_client_names, client.name)
end
end
-- add formatter
local supported_formatters = list_registered(buf_ft)
vim.list_extend(buf_client_names, supported_formatters)
-- add linter
local supported_linters = linter_list_registered(buf_ft)
vim.list_extend(buf_client_names, supported_linters)
-- decomple
local unique_client_names = vim.fn.uniq(buf_client_names)
local msg = table.concat(unique_client_names, ", ")
return msg
end,
icon = icons.ui.Gear .. "",
padding = 1,
}
local diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
sections = { "error", "warn" },
symbols = {
error = icons.diagnostics.BoldError .. " ",
warn = icons.diagnostics.BoldWarning .. " ",
},
colored = true,
update_in_insert = false,
always_visible = false,
}
local diff = {
"diff",
colored = true,
symbols = {
added = icons.git.LineAdded .. " ",
modified = icons.git.LineModified .. " ",
removed = icons.git.LineRemoved .. " ",
},
cond = hide_in_width,
}
local spaces = function()
return icons.ui.Tab .. " " .. vim.api.nvim_get_option_value(0, "shiftwidth")
end
local mode = {
"mode",
padding = 1,
separator = { left = "" },
fmt = function(str)
return icons.ui.Neovim .. " " .. str
end,
}
local get_branch = function()
if vim.b.gitsigns_head ~= nil then
return icons.git.Branch2 .. " " .. getLeftSubstring(vim.b.gitsigns_head, 6)
else
return icons.git.Branch2 .. vim.fn.fnamemodify("", ":t")
end
end
local lsp_progress = {}
local data_ok, lspprogress = pcall(require, "lsp-progress")
if data_ok then
lsp_progress = lspprogress.progress
end
local colors = {
blue = "#50fa7b",
cyan = "#f1fa8c",
black = "#1a1b26",
black_transparant = "none",
white = "#c6c6c6",
red = "#ff757f",
skyblue_1 = "#bd93f9",
grey = "#5f6a8e",
yellow = "#ffb86c",
fg_gutter = "#3b4261",
green1 = "#bd93f9",
}
-- check config for theme
local set_theme
local bubbles_theme = {}
local data_exists, config = pcall(require, "core.config")
if data_exists then
if config.colorscheme ~= nil then
local color = config.colorscheme
switch(color, {
["tokyonight"] = function()
set_theme = "auto"
end,
["tokyonight-night"] = function()
set_theme = "auto"
end,
["tokyonight-storm"] = function()
set_theme = "auto"
end,
["tokyonight-day"] = function()
set_theme = "auto"
end,
["tokyonight-moon"] = function()
set_theme = "auto"
end,
["dracula"] = function()
local clr = require("dracula").colors()
colors.blue = clr.green
colors.black = clr.black
colors.cyan = clr.yellow
set_theme = bubbles_theme
end,
default = function()
set_theme = "auto"
end,
})
end
end
bubbles_theme = {
normal = {
a = { fg = colors.black, bg = colors.skyblue_1 },
b = { fg = colors.white, bg = colors.grey },
c = { fg = colors.white, bg = colors.black_transparant },
},
insert = {
a = { fg = colors.black, bg = colors.blue },
b = { fg = colors.blue, bg = colors.grey },
},
visual = {
a = { fg = colors.black, bg = colors.cyan },
b = { fg = colors.cyan, bg = colors.grey },
},
replace = {
a = { bg = colors.red, fg = colors.black },
b = { bg = colors.fg_gutter, fg = colors.red },
},
command = {
a = { bg = colors.yellow, fg = colors.black },
b = { bg = colors.fg_gutter, fg = colors.yellow },
},
terminal = {
a = { bg = colors.green1, fg = colors.black },
b = { bg = colors.fg_gutter, fg = colors.green1 },
},
inactive = {
a = { fg = colors.white, bg = colors.black_transparant },
b = { fg = colors.white, bg = colors.black_transparant },
c = { fg = colors.black, bg = colors.black_transparant },
},
}
if set_theme == "auto" then
bubbles_theme = vim.fn.fnamemodify("auto", ":t")
end
require("lualine").setup({
options = {
theme = bubbles_theme,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {
"TelescopePrompt",
"packer",
"alpha",
"dashboard",
"NvimTree",
"Outline",
"DressingInput",
"toggleterm",
"lazy",
"mason",
"neo-tree",
"startuptime",
},
always_divide_middle = true,
},
sections = {
lualine_a = {
mode,
},
lualine_b = { get_branch },
lualine_c = { lsp_info, diagnostics, lsp_progress },
lualine_x = { diff, spaces, "filetype" },
lualine_y = { "progress" },
lualine_z = {
{ "location", separator = { right = "" }, padding = 1 },
},
},
inactive_sections = {
lualine_a = { "filename" },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = { "location" },
},
tabline = {},
extensions = {},
})
end,
},
}

View file

@ -0,0 +1,8 @@
return {
"karb94/neoscroll.nvim",
event = "VeryLazy",
lazy = true,
config = function()
require("neoscroll").setup()
end,
}

31
lua/plugins/notify.lua Normal file
View file

@ -0,0 +1,31 @@
return {
"rcarriga/nvim-notify",
lazy = true,
event = "VeryLazy",
keys = {
{
"<leader>un",
function()
require("notify").dismiss({ silent = true, pending = true })
end,
desc = "Delete all Notifications",
},
},
opts = {
timeout = 3000,
max_height = function()
return math.floor(vim.o.lines * 0.75)
end,
max_width = function()
return math.floor(vim.o.columns * 0.75)
end,
},
-- event = "BufWinEnter",
config = function()
local notify = require("notify")
-- this for transparency
notify.setup({ background_colour = "#000000" })
-- this overwrites the vim notify function
vim.notify = notify.notify
end,
}

229
lua/plugins/nvimtree.lua Normal file
View file

@ -0,0 +1,229 @@
local icons = require("user.icons")
return {
"kyazdani42/nvim-tree.lua",
lazy = true,
cmd = { "NvimTree", "NvimTreeOpen", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" },
opts = {
auto_reload_on_write = false,
disable_netrw = false,
hijack_cursor = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
sort_by = "name",
root_dirs = {},
prefer_startup_root = false,
sync_root_with_cwd = true,
reload_on_bufenter = false,
respect_buf_cwd = false,
on_attach = "default",
select_prompts = false,
view = {
adaptive_size = false,
centralize_selection = true,
width = 30,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
float = {
enable = false,
quit_on_focus_loss = true,
open_win_config = {
relative = "editor",
border = "rounded",
width = 30,
height = 30,
row = 1,
col = 1,
},
},
},
renderer = {
add_trailing = false,
group_empty = false,
highlight_git = true,
full_name = false,
highlight_opened_files = "none",
-- root_folder_label = ":t",
root_folder_label = false,
indent_width = 2,
indent_markers = {
enable = true,
inline_arrows = true,
icons = {
corner = "",
edge = "",
item = "",
none = " ",
},
},
icons = {
webdev_colors = true,
git_placement = "before",
padding = " ",
symlink_arrow = "",
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
},
glyphs = {
default = icons.ui.Text,
symlink = icons.ui.FileSymlink,
bookmark = icons.ui.BookMark,
folder = {
-- arrow_closed = icons.ui.TriangleShortArrowRight,
arrow_closed = icons.ui.ChevronShortRight,
-- arrow_open = icons.ui.TriangleShortArrowDown,
arrow_open = icons.ui.ChevronShortDown,
default = icons.ui.Folder,
open = icons.ui.FolderOpen,
empty = icons.ui.EmptyFolder,
empty_open = icons.ui.EmptyFolderOpen,
symlink = icons.ui.FolderSymlink,
symlink_open = icons.ui.FolderOpen,
},
git = {
unstaged = icons.git.FileUnstaged,
staged = icons.git.FileStaged,
unmerged = icons.git.FileUnmerged,
renamed = icons.git.FileRenamed,
untracked = icons.git.FileUntracked,
deleted = icons.git.FileDeleted,
ignored = icons.git.FileIgnored,
},
},
},
special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
symlink_destination = true,
},
hijack_directories = {
enable = false,
auto_open = true,
},
update_focused_file = {
enable = true,
debounce_delay = 15,
update_root = true,
ignore_list = {},
},
diagnostics = {
enable = true,
show_on_dirs = false,
show_on_open_dirs = true,
debounce_delay = 50,
severity = {
min = vim.diagnostic.severity.HINT,
max = vim.diagnostic.severity.ERROR,
},
icons = {
hint = icons.diagnostics.BoldHint,
info = icons.diagnostics.BoldInformation,
warning = icons.diagnostics.BoldWarning,
error = icons.diagnostics.BoldError,
},
},
filters = {
dotfiles = false,
git_clean = false,
no_buffer = false,
custom = { "node_modules", "\\.cache", "\\.git" },
exclude = {
".gitignore",
".prettierignore",
},
},
filesystem_watchers = {
enable = true,
debounce_delay = 50,
ignore_dirs = {},
},
git = {
enable = true,
ignore = false,
show_on_dirs = true,
show_on_open_dirs = true,
disable_for_dirs = {},
timeout = 400,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
restrict_above_cwd = false,
},
expand_all = {
max_folder_discovery = 300,
exclude = {},
},
file_popup = {
open_win_config = {
col = 1,
row = 1,
relative = "cursor",
border = "shadow",
style = "minimal",
},
},
open_file = {
quit_on_open = false,
resize_window = false,
window_picker = {
enable = true,
picker = "default",
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "lazy", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
remove_file = {
close_window = true,
},
},
trash = {
cmd = "trash",
require_confirm = true,
},
live_filter = {
prefix = "[FILTER]: ",
always_show_folders = true,
},
tab = {
sync = {
open = false,
close = false,
ignore = {},
},
},
notify = {
threshold = vim.log.levels.INFO,
-- threshold = vim.log.levels.ERROR,
},
log = {
enable = false,
truncate = false,
types = {
all = false,
config = false,
copy_paste = false,
dev = false,
diagnostics = false,
git = false,
profile = false,
watcher = false,
},
},
system_open = {
cmd = nil,
args = {},
},
},
config = function(_, opts)
require("nvim-tree").setup(opts)
end,
}

4
lua/plugins/plenary.lua Normal file
View file

@ -0,0 +1,4 @@
return {
"nvim-lua/plenary.nvim",
lazy = true,
}

View file

@ -0,0 +1,36 @@
return {
"hiphish/rainbow-delimiters.nvim",
lazy = true,
event = "BufRead",
config = function()
-- Modul ini berisi beberapa definisi default
local rainbow_delimiters = require("rainbow-delimiters")
vim.g.rainbow_delimiters = {
strategy = {
[""] = rainbow_delimiters.strategy["global"],
vim = rainbow_delimiters.strategy["local"],
},
query = {
[""] = "rainbow-delimiters",
lua = "rainbow-blocks",
},
priority = {
[""] = 110,
lua = 210,
},
highlight = {
"RainbowDelimiterRed",
"RainbowDelimiterYellow",
"RainbowDelimiterBlue",
"RainbowDelimiterOrange",
"RainbowDelimiterGreen",
"RainbowDelimiterViolet",
"RainbowDelimiterCyan",
},
blacklist = {
"html",
"tsx",
},
}
end,
}

View file

@ -0,0 +1,13 @@
return {
"dstein64/nvim-scrollview",
lazy = true,
event = { "BufRead", "InsertEnter", "BufNewFile" },
opts = {
bg = "LightCyan",
ctermbg = 160,
},
config = function(_, opts)
require("scrollview").setup(opts)
vim.g.scrollview_excluded_filetypes = { "NvimTree", "vista_kind", "Outline", "neo-tree" }
end,
}

View file

@ -0,0 +1,21 @@
return {
"mrjones2014/smart-splits.nvim",
lazy = true,
event = { "BufRead", "InsertEnter", "BufNewFile" },
opts = {
ignored_filetypes = {
"nofile",
"quickfix",
"qf",
"prompt",
},
ignored_buftypes = { "nofile" },
},
config = function(_, opts)
require("smart-splits").setup(opts)
vim.keymap.set("n", "<C-Left>", require("smart-splits").resize_left)
vim.keymap.set("n", "<C-Down>", require("smart-splits").resize_down)
vim.keymap.set("n", "<C-Up", require("smart-splits").resize_up)
vim.keymap.set("n", "<C-Right>", require("smart-splits").resize_right)
end,
}

25
lua/plugins/snippets.lua Normal file
View file

@ -0,0 +1,25 @@
return {
{
"rafamadriz/friendly-snippets",
event = "InsertEnter",
lazy = true,
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
require("user.snippets")
require("user.snip")
end,
},
{
"L3MON4D3/LuaSnip",
lazy = true,
opts = {
history = true,
delete_check_events = "TextChanged",
},
-- stylua: ignore
keys = {
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
},
},
}

View file

@ -0,0 +1 @@
return { "dstein64/vim-startuptime", lazy = true, cmd = "StartupTime" }

172
lua/plugins/telescope.lua Normal file
View file

@ -0,0 +1,172 @@
return {
"nvim-telescope/telescope.nvim",
lazy = true,
cmd = "Telescope",
version = false,
opts = function()
local actions = require("telescope.actions")
vim.g.theme_switcher_loaded = true
return {
defaults = {
vimgrep_arguments = {
"rg",
"-L",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = "",
selection_caret = "",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "smart" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = 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,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
extensions_list = { "themes", "terms" },
pickers = {
find_files = {
hidden = true,
},
live_grep = {
--@usage don't include the filename in the search results
only_sort_text = true,
},
grep_string = {
only_sort_text = true,
},
buffers = {
initial_mode = "normal",
mappings = {
i = {
["<C-d>"] = actions.delete_buffer,
},
n = {
["dd"] = actions.delete_buffer,
},
},
},
planets = {
show_pluto = true,
show_moon = true,
},
git_files = {
hidden = true,
show_untracked = true,
},
colorscheme = {
enable_preview = true,
},
},
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-c>"] = actions.close,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<C-l>"] = actions.complete_tag,
["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
},
n = {
["<esc>"] = actions.close,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["j"] = actions.move_selection_next,
["k"] = actions.move_selection_previous,
["H"] = actions.move_to_top,
["M"] = actions.move_to_middle,
["L"] = actions.move_to_bottom,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["?"] = actions.which_key,
},
},
}
end,
config = function(_, opts)
require("telescope").setup(opts)
-- load extensions
pcall(function()
for _, ext in ipairs(opts.extensions_list) do
require("telescope").load_extension(ext)
end
end)
end,
}

View file

@ -0,0 +1,49 @@
return {
"akinsho/toggleterm.nvim",
lazy = true,
cmd = {
"ToggleTerm",
"TermExec",
"ToggleTermToggleAll",
"ToggleTermSendCurrentLine",
"ToggleTermSendVisualLines",
"ToggleTermSendVisualSelection",
},
branch = "main",
enabled = true,
opts = {
size = 20,
open_mapping = [[<c-\>]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
shading_factor = 2,
start_in_insert = true,
insert_mappings = true,
persist_size = true,
direction = "float",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
winblend = 0,
highlights = {
border = "Normal",
background = "Normal",
},
},
},
config = function(_, opts)
require("toggleterm").setup(opts)
function _G.set_terminal_keymaps()
local optsn = { noremap = true }
vim.api.nvim_buf_set_keymap(0, "t", "<esc>", [[<C-\><C-n>]], optsn)
vim.api.nvim_buf_set_keymap(0, "t", "jk", [[<C-\><C-n>]], optsn)
vim.api.nvim_buf_set_keymap(0, "t", "<C-h>", [[<C-\><C-n><C-W>h]], optsn)
vim.api.nvim_buf_set_keymap(0, "t", "<C-j>", [[<C-\><C-n><C-W>j]], optsn)
vim.api.nvim_buf_set_keymap(0, "t", "<C-k>", [[<C-\><C-n><C-W>k]], optsn)
vim.api.nvim_buf_set_keymap(0, "t", "<C-l>", [[<C-\><C-n><C-W>l]], optsn)
end
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
end,
}

189
lua/plugins/treesitter.lua Normal file
View file

@ -0,0 +1,189 @@
return {
{
"nvim-treesitter/nvim-treesitter",
dependencies = {
{
"JoosepAlviste/nvim-ts-context-commentstring",
lazy = true,
config = function()
require("ts_context_commentstring").setup({
enable_autocmd = false,
})
end,
},
{
"windwp/nvim-autopairs",
lazy = true,
dependencies = "hrsh7th/nvim-cmp",
event = "InsertEnter",
opts = {
check_ts = true,
ts_config = {
lua = { "string", "source" },
javascript = { "string", "template_string" },
java = false,
},
disable_filetype = { "TelescopePrompt", "spectre_panel" },
fast_wrap = {
map = "<M-e>",
chars = { "{", "[", "(", '"', "'", "`" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, -- Offset from pattern match
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "PmenuSel",
highlight_grey = "LineNr",
},
},
config = function(_, opts)
require("nvim-autopairs").setup(opts)
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
end
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
end,
},
},
version = false, -- last release is way too old and doesn't work on Windows
build = ":TSUpdate",
-- event = { "LazyFile", "VeryLazy" },
lazy = true,
cmd = {
"TSInstall",
"TSUninstall",
"TSUpdate",
"TSUpdateSync",
"TSInstallInfo",
"TSInstallSync",
"TSInstallFromGrammar",
},
event = { "BufRead", "VeryLazy" },
opts = function()
return {
highlight = { enable = true },
indent = { enable = true },
ensure_installed = {
"lua",
"vim",
"vimdoc",
},
incremental_selection = {
enable = true,
},
autopairs = {
enable = true,
},
}
end,
config = function(_, opts)
if type(opts.ensure_installed) == "table" then
---@type table<string, boolean>
local added = {}
opts.ensure_installed = vim.tbl_filter(function(lang)
if added[lang] then
return false
end
added[lang] = true
return true
end, opts.ensure_installed)
end
require("nvim-treesitter.configs").setup(opts)
vim.schedule(function()
require("lazy").load({ plugins = { "nvim-treesitter-textobjects" } })
end)
end,
},
{
"nvim-treesitter/nvim-treesitter-textobjects",
lazy = true,
config = function()
-- When in diff mode, we want to use the default
-- vim text objects c & C instead of the treesitter ones.
local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)>
local configs = require("nvim-treesitter.configs")
for name, fn in pairs(move) do
if name:find("goto") == 1 then
move[name] = function(q, ...)
if vim.wo.diff then
local config = configs.get_module("textobjects.move")[name] ---@type table<string,string>
for key, query in pairs(config or {}) do
if q == query and key:find("[%]%[][cC]") then
vim.cmd("normal! " .. key)
return
end
end
end
return fn(q, ...)
end
end
end
end,
},
-- Automatically add closing tags for HTML and JSX
{
"windwp/nvim-ts-autotag",
lazy = true,
event = "BufRead",
opts = {},
},
{
"RRethy/vim-illuminate",
lazy = true,
event = "BufRead",
opts = {
options = {
-- providers: provider used to get references in the buffer, ordered by priority
providers = {
"lsp",
"treesitter",
"regex",
},
-- delay: delay in milliseconds
delay = 120,
-- filetype_overrides: filetype specific overrides.
-- The keys are strings to represent the filetype while the values are tables that
-- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
filetype_overrides = {},
-- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
filetypes_denylist = {
"dirvish",
"fugitive",
"alpha",
"NvimTree",
"lazy",
"neogitstatus",
"Trouble",
"lir",
"Outline",
"spectre_panel",
"toggleterm",
"DressingSelect",
"TelescopePrompt",
},
-- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist
filetypes_allowlist = {},
-- modes_denylist: modes to not illuminate, this overrides modes_allowlist
modes_denylist = {},
-- modes_allowlist: modes to illuminate, this is overridden by modes_denylist
modes_allowlist = {},
-- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
-- Only applies to the 'regex' provider
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
providers_regex_syntax_denylist = {},
-- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist
-- Only applies to the 'regex' provider
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
providers_regex_syntax_allowlist = {},
-- under_cursor: whether or not to illuminate under the cursor
under_cursor = true,
},
},
config = function(_, opts)
require("illuminate").configure(opts)
end,
},
}

View file

@ -8,61 +8,6 @@ return {
require("user.alpha")
end,
},
-- line info bootom
{
"nvim-lualine/lualine.nvim",
lazy = true,
event = { "BufRead", "BufNewFile" },
config = function()
require("user.lualine_cfg")
end,
},
-- for show icon
{
"kyazdani42/nvim-web-devicons",
lazy = true,
dependencies = { "pojokcodeid/nvim-material-icon" },
config = function()
require("user.webdevicons")
end,
},
-- for tree exploler
{
"kyazdani42/nvim-tree.lua",
lazy = true,
cmd = { "NvimTree", "NvimTreeOpen", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" },
config = function()
local data_exists, treeconfig = pcall(require, "core.config")
if data_exists then
if treeconfig.loadnvimtree_lazy then
require("user.nvim-tree")
end
end
end,
},
-- for file tab
{
"famiu/bufdelete.nvim",
lazy = true,
},
{
"akinsho/bufferline.nvim",
lazy = true,
branch = "main",
event = { "BufRead", "InsertEnter", "BufNewFile" },
config = function()
require("user.bufferline")
end,
},
-- for view terminal
{
"akinsho/toggleterm.nvim",
lazy = true,
cmd = { "ToggleTerm" },
config = function()
require("user.toggleterm")
end,
},
-- key mapping
{
"folke/which-key.nvim",
@ -73,22 +18,4 @@ return {
require("user.whichkey")
end,
},
-- for search
{
"nvim-telescope/telescope.nvim",
lazy = true,
cmd = "Telescope",
version = false, -- telescope did only one release, so use HEAD for now
config = function()
require("user.telescope")
end,
},
{
"karb94/neoscroll.nvim",
lazy = true,
-- event = "InsertEnter",
config = function()
require("user.neoscroll")
end,
},
}

View file

@ -0,0 +1,14 @@
return {
"mg979/vim-visual-multi",
event = { "BufRead", "InsertEnter", "BufNewFile" },
lazy = true,
init = function()
vim.g.VM_mouse_mappings = 1 -- equal CTRL + Left Click on VSCODE
vim.g.VM_maps = {
["Find Under"] = "<C-d>", -- equal CTRL+D on VSCODE
["Find Subword Under"] = "<C-d>", -- equal CTRL+D on VSCODE
["Select Cursor Down"] = "<M-C-Down>", -- equal CTRL+ALT+DOWN on VSCODE
["Select Cursor Up"] = "<M-C-Up>", -- equal CTRL+ALT+UP on VSCODE
}
end,
}

View file

@ -0,0 +1,21 @@
return {
"kyazdani42/nvim-web-devicons",
lazy = true,
dependencies = "pojokcodeid/nvim-material-icon",
opts = function()
local material_icon_ok, material_icon = pcall(require, "nvim-material-icon")
if not material_icon_ok then
return
end
material_icon.setup({
override = {},
})
return {
override = material_icon.get_icons(),
override_by_filename = {},
}
end,
config = function(_, opts)
require("nvim-web-devicons").setup(opts)
end,
}

19
lua/plugins/yanky.lua Normal file
View file

@ -0,0 +1,19 @@
return {
"gbprod/yanky.nvim",
event = "BufReadPre",
opts = {
ring = {
history_length = 50,
storage = "memory",
},
preserve_cursor_position = {
enabled = false,
},
},
config = function(_, opts)
require("yanky").setup(opts)
-- cycle through the yank history, only work after paste
vim.keymap.set("n", "[y", "<Plug>(YankyCycleForward)")
vim.keymap.set("n", "]y", "<Plug>(YankyCycleBackward)")
end,
}