From 5604b29cdc0b2be04831382f10dbaaa09414f2e4 Mon Sep 17 00:00:00 2001 From: doryan Date: Thu, 12 Dec 2024 14:07:56 +0400 Subject: [PATCH] feat: first commit --- .stylua.toml | 6 - lua/chadrc.lua | 16 --- lua/config/lazy.lua | 25 +++++ lua/config/plugins/acmp.lua | 5 + lua/config/plugins/autocommand.lua | 13 +++ lua/config/plugins/autotag.lua | 7 ++ lua/config/plugins/bufferline.lua | 27 +++++ lua/config/plugins/colorizer.lua | 12 ++ lua/config/plugins/comment.lua | 43 +++++++ lua/config/plugins/dap.lua | 99 ++++++++++++++++ lua/config/plugins/dropbar.lua | 30 +++++ lua/config/plugins/gitsigns.lua | 67 +++++++++++ lua/config/plugins/lualine.lua | 59 ++++++++++ lua/config/plugins/luasnip.lua | 22 ++++ lua/config/plugins/navic.lua | 46 ++++++++ lua/config/plugins/neotree.lua | 52 +++++++++ lua/config/plugins/noice.lua | 19 ++++ lua/config/plugins/nvimufo.lua | 28 +++++ lua/config/plugins/prettier.lua | 19 ++++ lua/config/plugins/treesitter.lua | 8 ++ lua/config/plugins/winbar.lua | 36 ++++++ lua/configs/conform.lua | 15 --- lua/configs/lazy.lua | 47 -------- lua/configs/lspconfig.lua | 23 ---- lua/mappings.lua | 54 ++++++++- lua/options.lua | 6 - lua/plugins/core/init.lua | 175 +++++++++++++++++++++++++++++ lua/plugins/init.lua | 38 ------- lua/plugins/secondary/init.lua | 50 +++++++++ 29 files changed, 890 insertions(+), 157 deletions(-) delete mode 100644 .stylua.toml delete mode 100644 lua/chadrc.lua create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/plugins/acmp.lua create mode 100644 lua/config/plugins/autocommand.lua create mode 100644 lua/config/plugins/autotag.lua create mode 100644 lua/config/plugins/bufferline.lua create mode 100644 lua/config/plugins/colorizer.lua create mode 100644 lua/config/plugins/comment.lua create mode 100755 lua/config/plugins/dap.lua create mode 100644 lua/config/plugins/dropbar.lua create mode 100644 lua/config/plugins/gitsigns.lua create mode 100644 lua/config/plugins/lualine.lua create mode 100644 lua/config/plugins/luasnip.lua create mode 100644 lua/config/plugins/navic.lua create mode 100644 lua/config/plugins/neotree.lua create mode 100644 lua/config/plugins/noice.lua create mode 100644 lua/config/plugins/nvimufo.lua create mode 100644 lua/config/plugins/prettier.lua create mode 100644 lua/config/plugins/treesitter.lua create mode 100644 lua/config/plugins/winbar.lua delete mode 100644 lua/configs/conform.lua delete mode 100644 lua/configs/lazy.lua delete mode 100644 lua/configs/lspconfig.lua delete mode 100644 lua/options.lua create mode 100644 lua/plugins/core/init.lua delete mode 100644 lua/plugins/init.lua create mode 100644 lua/plugins/secondary/init.lua diff --git a/.stylua.toml b/.stylua.toml deleted file mode 100644 index ecb6dca..0000000 --- a/.stylua.toml +++ /dev/null @@ -1,6 +0,0 @@ -column_width = 120 -line_endings = "Unix" -indent_type = "Spaces" -indent_width = 2 -quote_style = "AutoPreferDouble" -call_parentheses = "None" diff --git a/lua/chadrc.lua b/lua/chadrc.lua deleted file mode 100644 index 2b575e1..0000000 --- a/lua/chadrc.lua +++ /dev/null @@ -1,16 +0,0 @@ --- This file needs to have same structure as nvconfig.lua --- https://github.com/NvChad/ui/blob/v2.5/lua/nvconfig.lua - ----@type ChadrcConfig -local M = {} - -M.ui = { - theme = "onedark", - - -- hl_override = { - -- Comment = { italic = true }, - -- ["@comment"] = { italic = true }, - -- }, -} - -return M diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..547dbb1 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,25 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +require("lazy").setup({ + spec = { + { import = "plugins.core", }, + { import = "plugins.secondary", }, + }, +}) diff --git a/lua/config/plugins/acmp.lua b/lua/config/plugins/acmp.lua new file mode 100644 index 0000000..59692fd --- /dev/null +++ b/lua/config/plugins/acmp.lua @@ -0,0 +1,5 @@ +-- require'cmp'.setup { +-- sources = { +-- { name = 'nvim_lsp' } +-- } +-- } diff --git a/lua/config/plugins/autocommand.lua b/lua/config/plugins/autocommand.lua new file mode 100644 index 0000000..4412827 --- /dev/null +++ b/lua/config/plugins/autocommand.lua @@ -0,0 +1,13 @@ +vim.api.nvim_create_autocmd( + { + "BufNewFile", + "BufRead", + }, + { + pattern = "*.typ", + callback = function() + local buf = vim.api.nvim_get_current_buf() + vim.api.nvim_buf_set_option(buf, "filetype", "typst") + end + } +) diff --git a/lua/config/plugins/autotag.lua b/lua/config/plugins/autotag.lua new file mode 100644 index 0000000..3be1748 --- /dev/null +++ b/lua/config/plugins/autotag.lua @@ -0,0 +1,7 @@ +require('nvim-ts-autotag').setup({ + opts = { + enable_close = true, + enable_rename = true, + enable_close_on_slash = false + }, +}) diff --git a/lua/config/plugins/bufferline.lua b/lua/config/plugins/bufferline.lua new file mode 100644 index 0000000..bf42dc6 --- /dev/null +++ b/lua/config/plugins/bufferline.lua @@ -0,0 +1,27 @@ +vim.opt.termguicolors = true + +require("bufferline").setup({ + highlights = { + background = { + italic = false, + }, + buffer_selected = { + bold = true, + }, + }, + options = { + mode = "buffers", + persist_buffer_sort = true, + enforce_regular_tabs = false, + always_show_bufferline = false, + offsets = { + { + filetype = "NeoTree", + text = "File Explorer", + highlight = "Directory", + separator = true, + } + } + } +}) + diff --git a/lua/config/plugins/colorizer.lua b/lua/config/plugins/colorizer.lua new file mode 100644 index 0000000..2c9bb5b --- /dev/null +++ b/lua/config/plugins/colorizer.lua @@ -0,0 +1,12 @@ + require("colorizer").setup { + filetypes = { "scss", "sass", "css", "html", "jsx", "tsx" }, + user_default_options = { + css = true, + css_fn = true, + mode = "background", + tailwind = true, + sass = { enable = true, parsers = { "css" }, }, + always_update = false + }, + buftypes = {}, + } diff --git a/lua/config/plugins/comment.lua b/lua/config/plugins/comment.lua new file mode 100644 index 0000000..09e798b --- /dev/null +++ b/lua/config/plugins/comment.lua @@ -0,0 +1,43 @@ +require("Comment").setup({ + ---Add a space b/w comment and the line + padding = true, + ---Whether the cursor should stay at its position + sticky = true, + ---Lines to be ignored while (un)comment + ignore = nil, + ---LHS of toggle mappings in NORMAL mode + toggler = { + ---Line-comment toggle keymap + line = '/', + ---Block-comment toggle keymap + block = '/', + }, + ---LHS of operator-pending mappings in NORMAL and VISUAL mode + opleader = { + ---Line-comment keymap + line = 'gc', + ---Block-comment keymap + block = 'gb', + }, + ---LHS of extra mappings + extra = { + ---Add comment on the line above + above = 'gcO', + ---Add comment on the line below + below = 'gco', + ---Add comment at the end of line + eol = 'gcA', + }, + ---Enable keybindings + ---NOTE: If given `false` then the plugin won't create any mappings + mappings = { + ---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}` + basic = true, + ---Extra mapping; `gco`, `gcO`, `gcA` + extra = true, + }, + ---Function to call before (un)comment + pre_hook = nil, + ---Function to call after (un)comment + post_hook = nil, +}) diff --git a/lua/config/plugins/dap.lua b/lua/config/plugins/dap.lua new file mode 100755 index 0000000..19477da --- /dev/null +++ b/lua/config/plugins/dap.lua @@ -0,0 +1,99 @@ +local dap = require('dap') + +require("dap-vscode-js").setup({ + debugger_path = "/.local/share/lunarvim/site/pack/lazy/opt/vscode-js-debug", + debugger_cmd = { "js-debug-adapter" }, + adapters = { 'node-terminal' }, + }) + +dap.configurations.cpp = { + { + name = "Launch file", + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + }, +} + +dap.configurations.c = dap.configurations.cpp +dap.configurations.rust = dap.configurations.cpp + +dap.adapters["pwa-node"] = { + type = "server", + host = "localhost", + port = "${port}", + executable = { + command = "node", + args = {os.getenv("HOME") .. "/.local/share/lvim/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js", "${port}"}, + } +} + +dap.configurations.javascript = { + { + type = "pwa-node", + request = "launch", + name = "Launch file", + program = "${file}", + cwd = "${workspaceFolder}", + }, +} + +dap.adapters.chrome = { + type = "executable", + command = "node", + args = {os.getenv("HOME") .. "/.local/share/lvim/mason/packages/chrome-debug-adapter/out/src/chromeDebug.js"}, +} + +dap.adapters.firefox = { + type = 'executable', + command = 'node', + args = {os.getenv('HOME') .. '/.local/share/lvim/mason/packages/firefox-debug-adapter/dist/adapter.bundle.js'}, +} + +dap.configurations.typescriptreact = { + { + name = 'Next.js: debug server-side', + type = "pwa-node", + request = "launch", + runtimeExecutable = "npm", + runtimeArgs = { "run", "dev" }, + cwd = "${workspaceFolder}", + }, + { + name = "Next.js: debug client-side with chrome", + type = "chrome", + request = "launch", + url = "http://localhost:3000" + }, + { + name = "Next.js: debug client-side with firefox", + type = "firefox", + request = "launch", + url = 'http://localhost:3000', + webRoot = '${workspaceFolder}', + firefoxExecutable = '/usr/bin/waterfox', + pathMappings = { + { + url = "webpack://_n_e/", + path = "${workspaceFolder}/" + } + }, + }, +} + +dap.configurations.javascriptreact = dap.configurations.typescriptreact; + +require("dapui").setup() + +local dap, dapui = require("dap"), require("dapui") + +dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open({}) +end + +vim.keymap.set('n', 'ui', require 'dapui'.toggle) + diff --git a/lua/config/plugins/dropbar.lua b/lua/config/plugins/dropbar.lua new file mode 100644 index 0000000..0b31b07 --- /dev/null +++ b/lua/config/plugins/dropbar.lua @@ -0,0 +1,30 @@ +local sources = require("dropbar.sources") + +local function get_hl_color(group, attr) + return vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID(group)), attr) +end + +vim.cmd [[hi WinBar guisp=#665c54 guibg=#313131]] +vim.cmd [[hi WinBarNC guisp=#665c54 guibg=#313131]] + +require("dropbar").setup( + { + bar = { + sources = { + { + get_symbols = function(buf, win, cursor) + local symbols = sources.path.get_symbols(buf, win, cursor) + for _, symbol in ipairs(symbols) do + local icon_fg = get_hl_color(symbol.icon_hl, "fg#") + + local icon_string = "" + + vim.cmd(icon_string) + end + return symbols + end + } + } + } + } +) diff --git a/lua/config/plugins/gitsigns.lua b/lua/config/plugins/gitsigns.lua new file mode 100644 index 0000000..7d581eb --- /dev/null +++ b/lua/config/plugins/gitsigns.lua @@ -0,0 +1,67 @@ +require("gitsigns").setup({ + signs = { + add = { + text = " ┃", + }, + change = { + text = " ┃", + }, + delete = { + text = " ", + }, + topdelete = { + text = " ", + }, + changedelete = { + text = " ┃", + }, + }, + signs_staged = { + add = { + text = " ┃", + }, + change = { + text = " ┃", + }, + delete = { + text = " ", + }, + topdelete = { + text = " ", + }, + changedelete = { + text = " ┃", + }, + }, + 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 }, +}) + diff --git a/lua/config/plugins/lualine.lua b/lua/config/plugins/lualine.lua new file mode 100644 index 0000000..b2b1072 --- /dev/null +++ b/lua/config/plugins/lualine.lua @@ -0,0 +1,59 @@ +require("lualine").setup({ + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + always_show_tabline = true, + globalstatus = true, + refresh = { + statusline = 100, + tabline = 100, + winbar = 100, + } + }, + sections = { + lualine_a = { + { + function() + return "  " + end, + padding = { left = 0, right = 0 }, + color = {}, + cond = nil, + }, + }, + lualine_b = {'branch'}, + lualine_c = {'diff'}, + lualine_x = {'encoding', 'filetype', 'diagnostics', 'lsp'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = { + { + function() + return "  " + end, + padding = { left = 0, right = 0 }, + color = {}, + cond = nil, + }, + }, + lualine_b = {'branch'}, + lualine_c = {'diff'}, + lualine_x = {'encoding', 'filetype', 'diagnostics', 'lsp'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +}) diff --git a/lua/config/plugins/luasnip.lua b/lua/config/plugins/luasnip.lua new file mode 100644 index 0000000..18a6094 --- /dev/null +++ b/lua/config/plugins/luasnip.lua @@ -0,0 +1,22 @@ +-- vscode format +require("luasnip.loaders.from_vscode").lazy_load { exclude = vim.g.vscode_snippets_exclude or {} } +require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" } + +-- snipmate format +require("luasnip.loaders.from_snipmate").load() +require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" } + +-- lua format +require("luasnip.loaders.from_lua").load() +require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" } + +vim.api.nvim_create_autocmd("InsertLeave", { + callback = function() + if + require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] + and not require("luasnip").session.jump_active + then + require("luasnip").unlink_current() + end + end, +}) diff --git a/lua/config/plugins/navic.lua b/lua/config/plugins/navic.lua new file mode 100644 index 0000000..6e5d4d0 --- /dev/null +++ b/lua/config/plugins/navic.lua @@ -0,0 +1,46 @@ +local navic = require("nvim-navic") + +navic.setup { + icons = { + File = "󰈙 ", + Module = " ", + Namespace = "󰌗 ", + Package = " ", + Class = "󰌗 ", + Method = "󰆧 ", + Property = " ", + Field = " ", + Constructor = " ", + Enum = "󰕘", + Interface = "󰕘", + Function = "󰊕 ", + Variable = "󰆧 ", + Constant = "󰏿 ", + String = "󰀬 ", + Number = "󰎠 ", + Boolean = "◩ ", + Array = "󰅪 ", + Object = "󰅩 ", + Key = "󰌋 ", + Null = "󰟢 ", + EnumMember = " ", + Struct = "󰌗 ", + Event = " ", + Operator = "󰆕 ", + TypeParameter = "󰊄 ", + }, + lsp = { + auto_attach = false, + preference = nil, + }, + highlight = true, + seperator = ' ', + depth_limit = 0, + depth_limit_indicator = "..", + safe_output = true, + lazy_update_context = false, + click = false, + format_text = function(text) + return text + end, +} diff --git a/lua/config/plugins/neotree.lua b/lua/config/plugins/neotree.lua new file mode 100644 index 0000000..e54cc91 --- /dev/null +++ b/lua/config/plugins/neotree.lua @@ -0,0 +1,52 @@ +vim.fn.sign_define("LspDiagnosticsSignError", + {text = "󰅙 ", texthl = "LspDiagnosticsSignError"}) +vim.fn.sign_define("LspDiagnosticsSignWarning", + {text = "󱇎 ", texthl = "LspDiagnosticsSignWarning"}) +vim.fn.sign_define("LspDiagnosticsSignInformation", + {text = "󰰄 ", texthl = "LspDiagnosticsSignInformation"}) +vim.fn.sign_define("LspDiagnosticsSignHint", + {text = "󰐗 ", texthl = "LspDiagnosticsSignHint"}) + +require("neo-tree").setup({ + close_if_last_window = false, + popup_border_style = "rounded", + enable_git_status = true, + enable_diagnostics = true, + open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, + sort_case_insensitive = false, + sort_function = nil , + default_component_configs = { + indent = { + with_expanders = true, + }, + icon = { + folder_closed = "󰉋", + folder_open = "󰝰", + folder_empty = "󰉖", + default = "*", + highlight = "NeoTreeFileIcon" + }, + modified = { + symbol = "󰧞", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + added = "󰜄", + modified = "󰑕", + deleted = "󰅗", + renamed = "󰛂", + untracked = "󰞋", + ignored = "󰿠", + unstaged = "󰄱", + staged = "󰄵", + conflict = "", + } + }, + }, +}) diff --git a/lua/config/plugins/noice.lua b/lua/config/plugins/noice.lua new file mode 100644 index 0000000..2926958 --- /dev/null +++ b/lua/config/plugins/noice.lua @@ -0,0 +1,19 @@ +require("noice").setup({ + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, +}) + diff --git a/lua/config/plugins/nvimufo.lua b/lua/config/plugins/nvimufo.lua new file mode 100644 index 0000000..33725ca --- /dev/null +++ b/lua/config/plugins/nvimufo.lua @@ -0,0 +1,28 @@ +vim.o.foldcolumn = "auto:9" +vim.o.foldlevel = 99 +vim.o.foldlevelstart = 99 +vim.o.foldenable = true +vim.o.fillchars = [[eob: ,fold: ,foldopen:󰅀,foldsep:│,foldclose:󰅂]] + +vim.keymap.set('n', 'zR', require('ufo').openAllFolds) +vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) + +require('ufo').setup({ + open_fold_hl_timeout = 400, + close_fold_kinds = { "imports", "comment" }, + preview = { + win_config = { + border = { "", "─", "", "", "", "─", "", "" }, + winblend = 0, + }, + mappings = { + scrollU = "", + scrollD = "", + jumpTop = "[", + jumpBot = "]", + }, + }, + provider_selector = function(bufnr, filetype, buftype) + return {'treesitter', 'indent'} + end +}) diff --git a/lua/config/plugins/prettier.lua b/lua/config/plugins/prettier.lua new file mode 100644 index 0000000..e039edd --- /dev/null +++ b/lua/config/plugins/prettier.lua @@ -0,0 +1,19 @@ +local prettier = require("prettier") + +prettier.setup({ + bin = 'prettier', + filetypes = { + "css", + "graphql", + "html", + "javascript", + "javascriptreact", + "json", + "less", + "markdown", + "scss", + "typescript", + "typescriptreact", + "yaml", + }, +}) diff --git a/lua/config/plugins/treesitter.lua b/lua/config/plugins/treesitter.lua new file mode 100644 index 0000000..92837bf --- /dev/null +++ b/lua/config/plugins/treesitter.lua @@ -0,0 +1,8 @@ +require'nvim-treesitter.configs'.setup { + ensure_installed = { 'rust', 'c', 'lua', 'tsx', 'javascript', 'typescript' }, + sync_install = false, + auto_install = true, + highlight = { + enable = true, + } +} diff --git a/lua/config/plugins/winbar.lua b/lua/config/plugins/winbar.lua new file mode 100644 index 0000000..d3fe03d --- /dev/null +++ b/lua/config/plugins/winbar.lua @@ -0,0 +1,36 @@ +require('winbar').setup({ + enabled = true, + + show_file_path = true, + show_symbols = true, + + colors = { + path = '', -- You can customize colors like #c946fd + file_name = '', + symbols = '', + }, + + icons = { + file_icon_default = '', + seperator = ' ', + editor_state = '●', + lock_icon = '', + }, + + exclude_filetype = { + 'help', + 'startify', + 'dashboard', + 'packer', + 'neo-tree', + 'neogitstatus', + 'NvimTree', + 'Trouble', + 'alpha', + 'lir', + 'Outline', + 'spectre_panel', + 'toggleterm', + 'qf', + } +}) diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua deleted file mode 100644 index a000447..0000000 --- a/lua/configs/conform.lua +++ /dev/null @@ -1,15 +0,0 @@ -local options = { - formatters_by_ft = { - lua = { "stylua" }, - -- css = { "prettier" }, - -- html = { "prettier" }, - }, - - -- format_on_save = { - -- -- These options will be passed to conform.format() - -- timeout_ms = 500, - -- lsp_fallback = true, - -- }, -} - -require("conform").setup(options) diff --git a/lua/configs/lazy.lua b/lua/configs/lazy.lua deleted file mode 100644 index cd170bd..0000000 --- a/lua/configs/lazy.lua +++ /dev/null @@ -1,47 +0,0 @@ -return { - defaults = { lazy = true }, - install = { colorscheme = { "nvchad" } }, - - ui = { - icons = { - ft = "", - lazy = "󰂠 ", - loaded = "", - not_loaded = "", - }, - }, - - performance = { - rtp = { - disabled_plugins = { - "2html_plugin", - "tohtml", - "getscript", - "getscriptPlugin", - "gzip", - "logipat", - "netrw", - "netrwPlugin", - "netrwSettings", - "netrwFileHandlers", - "matchit", - "tar", - "tarPlugin", - "rrhelper", - "spellfile_plugin", - "vimball", - "vimballPlugin", - "zip", - "zipPlugin", - "tutor", - "rplugin", - "syntax", - "synmenu", - "optwin", - "compiler", - "bugreport", - "ftplugin", - }, - }, - }, -} diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua deleted file mode 100644 index a73657a..0000000 --- a/lua/configs/lspconfig.lua +++ /dev/null @@ -1,23 +0,0 @@ --- EXAMPLE -local on_attach = require("nvchad.configs.lspconfig").on_attach -local on_init = require("nvchad.configs.lspconfig").on_init -local capabilities = require("nvchad.configs.lspconfig").capabilities - -local lspconfig = require "lspconfig" -local servers = { "html", "cssls" } - --- lsps with default config -for _, lsp in ipairs(servers) do - lspconfig[lsp].setup { - on_attach = on_attach, - on_init = on_init, - capabilities = capabilities, - } -end - --- typescript -lspconfig.tsserver.setup { - on_attach = on_attach, - on_init = on_init, - capabilities = capabilities, -} diff --git a/lua/mappings.lua b/lua/mappings.lua index 783b78f..0d9bb5e 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -1,10 +1,52 @@ -require "nvchad.mappings" - --- add yours here - local map = vim.keymap.set map("n", ";", ":", { desc = "CMD enter command mode" }) -map("i", "jk", "") --- map({ "n", "i", "v" }, "", " w ") +map("i", "", "", { desc = "move left" }) +map("i", "", "", { desc = "move right" }) +map("i", "", "", { desc = "move down" }) +map("i", "", "", { desc = "move up" }) + +map("n", "", "h", { desc = "switch window left" }) +map("n", "", "l", { desc = "switch window right" }) +map("n", "", "j", { desc = "switch window down" }) +map("n", "", "k", { desc = "switch window up" }) + +map("n", "", "NeoTreeShowToggle", { desc = "nvimtree toggle window" }) + +map("n", "", "BufferLineMoveNext", { desc = "move buffer to right" }) +map("n", "", "BufferLineMovePrev", { desc = "move buffer to left" }) +map("n", "", "BufferLineCycleNext", { desc = "switch to next buffer" }) +map("n", "", "BufferLineCyclePrev", { desc = "switch to prev buffer" }) + +map("n", "", "DapContinue") +map("n", "", "DapToggleBreakpoint") + +map("n", "mk", "RustLsp moveItem upcr>") +map("n", "m,", "RustLsp moveItem down") +map("n", "rs", "RustLsp run") +map("n", "hh", "RustLsp hover actions") +map("n", "ca", "RustLsp codeAction") +map("n", "", "w!") +map("i", "", "w!") + +map("n", "<", "") +map("n", ">", ">gv") + +map("n", "dr", " DapContinue ", { desc = "Continue debug" } ) + +map("n", "do", function() + require("dapui").open() +end, { desc = "Open DAP ui" }) +map("n", "dc", function() + require("dapui").close() +end, { desc = "Start or continue debug" }) +map("n", "dt", function() + require("dapui").toggle() +end, { desc = "Toggle DAP ui" }) + +map("n", "rn", "set relativenumber") +map("n", "an", "set norelativenumber") +map("n", "tt", "ToggleTerm") +map("n", "", "foldopen") +map("n", "", "foldclose") diff --git a/lua/options.lua b/lua/options.lua deleted file mode 100644 index 738f20b..0000000 --- a/lua/options.lua +++ /dev/null @@ -1,6 +0,0 @@ -require "nvchad.options" - --- add yours here! - --- local o = vim.o --- o.cursorlineopt ='both' -- to enable cursorline! diff --git a/lua/plugins/core/init.lua b/lua/plugins/core/init.lua new file mode 100644 index 0000000..c8f9d78 --- /dev/null +++ b/lua/plugins/core/init.lua @@ -0,0 +1,175 @@ +return { + { + 'nvim-lua/popup.nvim', + }, + { + "akinsho/bufferline.nvim", + }, + { + "lewis6991/gitsigns.nvim" + }, + { + "nvim-lualine/lualine.nvim", + }, + { + "akinsho/toggleterm.nvim", + }, + { + "windwp/nvim-autopairs", + }, + { + 'kevinhwang91/promise-async', + }, + { + 'theHamsta/nvim-dap-virtual-text', + }, + { + "hrsh7th/cmp-nvim-lsp", + }, + { + "SmiteshP/nvim-navic", + }, + { + 'folke/noice.nvim', + }, + { + "kyazdani42/nvim-web-devicons" + }, + { + 'NvChad/nvim-colorizer.lua', + }, + { + 'numToStr/Comment.nvim' + }, + { + "L3MON4D3/LuaSnip", + lazy = true, + }, + { + "folke/neodev.nvim", opts = {} + }, + { + "nvim-treesitter/nvim-treesitter", + }, + { + 'fgheng/winbar.nvim' + }, + { + "Bekaboo/dropbar.nvim", + }, + { + "vague2k/huez.nvim", + }, + { + "neovim/nvim-lspconfig", + dependencies = { "williamboman/mason-lspconfig.nvim", }, + }, + { + "mfussenegger/nvim-dap", + event = "VeryLazy", + }, + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v2.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + }, + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "eslint-lsp", + "js-debug-adapter", + "prettier", + "tinymist", + "typescript-language-server", + } + } + }, + { + "rcarriga/nvim-dap-ui", + dependencies = { + "nvim-neotest/nvim-nio", + "mfussenegger/nvim-dap", + }, + event = "VeryLazy", + config = function() + require("dapui").setup() + end + }, + { + "nvim-telescope/telescope.nvim", + }, + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + { + "L3MON4D3/LuaSnip", + dependencies = "rafamadriz/friendly-snippets", + opts = { history = true, updateevents = "TextChanged,TextChangedI" }, + config = function(_, opts) + require("luasnip").config.set_config(opts) + require "config.plugins.luasnip" + end, + }, + { + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, + }, + }, + { + 'kevinhwang91/nvim-ufo', + lazy = true, + config = function(_, opts) + local handler = function(virtText, lnum, endLnum, width, truncate) + local newVirtText = {} + local totalLines = vim.api.nvim_buf_line_count(0) + local foldedLines = endLnum - lnum + local suffix = ("  %d %d%%"):format(foldedLines, foldedLines / totalLines * 100) + local sufWidth = vim.fn.strdisplaywidth(suffix) + local targetWidth = width - sufWidth + local curWidth = 0 + for _, chunk in ipairs(virtText) do + local chunkText = chunk[1] + local chunkWidth = vim.fn.strdisplaywidth(chunkText) + if targetWidth > curWidth + chunkWidth then + table.insert(newVirtText, chunk) + else + chunkText = truncate(chunkText, targetWidth - curWidth) + local hlGroup = chunk[2] + table.insert(newVirtText, { chunkText, hlGroup }) + chunkWidth = vim.fn.strdisplaywidth(chunkText) + -- str width returned from truncate() may less than 2nd argument, need padding + if curWidth + chunkWidth < targetWidth then + suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth) + end + break + end + curWidth = curWidth + chunkWidth + end + local rAlignAppndx = + math.max(math.min(vim.opt.textwidth["_value"], width - 1) - curWidth - sufWidth, 0) + suffix = (" "):rep(rAlignAppndx) .. suffix + table.insert(newVirtText, { suffix, "MoreMsg" }) + return newVirtText + end + opts["fold_virt_text_handler"] = handler + require("ufo").setup(opts) + vim.keymap.set("n", "K", function() + local winid = require("ufo").peekFoldedLinesUnderCursor() + if not winid then + -- vim.lsp.buf.hover() + vim.cmd [[ Lspsaga hover_doc ]] + end + end) + end, + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua deleted file mode 100644 index e62d896..0000000 --- a/lua/plugins/init.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - { - "stevearc/conform.nvim", - -- event = 'BufWritePre', -- uncomment for format on save - config = function() - require "configs.conform" - end, - }, - - -- These are some examples, uncomment them if you want to see them work! - -- { - -- "neovim/nvim-lspconfig", - -- config = function() - -- require("nvchad.configs.lspconfig").defaults() - -- require "configs.lspconfig" - -- end, - -- }, - -- - -- { - -- "williamboman/mason.nvim", - -- opts = { - -- ensure_installed = { - -- "lua-language-server", "stylua", - -- "html-lsp", "css-lsp" , "prettier" - -- }, - -- }, - -- }, - -- - -- { - -- "nvim-treesitter/nvim-treesitter", - -- opts = { - -- ensure_installed = { - -- "vim", "lua", "vimdoc", - -- "html", "css" - -- }, - -- }, - -- }, -} diff --git a/lua/plugins/secondary/init.lua b/lua/plugins/secondary/init.lua new file mode 100644 index 0000000..2d236c1 --- /dev/null +++ b/lua/plugins/secondary/init.lua @@ -0,0 +1,50 @@ +return { + { + "goolord/alpha-nvim", + config = function () + require'alpha'.setup(require'alpha.themes.dashboard'.config) + end + }, + { + "kaarmu/typst.vim", + lazy = true, + }, + { + 'MunifTanjim/prettier.nvim', + lazy = true, + }, + { + "savq/melange-nvim" + }, + { + "mlaursen/vim-react-snippets", + lazy = true, + }, + { + "windwp/nvim-ts-autotag", + lazy = true, + }, + { + "lukas-reineke/indent-blankline.nvim" + }, + { + "mxsdev/nvim-dap-vscode-js", + lazy = true, + }, + { + "windwp/nvim-autopairs", + lazy = true, + event = "InsertEnter", + config = true + }, + { + "microsoft/vscode-js-debug", + lazy = true, + build = "npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out" + }, + { + "mrcjkb/rustaceanvim", + version = '^4', -- Recommended + lazy = false, -- This plugin is already lazy + }, +}