diff --git a/lazy-lock.json b/lazy-lock.json index fcbb54a..7bdd4c6 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,7 +2,6 @@ "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" }, - "bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" }, "bufferline.nvim": { "branch": "main", "commit": "9ae49d71c84b42b91795f7b7cead223c6346e774" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, @@ -11,11 +10,11 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "code_runner.nvim": { "branch": "main", "commit": "d135c4178bf8980ca5fa4aa6e27ab9ee4373c875" }, "codeium.vim": { "branch": "main", "commit": "9406f13cf3eaa08318b76746bd105a04506cab27" }, + "dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" }, "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, "friendly-snippets": { "branch": "main", "commit": "dd2fd1281d4b22e7b4a5bfafa3e142d958e251f2" }, - "github-nvim-theme": { "branch": "main", "commit": "66dcec1bd3d12f8b0bf3c885069888551a650049" }, "gitsigns.nvim": { "branch": "main", "commit": "76927d14d3fbd4ba06ccb5246e79d93b5442c188" }, - "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, + "indent-blankline.nvim": { "branch": "master", "commit": "ece00d5fb44d196680a81fd2761062d2fa44663b" }, "lazy.nvim": { "branch": "main", "commit": "758bb5de98b805acc5eeed8cdc8ac7f0bc4b0b86" }, "lsp-progress.nvim": { "branch": "main", "commit": "07ca8eadf7d02ca33ff4d1e9e500910fe17aa14d" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, @@ -24,11 +23,12 @@ "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, "mini.animate": { "branch": "main", "commit": "82519630b2760ffc516ebc387bef632f9c07b9f5" }, "mini.indentscope": { "branch": "main", "commit": "a8274b6ea2d868198d27bd91a31ed5ea3a6a5744" }, + "neoscroll.nvim": { "branch": "master", "commit": "e78657719485c5663b88e5d96ffcfb6a2fe3eec0" }, "noice.nvim": { "branch": "main", "commit": "9f6f6ba74f8bfbf7e43d6302cf86b070362f6203" }, "none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" }, "none-ls.nvim": { "branch": "main", "commit": "37671797d6e5f9bd0ee3ab965ab2e6de251e1930" }, "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" }, - "nvim-autopairs": { "branch": "master", "commit": "b0b79e42a28f09719a7da9534c3731fa37319d9b" }, + "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, "nvim-lspconfig": { "branch": "master", "commit": "cf3dd4a290084a868fac0e2e876039321d57111c" }, @@ -37,12 +37,12 @@ "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-scrollview": { "branch": "main", "commit": "c29c5f69d37040a1fac88cbea7f5e6f06f0aff4d" }, "nvim-tree.lua": { "branch": "master", "commit": "2bc725a3ebc23f0172fb0ab4d1134b81bcc13812" }, - "nvim-treesitter": { "branch": "master", "commit": "f197a15b0d1e8d555263af20add51450e5aaa1f0" }, + "nvim-treesitter": { "branch": "master", "commit": "ccfa76d4cb53224cb0ecefb12f79ecdbbf1fd62d" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "5f9bf4b1ead7707e4e74e5319ee56bdc81fb73db" }, "nvim-ts-autotag": { "branch": "main", "commit": "aeb7090098722ffce16597bd0331105495640153" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "cbab9ad88036915beebd13b47e100743ff2ed2d5" }, "nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, - "onedarkpro.nvim": { "branch": "main", "commit": "ec07364f3cfa9cc6467bf067a490cfd74011efcd" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" }, @@ -50,7 +50,7 @@ "statuscol.nvim": { "branch": "main", "commit": "483b9a596dfd63d541db1aa51ee6ee9a1441c4cc" }, "tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" }, "telescope.nvim": { "branch": "master", "commit": "0c12735d5aff6a48ffd8111bf144dc2ff44e5975" }, - "toggleterm.nvim": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" }, + "toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" }, "vim-visual-multi": { "branch": "master", "commit": "1c9207b28c8898ab01b54e6d6b61b0b820a814bc" }, diff --git a/lua/core/init.lua b/lua/core/init.lua index 4eefbce..bc53e28 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -17,5 +17,5 @@ require("custom.keymaps") -- require("user.chat_gpt") -- vim.cmd("colorscheme one_monokai") -- vim.cmd("colorscheme onedark") -vim.cmd("colorscheme github_dark_dimmed") +-- vim.cmd("colorscheme github_dark_dimmed") -- vim.cmd("colorscheme github_dark_high_contrast") diff --git a/lua/custom/default.lua b/lua/custom/default.lua index d8750a6..d6ae3c9 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -11,7 +11,7 @@ -- catppuccin, catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha -- dracula -- nightfox, dayfox, dawnfox, duskfox, nordfox, terafox, carbonfox -vim.g.pcode_colorscheme = "onedark" +vim.g.pcode_colorscheme = "dracula" -- custom transparent mode -- only support @@ -26,58 +26,12 @@ vim.g.pcode_colorscheme = "onedark" -- nightfox -- 0 =off 1= on vim.g.pcode_transparent_mode = 0 -vim.g.pcode_clear_lualine = 0 -- 0 disable progress -- 1 lualine lsp progress -- 2 fidget progress vim.g.pcode_progress = 1 --- style --- 0 = default --- 1 = { left = "", right = "" }, --- 2 = { left = " ", right = " " }, --- 3 = { left = "", right = "" }, -vim.g.pcode_lualine_style = 0 - --- style status icon --- 0 = default --- 1 = vim icon " " --- 2 = vim icon " " -vim.g.pcode_status_icon = 0 - --- start custom lualine style --- contoh style --- { --- { left = "│", right = "│" }, --- { left = " ", right = " " }, --- }, --- { --- { left = " ", right = " " }, --- { left = " ", right = "" }, --- }, --- { --- { left = " ", right = " " }, --- { left = "", right = "" }, --- }, --- { --- { left = "", right = "" }, --- { left = "", right = "" }, --- }, --- { --- { left = " ", right = " " }, --- { left = "", right = "" }, --- }, --- } -vim.g.pcode_custom_lualine = true --- vim.g.pcode_component_separators = { left = " ", right = " " } --- vim.g.pcode_section_separators = { left = "", right = "" } -vim.g.pcode_component_separators = { left = " ", right = " " } -vim.g.pcode_section_separators = { left = "", right = "" } --- vim.g.pcode_component_separators = { left = "│", right = "│" } --- vim.g.pcode_component_separators = { left = "", right = "" } --- vim.g.pcode_section_separators = { left = "", right = "" } - --- 0 ( format jalan) 1 (fromat off) +-- 1 ( format jalan) 0 (fromat off) vim.g.pcode_format_on_save = 1 -- ini hanya untuk lsp yg tidak support masson diff --git a/lua/custom/plugins/githubdark.lua b/lua/custom/plugins/githubdark.lua index bc134de..9617971 100644 --- a/lua/custom/plugins/githubdark.lua +++ b/lua/custom/plugins/githubdark.lua @@ -1,109 +1,110 @@ return { - { - "navarasu/onedark.nvim", - enabled = false, - }, - { - "projekt0n/github-nvim-theme", - lazy = false, -- make sure we load this during startup if it is your main colorscheme - priority = 1000, -- make sure to load this before all the other start plugins - config = function() - local is_transparent = false - local palette = require("github-theme.palette").load("github_dark_dimmed") - require("github-theme").setup({ - options = { - -- Compiled file's destination location - compile_path = vim.fn.stdpath("cache") .. "/github-theme", - compile_file_suffix = "_compiled", -- Compiled file suffix - hide_end_of_buffer = true, -- Hide the '~' character at the end of the buffer for a cleaner look - hide_nc_statusline = true, -- Override the underline style for non-active statuslines - transparent = is_transparent, -- Disable setting background - terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` - dim_inactive = false, -- Non focused panes set to alternative background - module_default = true, -- Default enable value for modules - styles = { -- Style to be applied to different syntax groups - comments = "italic", -- Value is any valid attr-list value `:help attr-list` - functions = "italic", - keywords = "NONE", - variables = "NONE", - conditionals = "NONE", - constants = "NONE", - numbers = "NONE", - operators = "NONE", - strings = "NONE", - types = "NONE", - }, - inverse = { -- Inverse highlight for different types - match_paren = false, - visual = false, - search = false, - }, - darken = { -- Darken floating windows and sidebar-like windows - floats = false, - sidebars = { - enabled = true, - list = {}, -- Apply dark background to specific windows - }, - }, - modules = { -- List of various plugins and additional options - -- ... - }, - }, - palettes = { - github_dark_dimmed = { - bg0 = is_transparent and "NONE" or "bg1", - bg1 = is_transparent and "NONE" or "bg", - }, - }, - specs = {}, - groups = { - all = { - illuminatedWord = { bg = "#3b4261" }, - illuminatedCurWord = { bg = "#3b4261" }, - IlluminatedWordText = { bg = "#3b4261" }, - IlluminatedWordRead = { bg = "#3b4261" }, - IlluminatedWordWrite = { bg = "#3b4261" }, - ["@tag.attribute"] = { fg = "#77bdfb", style = "italic" }, - ["@text.uri"] = { fg = palette.const, style = "italic" }, - ["@keyword.return"] = { fg = "#fa7970", style = "italic" }, - -- ["@tag.attribute.html"] = { fg = "#faa356", style = "italic" }, - -- ["@operator.html"] = { fg = "#faa356" }, - -- ["@tag.html"] = { fg = "#fa7970" }, - -- ["@tag.delimiter.html"] = { fg = "#faa356" }, - -- ["@tag.javascript"] = { fg = "#faa356" }, - -- ["@tag.javascript"] = { fg = "#8ddb8c" }, - -- ["@tag.tsx"] = { fg = "#8ddb8c" }, - -- ["@tag.delimiter.javascript"] = { fg = "fg1" }, - -- ["@tag.tsx"] = { fg = "#faa356" }, - ["@lsp.type.parameter"] = { fg = "#faa356" }, - ["@property.lua"] = { fg = "#91cbff", bg = is_transparent and "NONE" or "bg1" }, - ["@lsp.type.property.lua"] = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, - ["@lsp.type.variable.lua"] = { fg = "#91cbff", bg = is_transparent and "NONE" or "bg1" }, - }, - github_dark_high_contrast = { - NvimTreeSpecialFile = { fg = "#faa356", style = "italic" }, - }, - github_dark_dimmed = { - -- As with specs and palettes, a specific style's value will be used over the `all`'s value. - NvimTreeNormal = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, - NvimTreeSpecialFile = { fg = "#faa356", style = "italic" }, - NvimTreeIndentMarker = { fg = "#3E4450" }, - BufferLineFill = { bg = is_transparent and "NONE" or "bg1" }, - BufferLineUnfocusedFill = { bg = is_transparent and "NONE" or "bg1" }, - LualineNormal = { bg = is_transparent and "NONE" or "bg1" }, - StatusLine = { bg = is_transparent and "NONE" or "bg1" }, - StatusLineTerm = { bg = is_transparent and "NONE" or "bg1" }, - Pmenu = { bg = is_transparent and "NONE" or "bg1" }, - PmenuSel = { link = "CursorLine" }, - WhichKeyFloat = { bg = is_transparent and "NONE" or "bg1" }, - LazyNormal = { bg = is_transparent and "NONE" or "bg1" }, - LazyBackground = { bg = is_transparent and "NONE" or "bg1" }, - NormalSB = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, -- normal text - NormalFloat = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, - IblIndent = { fg = "#3E4450" }, - }, - }, - }) - end, - }, + -- { + -- "navarasu/onedark.nvim", + -- enabled = false, + -- }, + -- { + -- "projekt0n/github-nvim-theme", + -- lazy = false, -- make sure we load this during startup if it is your main colorscheme + -- priority = 1000, -- make sure to load this before all the other start plugins + -- config = function() + -- local is_transparent = false + -- local palette = require("github-theme.palette").load("github_dark_dimmed") + -- require("github-theme").setup({ + -- options = { + -- -- Compiled file's destination location + -- compile_path = vim.fn.stdpath("cache") .. "/github-theme", + -- compile_file_suffix = "_compiled", -- Compiled file suffix + -- hide_end_of_buffer = true, -- Hide the '~' character at the end of the buffer for a cleaner look + -- hide_nc_statusline = true, -- Override the underline style for non-active statuslines + -- transparent = is_transparent, -- Disable setting background + -- terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` + -- dim_inactive = false, -- Non focused panes set to alternative background + -- module_default = true, -- Default enable value for modules + -- styles = { -- Style to be applied to different syntax groups + -- comments = "italic", -- Value is any valid attr-list value `:help attr-list` + -- functions = "italic", + -- keywords = "NONE", + -- variables = "NONE", + -- conditionals = "NONE", + -- constants = "NONE", + -- numbers = "NONE", + -- operators = "NONE", + -- strings = "NONE", + -- types = "NONE", + -- }, + -- inverse = { -- Inverse highlight for different types + -- match_paren = false, + -- visual = false, + -- search = false, + -- }, + -- darken = { -- Darken floating windows and sidebar-like windows + -- floats = false, + -- sidebars = { + -- enabled = true, + -- list = {}, -- Apply dark background to specific windows + -- }, + -- }, + -- modules = { -- List of various plugins and additional options + -- -- ... + -- }, + -- }, + -- palettes = { + -- github_dark_dimmed = { + -- bg0 = is_transparent and "NONE" or "bg1", + -- bg1 = is_transparent and "NONE" or "bg", + -- }, + -- }, + -- specs = {}, + -- groups = { + -- all = { + -- illuminatedWord = { bg = "#3b4261" }, + -- illuminatedCurWord = { bg = "#3b4261" }, + -- IlluminatedWordText = { bg = "#3b4261" }, + -- IlluminatedWordRead = { bg = "#3b4261" }, + -- IlluminatedWordWrite = { bg = "#3b4261" }, + -- ["@tag.attribute"] = { fg = "#77bdfb", style = "italic" }, + -- ["@text.uri"] = { fg = palette.const, style = "italic" }, + -- ["@keyword.return"] = { fg = "#fa7970", style = "italic" }, + -- -- ["@tag.attribute.html"] = { fg = "#faa356", style = "italic" }, + -- -- ["@operator.html"] = { fg = "#faa356" }, + -- -- ["@tag.html"] = { fg = "#fa7970" }, + -- -- ["@tag.delimiter.html"] = { fg = "#faa356" }, + -- -- ["@tag.javascript"] = { fg = "#faa356" }, + -- -- ["@tag.javascript"] = { fg = "#8ddb8c" }, + -- -- ["@tag.tsx"] = { fg = "#8ddb8c" }, + -- ["@string.special.url"] = { fg = palette.const, style = "italic" }, + -- ["@tag.delimiter.javascript"] = { fg = "fg1" }, + -- ["@tag.tsx"] = { fg = "#faa356" }, + -- ["@lsp.type.parameter"] = { fg = "#faa356" }, + -- ["@property.lua"] = { fg = "#91cbff", bg = is_transparent and "NONE" or "bg1" }, + -- ["@lsp.type.property.lua"] = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, + -- ["@lsp.type.variable.lua"] = { fg = "#91cbff", bg = is_transparent and "NONE" or "bg1" }, + -- }, + -- github_dark_high_contrast = { + -- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" }, + -- }, + -- github_dark_dimmed = { + -- -- As with specs and palettes, a specific style's value will be used over the `all`'s value. + -- NvimTreeNormal = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, + -- NvimTreeSpecialFile = { fg = "#faa356", style = "italic" }, + -- NvimTreeIndentMarker = { fg = "#3E4450" }, + -- BufferLineFill = { bg = is_transparent and "NONE" or "bg1" }, + -- BufferLineUnfocusedFill = { bg = is_transparent and "NONE" or "bg1" }, + -- LualineNormal = { bg = is_transparent and "NONE" or "bg1" }, + -- StatusLine = { bg = is_transparent and "NONE" or "bg1" }, + -- StatusLineTerm = { bg = is_transparent and "NONE" or "bg1" }, + -- Pmenu = { bg = is_transparent and "NONE" or "bg1" }, + -- PmenuSel = { link = "CursorLine" }, + -- WhichKeyFloat = { bg = is_transparent and "NONE" or "bg1" }, + -- LazyNormal = { bg = is_transparent and "NONE" or "bg1" }, + -- LazyBackground = { bg = is_transparent and "NONE" or "bg1" }, + -- NormalSB = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, -- normal text + -- NormalFloat = { fg = "fg1", bg = is_transparent and "NONE" or "bg1" }, + -- IblIndent = { fg = "#3E4450" }, + -- }, + -- }, + -- }) + -- end, + -- }, } diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 814cb2e..88b8ffe 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -43,13 +43,13 @@ return { "hrsh7th/cmp-nvim-lua", enabled = false, }, - { - "gbprod/yanky.nvim", - event = "BufReadPre", - config = function() - require("user.yanky") - end, - }, + -- { + -- "gbprod/yanky.nvim", + -- event = "BufReadPre", + -- config = function() + -- require("user.yanky") + -- end, + -- }, -- { -- "is0n/jaq-nvim", -- event = "BufRead", diff --git a/lua/custom/plugins/lualine_github.lua b/lua/custom/plugins/lualine_github.lua index cc7c168..1bc8d74 100644 --- a/lua/custom/plugins/lualine_github.lua +++ b/lua/custom/plugins/lualine_github.lua @@ -1,240 +1,243 @@ return { - { - "nvim-lualine/lualine.nvim", - event = "InsertEnter", - 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.tbl_flatten(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 - local clients = vim.lsp.get_active_clients() - -- start register - local buf_clients = vim.lsp.buf_get_clients() - 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 "LS 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 = " ", - icon = icons.ui.Gear .. "", - padding = 1, - } - - local diagnostics = { - "diagnostics", - sources = { "nvim_diagnostic" }, - sections = { "error", "warn" }, - -- symbols = { 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 = " ", modified = " ", removed = " " }, -- changes diff symbols - symbols = { - added = icons.git.LineAdded .. " ", - modified = icons.git.LineModified .. " ", - removed = icons.git.LineRemoved .. " ", - }, -- changes diff symbols - cond = hide_in_width, - } - - local spaces = function() - -- return " " .. vim.api.nvim_buf_get_option(0, "shiftwidth") - return icons.ui.Tab .. " " .. vim.api.nvim_buf_get_option(0, "shiftwidth") - end - - local mode = { - "mode", - padding = 1, - separator = { left = " " }, - -- right_padding = 3, - fmt = function(str) - return icons.ui.Neovim .. " " .. str - end, - } - local branch = { - "branch", - padding = 1, - } - - 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 - -- stylua: ignore - local github=vim.fn.fnamemodify("auto", ":t") - local status_ok, _ = pcall(require, "github-theme") - if status_ok then - local C = require("github-theme.lib.color") - local config = require("github-theme.config").options - local s = require("github-theme.spec").load("github_dark_dimmed") - local p = s.palette - local tbg = config.transparent and "NONE" or s.bg0 - - local function blend(color, a) - return C(s.bg1):blend(C(color), a):to_css() - end - - --- Create lualine group colors for github-theme - ---@param color string - local tint = function(color) - return { - a = { bg = color, fg = s.bg1 }, - b = { bg = blend(color, 0.2), fg = blend(color, 0.8) }, - c = { bg = "NONE", fg = blend(color, 0.60) }, - } - end - - local inactive_hi = { bg = tbg, fg = blend(s.fg1, 0.3) } - github = { - normal = tint(p.blue.base), - insert = tint(p.green.base), - command = tint(p.magenta.bright), - visual = tint(p.yellow.base), - replace = tint(p.red.base), - terminal = tint(p.orange), - inactive = { - a = inactive_hi, - b = inactive_hi, - c = inactive_hi, - }, - } - end - - require("lualine").setup({ - options = { - theme = github, - -- theme = "auto", - 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, - }, + -- { + -- "nvim-lualine/lualine.nvim", + -- event = "InsertEnter", + -- 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.tbl_flatten(vim.tbl_map(function(m) + -- -- return registered_providers[m] or {} + -- -- end, alternative_methods)) + -- 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 = vim.lsp.get_clients() + -- 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 "LS 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 = " ", + -- icon = icons.ui.Gear .. "", + -- padding = 1, + -- } + -- + -- local diagnostics = { + -- "diagnostics", + -- sources = { "nvim_diagnostic" }, + -- sections = { "error", "warn" }, + -- -- symbols = { 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 = " ", modified = " ", removed = " " }, -- changes diff symbols + -- symbols = { + -- added = icons.git.LineAdded .. " ", + -- modified = icons.git.LineModified .. " ", + -- removed = icons.git.LineRemoved .. " ", + -- }, -- changes diff symbols + -- cond = hide_in_width, + -- } + -- + -- local spaces = function() + -- -- return " " .. vim.api.nvim_buf_get_option(0, "shiftwidth") + -- return icons.ui.Tab .. " " .. vim.api.nvim_get_option_value(0, "shiftwidth") + -- end + -- + -- local mode = { + -- "mode", + -- padding = 1, + -- separator = { left = " " }, + -- -- right_padding = 3, + -- fmt = function(str) + -- return icons.ui.Neovim .. " " .. str + -- end, + -- } + -- local branch = { + -- "branch", + -- padding = 1, + -- } + -- + -- 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 + -- -- stylua: ignore + -- -- local github=vim.fn.fnamemodify("auto", ":t") + -- local github={} + -- local status_ok, _ = pcall(require, "github-theme") + -- if status_ok then + -- local C = require("github-theme.lib.color") + -- local config = require("github-theme.config").options + -- local s = require("github-theme.spec").load("github_dark_dimmed") + -- local p = s.palette + -- local tbg = config.transparent and "NONE" or s.bg0 + -- + -- local function blend(color, a) + -- return C(s.bg1):blend(C(color), a):to_css() + -- end + -- + -- --- Create lualine group colors for github-theme + -- ---@param color string + -- local tint = function(color) + -- return { + -- a = { bg = color, fg = s.bg1 }, + -- b = { bg = blend(color, 0.2), fg = blend(color, 0.8) }, + -- c = { bg = "NONE", fg = blend(color, 0.60) }, + -- } + -- end + -- + -- local inactive_hi = { bg = tbg, fg = blend(s.fg1, 0.3) } + -- github = { + -- normal = tint(p.blue.base), + -- insert = tint(p.green.base), + -- command = tint(p.magenta.bright), + -- visual = tint(p.yellow.base), + -- replace = tint(p.red.base), + -- terminal = tint(p.orange), + -- inactive = { + -- a = inactive_hi, + -- b = inactive_hi, + -- c = inactive_hi, + -- }, + -- } + -- end + -- + -- require("lualine").setup({ + -- options = { + -- theme = github or "auto", + -- -- theme = "auto", + -- 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, + -- }, } diff --git a/lua/custom/plugins/lualine_onedark.lua b/lua/custom/plugins/lualine_onedark.lua index e8bcb54..24a1dde 100644 --- a/lua/custom/plugins/lualine_onedark.lua +++ b/lua/custom/plugins/lualine_onedark.lua @@ -47,7 +47,7 @@ return { -- -- local linter_list_registered = function(filetype) -- local registered_providers = list_registered_providers_names(filetype) - -- local providers_for_methods = vim.tbl_flatten(vim.tbl_map(function(m) + -- local providers_for_methods = vim.iter(vim.tbl_map(function(m) -- return registered_providers[m] or {} -- end, alternative_methods)) -- @@ -59,9 +59,9 @@ return { -- function() -- local msg = "LS Inactive" -- local buf_ft = vim.bo.filetype - -- local clients = vim.lsp.get_active_clients() -- -- start register - -- local buf_clients = vim.lsp.buf_get_clients() + -- 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 @@ -120,7 +120,7 @@ return { -- -- local spaces = function() -- -- return " " .. vim.api.nvim_buf_get_option(0, "shiftwidth") - -- return icons.ui.Tab .. " " .. vim.api.nvim_buf_get_option(0, "shiftwidth") + -- return icons.ui.Tab .. " " .. vim.api.nvim_get_option_value(0, "shiftwidth") -- end -- -- local mode = { @@ -151,7 +151,8 @@ return { -- lsp_progress = lspprogress.progress -- end -- -- stylua: ignore - -- local onedark=vim.fn.fnamemodify("auto", ":t") + -- -- local onedark=vim.fn.fnamemodify("auto", ":t") + -- local onedark={} -- local is_transparat = true -- local status_ok, onedarkpro = pcall(require, "onedarkpro.helpers") -- if status_ok then diff --git a/lua/custom/plugins/nvim_tree.lua b/lua/custom/plugins/nvim_tree.lua index f676736..ee625e6 100644 --- a/lua/custom/plugins/nvim_tree.lua +++ b/lua/custom/plugins/nvim_tree.lua @@ -1,279 +1,279 @@ return { - { - "kyazdani42/nvim-tree.lua", - lazy = true, - event = "VeryLazy", - cmd = { "NvimTree", "NvimTreeOpen", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" }, - -- dependencies = "kyazdani42/nvim-web-devicons", - config = function() - local data_exists, treeconfig = pcall(require, "core.config") - if data_exists then - if treeconfig.loadnvimtree_lazy then - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - - -- set termguicolors to enable highlight groups - vim.opt.termguicolors = true - local status_ok, nvim_tree = pcall(require, "nvim-tree") - if not status_ok then - return - end - - local HEIGHT_RATIO = 0.9 -- You can change this - local WIDTH_RATIO = 0.5 -- You can change this too - - local icons = require("user.icons") - nvim_tree.setup({ - 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 = true, - -- quit_on_focus_loss = true, - -- open_win_config = { - -- relative = "editor", - -- border = "rounded", - -- width = 30, - -- height = 30, - -- row = 1, - -- col = 1, - -- }, - -- }, - float = { - enable = true, - open_win_config = function() - local screen_w = vim.opt.columns:get() - local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get() - local window_w = screen_w * WIDTH_RATIO - local window_h = screen_h * HEIGHT_RATIO - local window_w_int = math.floor(window_w) - local window_h_int = math.floor(window_h) - local center_x = (screen_w - window_w) / 2 - local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get() - return { - border = "rounded", - relative = "editor", - row = center_y, - col = center_x, - width = window_w_int, - height = window_h_int, - } - end, - }, - width = function() - return math.floor(vim.opt.columns:get() * WIDTH_RATIO) - end, - }, - 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 = {}, - }, - }) - end - end - -- auto open file if creation - local api = require("nvim-tree.api") - api.events.subscribe(api.events.Event.FileCreated, function(file) - vim.cmd("edit " .. file.fname) - end) - end, - }, + -- { + -- "kyazdani42/nvim-tree.lua", + -- lazy = true, + -- event = "VeryLazy", + -- cmd = { "NvimTree", "NvimTreeOpen", "NvimTreeToggle", "NvimTreeFocus", "NvimTreeClose" }, + -- -- dependencies = "kyazdani42/nvim-web-devicons", + -- config = function() + -- local data_exists, treeconfig = pcall(require, "core.config") + -- if data_exists then + -- if treeconfig.loadnvimtree_lazy then + -- vim.g.loaded_netrw = 1 + -- vim.g.loaded_netrwPlugin = 1 + -- + -- -- set termguicolors to enable highlight groups + -- vim.opt.termguicolors = true + -- local status_ok, nvim_tree = pcall(require, "nvim-tree") + -- if not status_ok then + -- return + -- end + -- + -- local HEIGHT_RATIO = 0.9 -- You can change this + -- local WIDTH_RATIO = 0.5 -- You can change this too + -- + -- local icons = require("user.icons") + -- nvim_tree.setup({ + -- 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 = true, + -- -- quit_on_focus_loss = true, + -- -- open_win_config = { + -- -- relative = "editor", + -- -- border = "rounded", + -- -- width = 30, + -- -- height = 30, + -- -- row = 1, + -- -- col = 1, + -- -- }, + -- -- }, + -- float = { + -- enable = true, + -- open_win_config = function() + -- local screen_w = vim.opt.columns:get() + -- local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get() + -- local window_w = screen_w * WIDTH_RATIO + -- local window_h = screen_h * HEIGHT_RATIO + -- local window_w_int = math.floor(window_w) + -- local window_h_int = math.floor(window_h) + -- local center_x = (screen_w - window_w) / 2 + -- local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get() + -- return { + -- border = "rounded", + -- relative = "editor", + -- row = center_y, + -- col = center_x, + -- width = window_w_int, + -- height = window_h_int, + -- } + -- end, + -- }, + -- width = function() + -- return math.floor(vim.opt.columns:get() * WIDTH_RATIO) + -- end, + -- }, + -- 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 = {}, + -- }, + -- }) + -- end + -- end + -- -- auto open file if creation + -- local api = require("nvim-tree.api") + -- api.events.subscribe(api.events.Event.FileCreated, function(file) + -- vim.cmd("edit " .. file.fname) + -- end) + -- end, + -- }, } diff --git a/lua/custom/plugins/onedarkpro.lua b/lua/custom/plugins/onedarkpro.lua index 844ab1a..f0c7b3e 100644 --- a/lua/custom/plugins/onedarkpro.lua +++ b/lua/custom/plugins/onedarkpro.lua @@ -1,110 +1,114 @@ return { - { "navarasu/onedark.nvim", enabled = false }, - { - "olimorris/onedarkpro.nvim", - priority = 1000, -- Ensure it loads first - config = function() - local is_transparent = false - require("onedarkpro").setup({ - styles = { - types = "NONE", - methods = "NONE", - numbers = "NONE", - strings = "NONE", - comments = "italic", - keywords = "bold,italic", - constants = "NONE", - functions = "italic", - operators = "NONE", - variables = "NONE", - parameters = "NONE", - conditionals = "italic", - virtual_text = "NONE", - tags = "italic", - }, - colors = { - onedark = { - green = "#99c379", - gray = "#8094b4", - red = "#e06c75", - purple = "#c678dd", - yellow = "#e5c07a", - blue = "#61afef", - cyan = "#56b6c2", - bg_statusline = "#282c34", - indentline = "#3b4261", - float_bg = "#282c34", - }, - }, - options = { - cursorline = true, - transparency = is_transparent, - terminal_colors = true, - }, - highlights = { - -- overide cursor line fill colors - LineNr = { fg = "#49505E" }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. - CursorLineNr = { fg = "${blue}" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. - CursorLine = { bg = "#333842" }, - Cursor = { fg = "${bg}", bg = "${fg}" }, -- character under the cursor - lCursor = { fg = "${bg}", bg = "${fg}" }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') - CursorIM = { fg = "${bg}", bg = "${fg}" }, -- like Cursor, but used when in IME mode |CursorIM| - CursorColumn = { bg = "#333842" }, -- Screen-column at the cursor, when 'cursorcolumn' is set. - -- overide nvimtree folder icon fill color - NvimTreeFolderIcon = { fg = "${gray}" }, - -- overide nvimtree text fill color folder opened - NvimTreeOpenedFolderName = { fg = "${blue}" }, - -- overide nvimtree text fill color root folder - NvimTreeRootFolder = { fg = "${yellow}" }, - NvimTreeSpecialFile = { fg = "${orange}" }, - NvimTreeWinSeparator = { fg = "#202329" }, - NvimTreeIndentMarker = { fg = "#3E4450" }, - -- overide indenline fill color - IblIndent = { fg = "#3E4450" }, - -- overide cmp cursorline fill color with #333842 - PmenuSel = { bg = "#333842" }, - illuminatedWord = { bg = "#3b4261" }, - illuminatedCurWord = { bg = "#3b4261" }, - IlluminatedWordText = { bg = "#3b4261" }, - IlluminatedWordRead = { bg = "#3b4261" }, - IlluminatedWordWrite = { bg = "#3b4261" }, - StatusLine = { fg = "#f8f8f2", bg = is_transparent and "NONE" or "${bg}" }, - StatusLineTerm = { fg = "#f8f8f2", bg = "${bg}" }, - BufferLineFill = { bg = is_transparent and "NONE" or "${bg}" }, - ["@string.special.url.html"] = { fg = "${green}" }, - ["@text.uri.html"] = { fg = "${green}" }, - ["@tag.javascript"] = { fg = "${red}" }, - ["@tag.attribute"] = { fg = "${orange}", style = "italic" }, - ["@constructor.javascript"] = { fg = "${red}" }, - ["@variable"] = { fg = "${fg}", style = "NONE" }, -- various variable names - ["@variable.builtin"] = { fg = "${red}", style = "NONE" }, - ["@variable.member"] = "${cyan}", - ["@variable.parameter"] = "${red}", - ["@property"] = { fg = "${cyan}" }, -- similar to `@field` - NvimTreeGitDirty = { fg = "${yellow}" }, - Pmenu = { fg = "${fg}", bg = "${bg}" }, - PmenuThumb = { bg = "${gray}" }, -- Popup menu: Thumb of the scrollbar. - -- overide lualine fill color with bg color - LualineNormal = { bg = "${bg}" }, - -- overide lualine_c fill color with bg color - LualineC = { bg = "${bg}" }, - -- overide lualine_x fill color with bg color - LualineX = { bg = "${bg}" }, - -- overide which-key fill color with bg color - -- WhichKey = { bg = "${bg}" }, - -- -- overide which-key fill color with bg color - -- WhichKeySeperator = { bg = "${bg}" }, - -- -- overide which-key fill color with bg color - -- WhichKeyDesc = { fg = "${red}" }, - -- -- overide which-key fill color with bg color - -- WhichKeyFloat = { bg = "${bg}" }, - WhichKeyFloat = { bg = is_transparent and "NONE" or "${bg}" }, - -- -- overide which-key fill color with bg color - -- WhichKeyValue = { bg = "${bg}" }, - -- -- overide which-key fill color with bg color - -- WhichKeyBorder = { bg = "${bg}" }, - }, - }) - end, - }, + -- { "navarasu/onedark.nvim", enabled = false }, + -- { + -- "olimorris/onedarkpro.nvim", + -- priority = 1000, -- Ensure it loads first + -- config = function() + -- local is_transparent = false + -- require("onedarkpro").setup({ + -- styles = { + -- types = "NONE", + -- methods = "NONE", + -- numbers = "NONE", + -- strings = "NONE", + -- comments = "italic", + -- keywords = "bold,italic", + -- constants = "NONE", + -- functions = "italic", + -- operators = "NONE", + -- variables = "NONE", + -- parameters = "NONE", + -- conditionals = "italic", + -- virtual_text = "NONE", + -- tags = "italic", + -- }, + -- colors = { + -- onedark = { + -- green = "#99c379", + -- gray = "#8094b4", + -- red = "#e06c75", + -- purple = "#c678dd", + -- yellow = "#e5c07a", + -- blue = "#61afef", + -- cyan = "#56b6c2", + -- bg_statusline = "#282c34", + -- indentline = "#3b4261", + -- float_bg = "#282c34", + -- }, + -- }, + -- options = { + -- cursorline = true, + -- transparency = is_transparent, + -- terminal_colors = true, + -- }, + -- highlights = { + -- -- overide cursor line fill colors + -- LineNr = { fg = "#49505E" }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + -- CursorLineNr = { fg = "${blue}" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + -- CursorLine = { bg = "#333842" }, + -- Cursor = { fg = "${bg}", bg = "${fg}" }, -- character under the cursor + -- lCursor = { fg = "${bg}", bg = "${fg}" }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') + -- CursorIM = { fg = "${bg}", bg = "${fg}" }, -- like Cursor, but used when in IME mode |CursorIM| + -- CursorColumn = { bg = "#333842" }, -- Screen-column at the cursor, when 'cursorcolumn' is set. + -- -- overide nvimtree folder icon fill color + -- NvimTreeFolderIcon = { fg = "${gray}" }, + -- -- overide nvimtree text fill color folder opened + -- NvimTreeOpenedFolderName = { fg = "${blue}" }, + -- -- overide nvimtree text fill color root folder + -- NvimTreeRootFolder = { fg = "${yellow}" }, + -- NvimTreeSpecialFile = { fg = "${orange}" }, + -- NvimTreeWinSeparator = { fg = "#202329" }, + -- NvimTreeIndentMarker = { fg = "#3E4450" }, + -- -- overide indenline fill color + -- IblIndent = { fg = "#3E4450" }, + -- -- overide cmp cursorline fill color with #333842 + -- PmenuSel = { bg = "#333842" }, + -- illuminatedWord = { bg = "#3b4261" }, + -- illuminatedCurWord = { bg = "#3b4261" }, + -- IlluminatedWordText = { bg = "#3b4261" }, + -- IlluminatedWordRead = { bg = "#3b4261" }, + -- IlluminatedWordWrite = { bg = "#3b4261" }, + -- StatusLine = { fg = "#f8f8f2", bg = is_transparent and "NONE" or "${bg}" }, + -- StatusLineTerm = { fg = "#f8f8f2", bg = "${bg}" }, + -- BufferLineFill = { bg = is_transparent and "NONE" or "${bg}" }, + -- ["@string.special.url.html"] = { fg = "${green}" }, + -- ["@lsp.type.parameter"] = { fg = "${gray}" }, + -- -- ["@text.uri.html"] = { fg = "${green}" }, + -- -- ["@tag.javascript"] = { fg = "${red}" }, + -- -- ["@tag.attribute"] = { fg = "${orange}", style = "italic" }, + -- -- ["@constructor.javascript"] = { fg = "${red}" }, + -- -- ["@variable"] = { fg = "${fg}", style = "NONE" }, -- various variable names + -- -- ["@variable.builtin"] = { fg = "${red}", style = "NONE" }, + -- -- ["@variable.member"] = "${cyan}", + -- -- ["@variable.parameter"] = "${red}", + -- -- ["@property"] = { fg = "${cyan}" }, -- similar to `@field` + -- ["@property.lua"] = { fg = "${red}", bg = "NONE" }, + -- ["@lsp.type.property.lua"] = { fg = "${cyan}", bg = "NONE" }, + -- ["@lsp.type.variable.lua"] = { fg = "${red}", bg = "NONE" }, + -- NvimTreeGitDirty = { fg = "${yellow}" }, + -- Pmenu = { fg = "${fg}", bg = "${bg}" }, + -- PmenuThumb = { bg = "${gray}" }, -- Popup menu: Thumb of the scrollbar. + -- -- overide lualine fill color with bg color + -- LualineNormal = { bg = "${bg}" }, + -- -- overide lualine_c fill color with bg color + -- LualineC = { bg = "${bg}" }, + -- -- overide lualine_x fill color with bg color + -- LualineX = { bg = "${bg}" }, + -- -- overide which-key fill color with bg color + -- -- WhichKey = { bg = "${bg}" }, + -- -- -- overide which-key fill color with bg color + -- -- WhichKeySeperator = { bg = "${bg}" }, + -- -- -- overide which-key fill color with bg color + -- -- WhichKeyDesc = { fg = "${red}" }, + -- -- -- overide which-key fill color with bg color + -- -- WhichKeyFloat = { bg = "${bg}" }, + -- WhichKeyFloat = { bg = is_transparent and "NONE" or "${bg}" }, + -- -- -- overide which-key fill color with bg color + -- -- WhichKeyValue = { bg = "${bg}" }, + -- -- -- overide which-key fill color with bg color + -- -- WhichKeyBorder = { bg = "${bg}" }, + -- }, + -- }) + -- end, + -- }, } diff --git a/lua/custom/plugins/ui.lua b/lua/custom/plugins/ui.lua index a54729c..5049fbd 100644 --- a/lua/custom/plugins/ui.lua +++ b/lua/custom/plugins/ui.lua @@ -17,10 +17,10 @@ return { -- require("user.lualine") -- end, -- }, - { "RRethy/vim-illuminate", event = "InsertEnter", enabled = true }, + -- { "RRethy/vim-illuminate", event = "InsertEnter", enabled = true }, -- { "cpea2506/one_monokai.nvim" }, -- { "luisiacc/gruvbox-baby", lazy = true, enabled = false }, -- { "projekt0n/github-nvim-theme", version = "v0.0.7" }, -- { "stevearc/dressing.nvim", enabled = false }, - { "karb94/neoscroll.nvim", enabled = false }, + -- { "karb94/neoscroll.nvim", enabled = false }, } diff --git a/lua/plugins/breadcrumb.lua b/lua/plugins/breadcrumb.lua new file mode 100644 index 0000000..bde138a --- /dev/null +++ b/lua/plugins/breadcrumb.lua @@ -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, +} diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua new file mode 100644 index 0000000..53a1915 --- /dev/null +++ b/lua/plugins/bufferline.lua @@ -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, +} diff --git a/lua/plugins/coderunner.lua b/lua/plugins/coderunner.lua new file mode 100644 index 0000000..74f2b3d --- /dev/null +++ b/lua/plugins/coderunner.lua @@ -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 = "", + -- 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, +} diff --git a/lua/plugins/colorizer.lua b/lua/plugins/colorizer.lua new file mode 100644 index 0000000..eacd2b1 --- /dev/null +++ b/lua/plugins/colorizer.lua @@ -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 + }, + }, +} diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index c854f81..3655137 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -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 = { diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua new file mode 100644 index 0000000..00ba463 --- /dev/null +++ b/lua/plugins/comment.lua @@ -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, +} diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua new file mode 100644 index 0000000..d260a1c --- /dev/null +++ b/lua/plugins/dap.lua @@ -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, + }, +} diff --git a/lua/plugins/dressing.lua b/lua/plugins/dressing.lua new file mode 100644 index 0000000..ad00f44 --- /dev/null +++ b/lua/plugins/dressing.lua @@ -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, +} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..8438d4c --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -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 = ", - ", + 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, +} diff --git a/lua/plugins/indentblankline.lua b/lua/plugins/indentblankline.lua new file mode 100644 index 0000000..aa2d800 --- /dev/null +++ b/lua/plugins/indentblankline.lua @@ -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", +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..78dc805 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -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, + }, +} diff --git a/lua/plugins/neoscroll.lua b/lua/plugins/neoscroll.lua new file mode 100644 index 0000000..b38698f --- /dev/null +++ b/lua/plugins/neoscroll.lua @@ -0,0 +1,8 @@ +return { + "karb94/neoscroll.nvim", + event = "VeryLazy", + lazy = true, + config = function() + require("neoscroll").setup() + end, +} diff --git a/lua/plugins/notify.lua b/lua/plugins/notify.lua new file mode 100644 index 0000000..6677b57 --- /dev/null +++ b/lua/plugins/notify.lua @@ -0,0 +1,31 @@ +return { + "rcarriga/nvim-notify", + lazy = true, + event = "VeryLazy", + keys = { + { + "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, +} diff --git a/lua/plugins/nvimtree.lua b/lua/plugins/nvimtree.lua new file mode 100644 index 0000000..162f879 --- /dev/null +++ b/lua/plugins/nvimtree.lua @@ -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, +} diff --git a/lua/plugins/plenary.lua b/lua/plugins/plenary.lua new file mode 100644 index 0000000..8a41e0c --- /dev/null +++ b/lua/plugins/plenary.lua @@ -0,0 +1,4 @@ +return { + "nvim-lua/plenary.nvim", + lazy = true, +} diff --git a/lua/plugins/rainbowdelimiter.lua b/lua/plugins/rainbowdelimiter.lua new file mode 100644 index 0000000..069f994 --- /dev/null +++ b/lua/plugins/rainbowdelimiter.lua @@ -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, +} diff --git a/lua/plugins/scrollview.lua b/lua/plugins/scrollview.lua new file mode 100644 index 0000000..ddbc298 --- /dev/null +++ b/lua/plugins/scrollview.lua @@ -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, +} diff --git a/lua/plugins/smartsplit.lua b/lua/plugins/smartsplit.lua new file mode 100644 index 0000000..ebc4b83 --- /dev/null +++ b/lua/plugins/smartsplit.lua @@ -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", "", require("smart-splits").resize_left) + vim.keymap.set("n", "", require("smart-splits").resize_down) + vim.keymap.set("n", "", require("smart-splits").resize_right) + end, +} diff --git a/lua/plugins/snippets.lua b/lua/plugins/snippets.lua new file mode 100644 index 0000000..1f28e95 --- /dev/null +++ b/lua/plugins/snippets.lua @@ -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 = { + { "", function() require("luasnip").jump(1) end, mode = "s" }, + { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, + }, + }, +} diff --git a/lua/plugins/startuptime.lua b/lua/plugins/startuptime.lua new file mode 100644 index 0000000..8fe5e2e --- /dev/null +++ b/lua/plugins/startuptime.lua @@ -0,0 +1 @@ +return { "dstein64/vim-startuptime", lazy = true, cmd = "StartupTime" } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..ae6f9f5 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -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 = { + [""] = 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 = { + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.close, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = actions.results_scrolling_down, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = actions.complete_tag, + [""] = actions.which_key, -- keys from pressing + }, + + n = { + [""] = actions.close, + [""] = actions.select_default, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = 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, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + ["gg"] = actions.move_to_top, + ["G"] = actions.move_to_bottom, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + [""] = actions.results_scrolling_up, + [""] = 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, +} diff --git a/lua/plugins/toggleterm.lua b/lua/plugins/toggleterm.lua new file mode 100644 index 0000000..9df2d00 --- /dev/null +++ b/lua/plugins/toggleterm.lua @@ -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 = [[]], + 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", "", [[]], optsn) + vim.api.nvim_buf_set_keymap(0, "t", "jk", [[]], optsn) + vim.api.nvim_buf_set_keymap(0, "t", "", [[h]], optsn) + vim.api.nvim_buf_set_keymap(0, "t", "", [[j]], optsn) + vim.api.nvim_buf_set_keymap(0, "t", "", [[k]], optsn) + vim.api.nvim_buf_set_keymap(0, "t", "", [[l]], optsn) + end + vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()") + end, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..d0d9c56 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -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 = "", + 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 + 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 + 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 + 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, + }, +} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 889d6b9..c14dbdf 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -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, - }, } diff --git a/lua/plugins/visualmulti.lua b/lua/plugins/visualmulti.lua new file mode 100644 index 0000000..7ba402f --- /dev/null +++ b/lua/plugins/visualmulti.lua @@ -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"] = "", -- equal CTRL+D on VSCODE + ["Find Subword Under"] = "", -- equal CTRL+D on VSCODE + ["Select Cursor Down"] = "", -- equal CTRL+ALT+DOWN on VSCODE + ["Select Cursor Up"] = "", -- equal CTRL+ALT+UP on VSCODE + } + end, +} diff --git a/lua/plugins/webdevicon.lua b/lua/plugins/webdevicon.lua new file mode 100644 index 0000000..24e8ed3 --- /dev/null +++ b/lua/plugins/webdevicon.lua @@ -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, +} diff --git a/lua/plugins/yanky.lua b/lua/plugins/yanky.lua new file mode 100644 index 0000000..3e05197 --- /dev/null +++ b/lua/plugins/yanky.lua @@ -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", "(YankyCycleForward)") + vim.keymap.set("n", "]y", "(YankyCycleBackward)") + end, +} diff --git a/lua/user/lsp/mason.lua b/lua/user/lsp/mason.lua index ae69c32..9ee4f87 100644 --- a/lua/user/lsp/mason.lua +++ b/lua/user/lsp/mason.lua @@ -86,9 +86,6 @@ require("mason-lspconfig").setup_handlers({ is_skip = true end if not is_skip then - -- if server_name == "lua_ls" then - -- server_name = "sumneko_lua" - -- end opts = { on_attach = require("user.lsp.handlers").on_attach, capabilities = require("user.lsp.handlers").capabilities, @@ -118,106 +115,4 @@ require("mason-lspconfig").setup_handlers({ -- }, -- }) -- end, - -- ["tsserver"] = function() - -- lspconfig.tsserver.setup({ - -- on_attach = require("user.lsp.handlers").on_attach, - -- capabilities = require("user.lsp.handlers").capabilities, - -- -- add cmd - -- cmd = { "typescript-language-server", "--stdio" }, - -- -- add file type support - -- filetypes = { - -- "javascript", - -- "javascriptreact", - -- "javascript.jsx", - -- "typescript", - -- "typescriptreact", - -- "typescript.tsx", - -- }, - -- -- add dynamic root dir support - -- root_dir = require("lspconfig.util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), - -- init_options = { - -- hostInfo = "neovim", - -- }, - -- }) - -- end, - -- ["emmet_ls"] = function() - -- lspconfig.emmet_ls.setup({ - -- on_attach = require("user.lsp.handlers").on_attach, - -- capabilities = require("user.lsp.handlers").capabilities, - -- -- add cmd - -- cmd = { "emmet-ls", "-c", "--stdio" }, - -- -- add file type support - -- -- filetypes = { - -- -- "javascript", - -- -- "javascriptreact", - -- -- "javascript.jsx", - -- -- "typescript", - -- -- "typescriptreact", - -- -- "typescript.tsx", - -- -- "astro", - -- -- "css", - -- -- "eruby", - -- -- "html", - -- -- "htmldjango", - -- -- "less", - -- -- "pug", - -- -- "sass", - -- -- "scss", - -- -- "svelte", - -- -- "vue" -- }, - -- -- add dynamic root dir support - -- root_dir = require("lspconfig.util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), - -- }) - -- end, - -- ["eslint"] = function() - -- lspconfig.eslint.setup({ - -- on_attach = require("user.lsp.handlers").on_attach, - -- capabilities = require("user.lsp.handlers").capabilities, - -- -- add cmd - -- cmd = { "vscode-eslint-language-server", "--stdio" }, -- add file type support - -- filetypes = { - -- "javascript", - -- "javascriptreact", - -- "javascript.jsx", - -- "typescript", - -- "typescriptreact", - -- "typescript.tsx", - -- }, - -- -- add dynamic root dir support - -- root_dir = require("lspconfig.util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"), - -- }) - -- end, - -- ["kotlin_language_server"] = function() - -- lspconfig.kotlin_language_server.setup({ - -- on_attach = require("user.lsp.handlers").on_attach, - -- capabilities = require("user.lsp.handlers").capabilities, - -- cmd = { "kotlin-language-server" }, - -- filetypes = { "kotlin" }, - -- root_dir = require("lspconfig.util").root_pattern( - -- "build.gradle.kts", - -- "build.gradle", - -- "settings.gradle", - -- "gradlew", - -- "pom.xml", - -- "build.gradle.kts", - -- "build.kts", - -- ".git" - -- ), - -- }) - -- end, - -- ["clangd"] = function() - -- lspconfig.clangd.setup({ - -- on_attach = require("user.lsp.handlers").on_attach, - -- capabilities = require("user.lsp.handlers").capabilities, - -- root_dir = require("lspconfig.util").root_pattern( - -- "build", - -- "compile_commands.json", - -- ".git", - -- "mvnw", - -- "gradlew", - -- "pom.xml", - -- "build.gradle" - -- ) or vim.loop.cwd() or vim.fn.getcwd(), - -- }) - -- end, }) diff --git a/lua/user/lsp/settings/eslint.lua b/lua/user/lsp/settings/eslint.lua index fc6e6fc..0f6e237 100644 --- a/lua/user/lsp/settings/eslint.lua +++ b/lua/user/lsp/settings/eslint.lua @@ -1,20 +1,20 @@ return { - cmd = { "vscode-eslint-language-server", "--stdio" }, -- add file type support - filetypes = { - "javascript", - "javascriptreact", - "javascript.jsx", - "typescript", - "typescriptreact", - "typescript.tsx", - }, - -- add dynamic root dir support - root_dir = require("lspconfig.util").root_pattern( - "package.json", - "tsconfig.json", - "jsconfig.json", - ".eslintrc.json", - ".eslintrc.js", - ".eslintrc.cjs" - ), + -- cmd = { "vscode-eslint-language-server", "--stdio" }, -- add file type support + -- filetypes = { + -- "javascript", + -- "javascriptreact", + -- "javascript.jsx", + -- "typescript", + -- "typescriptreact", + -- "typescript.tsx", + -- }, + -- -- add dynamic root dir support + -- root_dir = require("lspconfig.util").root_pattern( + -- "package.json", + -- "tsconfig.json", + -- "jsconfig.json", + -- ".eslintrc.json", + -- ".eslintrc.js", + -- ".eslintrc.cjs" + -- ), } diff --git a/lua/user/utils.lua b/lua/user/utils.lua new file mode 100644 index 0000000..809caf3 --- /dev/null +++ b/lua/user/utils.lua @@ -0,0 +1,131 @@ +local M = {} +function M.bufremove(buf) + buf = buf or 0 + buf = buf == 0 and vim.api.nvim_get_current_buf() or buf + + if vim.bo.modified then + local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel") + if choice == 0 then -- Cancel + return + end + if choice == 1 then -- Yes + vim.cmd.write() + end + end + + for _, win in ipairs(vim.fn.win_findbuf(buf)) do + vim.api.nvim_win_call(win, function() + if not vim.api.nvim_win_is_valid(win) or vim.api.nvim_win_get_buf(win) ~= buf then + return + end + -- Try using alternate buffer + local alt = vim.fn.bufnr("#") + if alt ~= buf and vim.fn.buflisted(alt) == 1 then + vim.api.nvim_win_set_buf(win, alt) + return + end + + -- Try using previous buffer + local has_previous = pcall(vim.cmd, "bprevious") + if has_previous and buf ~= vim.api.nvim_win_get_buf(win) then + return + end + + -- Create new listed buffer + local new_buf = vim.api.nvim_create_buf(true, false) + vim.api.nvim_win_set_buf(win, new_buf) + end) + end + if vim.api.nvim_buf_is_valid(buf) then + pcall(vim.cmd, "bdelete! " .. buf) + end +end + +function M._LAZYGIT_TOGGLE() + local Terminal = require("toggleterm.terminal").Terminal + local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) + lazygit:toggle() +end + +function M._NODE_TOGGLE() + local Terminal = require("toggleterm.terminal").Terminal + local node = Terminal:new({ cmd = "node", hidden = true }) + node:toggle() +end + +function M._BTOP_TOGGLE() + local Terminal = require("toggleterm.terminal").Terminal + local htop = Terminal:new({ cmd = "btop", hidden = true }) + htop:toggle() +end + +function M._PYTHON_TOGGLE() + local Terminal = require("toggleterm.terminal").Terminal + local python = Terminal:new({ cmd = "python", hidden = true }) + python:toggle() +end + +function M._NEWTAB_TOGGLE() + local Terminal = require("toggleterm.terminal").Terminal + local pwsh = Terminal:new({ cmd = "pwsh", hidden = true, direction = "tab" }) + pwsh:toggle() +end + +function M._OPEN_EXPLORER() + local Terminal = require("toggleterm.terminal").Terminal + local pwsh = Terminal:new({ cmd = "explorer .", hidden = true, direction = "tab" }) + pwsh:toggle() +end + +function M._LIVE_SERVER() + local Terminal = require("toggleterm.terminal").Terminal + local live_server = Terminal:new({ + cmd = "live-server", + hidden = true, + direction = "tab", + }) + live_server:toggle() +end + +function M._OPEN_ALACRITTY() + -- open alacritty new windows current directory + vim.cmd("silent !alacritty --working-directory " .. vim.fn.getcwd()) +end + +function M._OPEN_WEZTERM() + -- open wezterm new windows current directory + vim.cmd("silent !wezterm start --cwd " .. vim.fn.getcwd()) +end + +-- get folder name from current directory +function M._get_folder_name() + return vim.fn.fnamemodify(vim.fn.getcwd(), ":t") +end + +function M._OPEN_WEZTERM_TAB() + -- open new tab wezterm current directory + vim.cmd('silent !wezterm cli spawn --cwd "' .. vim.fn.getcwd() .. '"') +end + +function M._SET_TAB_TITLE() + -- set tab title + vim.cmd('silent !wezterm cli set-tab-title "' .. _get_folder_name() .. '"') +end + +function M._CLOSE_BUFFER() + local buf = vim.api.nvim_get_current_buf() + -- delete current buffer + require("bufdelete").bufdelete(buf, true) +end + +-- function for close all bufferline +function M._CLOSE_ALL_BUFFER() + -- get all buffer + local bufs = vim.api.nvim_list_bufs() + -- loop through all buffer + for _, buf in pairs(bufs) do + require("user.utils").bufdelete(buf) + end +end + +return M diff --git a/lua/user/whichkey.lua b/lua/user/whichkey.lua index 2f6cbb2..6be11a8 100644 --- a/lua/user/whichkey.lua +++ b/lua/user/whichkey.lua @@ -5,109 +5,9 @@ end -- config for toggleterm -function _LAZYGIT_TOGGLE() - local Terminal = require("toggleterm.terminal").Terminal - local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) - lazygit:toggle() -end - -function _NODE_TOGGLE() - local Terminal = require("toggleterm.terminal").Terminal - local node = Terminal:new({ cmd = "node", hidden = true }) - node:toggle() -end - --- function _NCDU_TOGGLE() --- local Terminal = require("toggleterm.terminal").Terminal --- local ncdu = Terminal:new({ cmd = "ncdu", hidden = true }) --- ncdu:toggle() --- end - -function _HTOP_TOGGLE() - local Terminal = require("toggleterm.terminal").Terminal - local htop = Terminal:new({ cmd = "htop", hidden = true }) - htop:toggle() -end - -function _BTOP_TOGGLE() - local Terminal = require("toggleterm.terminal").Terminal - local htop = Terminal:new({ cmd = "btop", hidden = true }) - htop:toggle() -end - -function _BTM_TOGGLE() - local Terminal = require("toggleterm.terminal").Terminal - local htop = Terminal:new({ cmd = "btm", hidden = true }) - htop:toggle() -end - -function _PYTHON_TOGGLE() - local Terminal = require("toggleterm.terminal").Terminal - local python = Terminal:new({ cmd = "python", hidden = true }) - python:toggle() -end - -function _NEWTAB_TOGGLE() - local Terminal = require("toggleterm.terminal").Terminal - local pwsh = Terminal:new({ cmd = "pwsh", hidden = true, direction = "tab" }) - pwsh:toggle() -end - -function _OPEN_EXPLORER() - local Terminal = require("toggleterm.terminal").Terminal - local pwsh = Terminal:new({ cmd = "explorer .", hidden = true, direction = "tab" }) - pwsh:toggle() -end - -function _LIVE_SERVER() - local Terminal = require("toggleterm.terminal").Terminal - local live_server = Terminal:new({ - cmd = "live-server", - hidden = true, - direction = "tab", - }) - live_server:toggle() -end - -function _OPEN_ALACRITTY() - -- open alacritty new windows current directory - vim.cmd("silent !alacritty --working-directory " .. vim.fn.getcwd()) -end - -function _OPEN_WEZTERM() - -- open wezterm new windows current directory - vim.cmd("silent !wezterm start --cwd " .. vim.fn.getcwd()) -end - --- get folder name from current directory -local _get_folder_name = function() - return vim.fn.fnamemodify(vim.fn.getcwd(), ":t") -end - -function _OPEN_WEZTERM_TAB() - -- open new tab wezterm current directory - vim.cmd('silent !wezterm cli spawn --cwd "' .. vim.fn.getcwd() .. '"') -end - function _SET_TAB_TITLE() -- set tab title - vim.cmd('silent !wezterm cli set-tab-title "' .. _get_folder_name() .. '"') -end - -function _CLOSE_BUFFER() - local buf = vim.api.nvim_get_current_buf() - -- delete current buffer - require("bufdelete").bufdelete(buf, true) -end - --- function for close all bufferline -function _CLOSE_ALL_BUFFER() - -- get all buffer - local bufs = vim.api.nvim_list_bufs() - -- loop through all buffer - for _, buf in pairs(bufs) do - require("bufdelete").bufdelete(buf, true) - end + vim.cmd('silent !wezterm cli set-tab-title "' .. require("user.utils")._get_folder_name() .. '"') end local icons = require("user.icons") @@ -176,7 +76,6 @@ local setup = { i = { "j", "k" }, v = { "j", "k" }, }, - -- disable the WhichKey popup for certain buf types and file types. -- Disabled by default for Telescope disable = { buftypes = {}, @@ -202,19 +101,8 @@ local opts2 = { nowait = true, -- use `nowait` when creating keymaps } --- local trn = "" --- if vim.fn.has("win32") == 1 then --- trn = "pwsh" --- end -- for debug local debug_key = {} --- local trasparant = {} --- local is_dap = pcall(require, "dap") - --- local trans_ok, _ = pcall(require, "transparent") --- if trans_ok then --- trasparant = { "TransparentToggle", "Toggle Transparency" } --- end if vim.fn.has("win32") == 0 then debug_key = { @@ -240,45 +128,27 @@ local mappings2 = { ["/"] = { "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", " 󰆈 Commet Block" }, } local mappings = { - -- ["c"] = trasparant, ["a"] = { "Alpha", "󰕮 Alpha" }, - --["e"] = { "NvimTreeToggle", "Explorer" }, - ["e"] = { "NvimTreeToggle", "󰙅 Explorer" }, + ["e"] = { "NvimTreeToggle", "󰙅 Explorer" }, ["w"] = { "w!", "󰆓 Save" }, ["q"] = { "q!", "󰿅 Quit" }, - -- ["c"] = { "Bdelete!", "󰅗 Close Buffer" }, - -- ["k"] = { "lua _close_buffer()", "󰅗 Close Buffer" }, -- open exloler and close toggleterm - ["o"] = { "lua _OPEN_EXPLORER()lua require('toggleterm').toggle()", "󱏒 Open Explorer" }, + ["o"] = { + "lua require('user.utils')._OPEN_EXPLORER()", + "󱏒 Open Explorer", + }, ["h"] = { "nohlsearch", "󱪿 No Highlight" }, ["f"] = { "Telescope find_files ", " Find files", }, ["F"] = { "Telescope live_grep theme=ivy", " Find Text" }, - -- ["P"] = { "lua require('telescope').extensions.projects.projects()", "Projects" }, - -- ["z"] = { "Lazy", "Lazy" }, - ["/"] = { function() require("Comment.api").toggle.linewise.current() end, "󰆈 Coment line", }, - -- ["m"] = { - -- name = "Markdown", - -- p = { "MarkdownPreview", "Preview" }, - -- s = { "MarkdownPreviewStop", "Stop Preview" }, - -- }, - -- p = { - -- name = "Packer", - -- c = { "PackerCompile", "Compile" }, - -- i = { "PackerInstall", "Install" }, - -- s = { "PackerSync", "Sync" }, - -- S = { "PackerStatus", "Status" }, - -- u = { "PackerUpdate", "Update" }, - -- }, - b = { name = "  Buffers", -- show all buffers with telescope @@ -287,7 +157,7 @@ local mappings = { "All Buffer", }, -- close current active buffer - c = { "lua _CLOSE_BUFFER()", "Close current buffer" }, + c = { "lua require('user.utils').bufremove()", "Close current buffer" }, -- bufferline close left d = { "BufferLineCloseLeft", @@ -312,7 +182,7 @@ local mappings = { g = { name = "  Git", - g = { "lua _LAZYGIT_TOGGLE()", "Lazygit" }, + g = { "lua require('user.utils')._LAZYGIT_TOGGLE()", "Lazygit" }, j = { "lua require 'gitsigns'.next_hunk()", "Next Hunk" }, k = { "lua require 'gitsigns'.prev_hunk()", "Prev Hunk" }, l = { "lua require 'gitsigns'.blame_line()", "Blame" }, @@ -378,24 +248,19 @@ local mappings = { t = { name = "  Terminal", - -- l = { "lua _LIVE_SERVER()", "Live Server" }, l = { "terminal live-server", "Live Server" }, - P = { "lua _NEWTAB_TOGGLE()", "Power Shell" }, - -- l = { "ToggleTerm direction=tablive-server", "Live Server" }, + P = { "lua require('user.utils')._NEWTAB_TOGGLE()", "Power Shell" }, x = { "ToggleTermToggleAll!", "Close Tab" }, - n = { "lua _NODE_TOGGLE()", "Node" }, - -- u = { "lua _NCDU_TOGGLE()", "NCDU" }, - -- t = { "lua _HTOP_TOGGLE()", "Htop" }, - b = { "lua _BTOP_TOGGLE()", "Btop" }, - -- B = { "lua _BTM_TOGGLE()", "Boottom" }, - p = { "lua _PYTHON_TOGGLE()", "Python" }, + n = { "lua require('user.utils')._NODE_TOGGLE()", "Node" }, + b = { "lua require('user.utils')._BTOP_TOGGLE()", "Btop" }, + p = { "lua require('user.utils')._PYTHON_TOGGLE()", "Python" }, f = { "ToggleTerm direction=float", "Float" }, h = { "ToggleTerm size=10 direction=horizontal", "Horizontal" }, v = { "ToggleTerm size=80 direction=vertical", "Vertical" }, s = { "ToggleTerm direction=tab", "New Tab" }, - a = { "lua _OPEN_ALACRITTY()", "Open Alacritty" }, - w = { "lua _OPEN_WEZTERM()", "Open Wezterm" }, - t = { "lua _OPEN_WEZTERM_TAB()", "Open Tab Wezterm" }, + a = { "lua require('user.utils')._OPEN_ALACRITTY()", "Open Alacritty" }, + w = { "lua require('user.utils')._OPEN_WEZTERM()", "Open Wezterm" }, + t = { "lua require('user.utils')._OPEN_WEZTERM_TAB()", "Open Tab Wezterm" }, j = { "lua _SET_TAB_TITLE()", "Set Tab Title" }, }, r = { @@ -413,142 +278,7 @@ local mappings = { "terminal mvn package", "MVN Build", }, - -- m = { - -- name = "Maven", - -- b = { "terminal mvn package", "MVN Build" }, - -- r = { "terminal java -jar target/my-app.jar", "Run JAR" }, - -- }, }, - -- D = { - -- name = "Debug", - -- b = { - -- function() - -- if is_dap then - -- require("dap").toggle_breakpoint() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Toggle Breakpoint", - -- }, - -- B = { - -- function() - -- if is_dap then - -- require("dap").clear_breakpoints() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Clear Breakpoints", - -- }, - -- c = { - -- function() - -- if is_dap then - -- require("dap").continue() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Start/Continue", - -- }, - -- i = { - -- function() - -- if is_dap then - -- require("dap").step_into() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Step Into (F11)", - -- }, - -- o = { - -- function() - -- if is_dap then - -- require("dap").step_over() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Step Over (F10)", - -- }, - -- O = { - -- function() - -- if is_dap then - -- require("dap").step_out() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Step Out (S-F11)", - -- }, - -- q = { - -- function() - -- if is_dap then - -- require("dap").close() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Close Session", - -- }, - -- Q = { - -- function() - -- if is_dap then - -- require("dap").terminate() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Terminate Session (S-F5)", - -- }, - -- p = { - -- function() - -- if is_dap then - -- require("dap").pause() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Pause (F6)", - -- }, - -- r = { - -- function() - -- if is_dap then - -- require("dap").restart_frame() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Restart (C-F5)", - -- }, - -- R = { - -- function() - -- if is_dap then - -- require("dap").repl.toggle() - -- else - -- vim.notify("DAP Not Support", "info") - -- end - -- end, - -- "Toggle REPL", - -- }, - -- }, - -- d = { - -- name = "Debug", - -- t = { "lua require'dap'.toggle_breakpoint()", "Toggle Breakpoint" }, - -- b = { "lua require'dap'.step_back()", "Step Back" }, - -- c = { "lua require'dap'.continue()", "Continue" }, - -- C = { "lua require'dap'.run_to_cursor()", "Run To Cursor" }, - -- d = { "lua require'dap'.disconnect()", "Disconnect" }, - -- g = { "lua require'dap'.session()", "Get Session" }, - -- i = { "lua require'dap'.step_into()", "Step Into" }, - -- o = { "lua require'dap'.step_over()", "Step Over" }, - -- u = { "lua require'dap'.step_out()", "Step Out" }, - -- p = { "lua require'dap'.pause()", "Pause" }, - -- r = { "lua require'dap'.repl.toggle()", "Toggle Repl" }, - -- s = { "lua require'dap'.continue()", "Start" }, - -- q = { "lua require'dap'.close()", "Quit" }, - -- U = { "lua require'dapui'.toggle({reset = true})", "Toggle UI" }, - -- }, d = debug_key, z = { name = " 󱑠 Plugins(Lazy)",