diff --git a/nvim/.config/nvim/.stylua.toml b/nvim/.config/nvim/.stylua.toml deleted file mode 100644 index bb258b9..0000000 --- a/nvim/.config/nvim/.stylua.toml +++ /dev/null @@ -1,6 +0,0 @@ -column_width = 120 -line_endings = "Unix" -indent_type = "Spaces" -indent_width = 4 -quote_style = "AutoPreferDouble" -no_call_parentheses = false diff --git a/nvim/.config/nvim/after/plugin/autotags.lua b/nvim/.config/nvim/after/plugin/autotags.lua deleted file mode 100644 index 5798dba..0000000 --- a/nvim/.config/nvim/after/plugin/autotags.lua +++ /dev/null @@ -1,7 +0,0 @@ -local status_ok, n_autotags = pcall(require, "nvim-ts-autotag") -if not status_ok then - vim.notify("nvim-ts-autotag not found!") - return -end - -n_autotags.setup({}) diff --git a/nvim/.config/nvim/after/plugin/bufferline.lua b/nvim/.config/nvim/after/plugin/bufferline.lua deleted file mode 100644 index b27f903..0000000 --- a/nvim/.config/nvim/after/plugin/bufferline.lua +++ /dev/null @@ -1,164 +0,0 @@ -local status_ok, bufferline = pcall(require, "bufferline") -if not status_ok then - vim.notify("bufferline not found!") - return -end - -bufferline.setup({ - options = { - numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, - -- close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" - -- right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" - -- left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" - -- middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" - -- NOTE: this plugin is designed with this icon in mind, - -- and so changing this is NOT recommended, this is intended - -- as an escape hatch for people who cannot bear it for whatever reason - indicator = { - icon = "│", - style = "icon", - }, - buffer_close_icon = "", - -- buffer_close_icon = '', - modified_icon = "●", - close_icon = "", - -- close_icon = '', - left_trunc_marker = "", - right_trunc_marker = "", - --- name_formatter can be used to change the buffer's label in the bufferline. - --- Please note some names can/will break the - --- bufferline so use this at your discretion knowing that it has - --- some limitations that will *NOT* be fixed. - -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" - -- -- remove extension from markdown files for example - -- if buf.name:match('%.md') then - -- return vim.fn.fnamemodify(buf.name, ':t:r') - -- end - -- end, - max_name_length = 30, - max_prefix_length = 30, -- prefix used when a buffer is de-duplicated - tab_size = 21, - diagnostics = false, -- | "nvim_lsp" | "coc", - diagnostics_update_in_insert = false, - -- diagnostics_indicator = function(count, level, diagnostics_dict, context) - -- return "("..count..")" - -- end, - -- NOTE: this will be called a lot so don't do any heavy processing here - -- custom_filter = function(buf_number) - -- -- filter out filetypes you don't want to see - -- if vim.bo[buf_number].filetype ~= "" then - -- return true - -- end - -- -- filter out by buffer name - -- if vim.fn.bufname(buf_number) ~= "" then - -- return true - -- end - -- -- filter out based on arbitrary rules - -- -- e.g. filter out vim wiki buffer from tabline in your work repo - -- if vim.fn.getcwd() == "" and vim.bo[buf_number].filetype ~= "wiki" then - -- return true - -- end - -- end, - offsets = { { filetype = "NvimTree", text = "", 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 - -- can also be a table containing 2 custom separators - -- [focused and unfocused]. eg: { '|', '|' } - separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, - enforce_regular_tabs = true, - always_show_bufferline = true, - -- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b) - -- -- add custom logic - -- return buffer_a.modified > buffer_b.modified - -- end - }, - highlights = { - background = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - - -- buffer_selected = { - -- fg = {attribute='fg',highlight='#ff0000'}, - -- bg = {attribute='bg',highlight='#0000ff'}, - -- gui = 'none' - -- }, - buffer_visible = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - - close_button = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - close_button_visible = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - -- close_button_selected = { - -- fg = {attribute='fg',highlight='TabLineSel'}, - -- bg ={attribute='bg',highlight='TabLineSel'} - -- }, - - 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" }, - }, - duplicate_visible = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - duplicate = { - fg = { attribute = "fg", highlight = "TabLine" }, - bg = { attribute = "bg", highlight = "TabLine" }, - }, - - 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" }, - }, - -- separator_visible = { - -- fg = {attribute='bg',highlight='TabLine'}, - -- bg = {attribute='bg',highlight='TabLine'} - -- }, - indicator_selected = { - fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, - bg = { attribute = "bg", highlight = "Normal" }, - }, - }, -}) diff --git a/nvim/.config/nvim/after/plugin/cloak.lua b/nvim/.config/nvim/after/plugin/cloak.lua deleted file mode 100644 index 7894fd3..0000000 --- a/nvim/.config/nvim/after/plugin/cloak.lua +++ /dev/null @@ -1,21 +0,0 @@ -local status_ok, cloak = pcall(require, "cloak") -if not status_ok then - vim.notify("Cloak not found!") - return -end - -cloak.setup({ - enabled = true, - cloak_character = "*", - highlight_group = "Comment", - patterns = { - { - file_pattern = ".netrc", - cloak_pattern = " .+", - }, - { - file_pattern = ".pipeline", - cloak_pattern = ":.+", - }, - }, -}) diff --git a/nvim/.config/nvim/after/plugin/comment.lua b/nvim/.config/nvim/after/plugin/comment.lua deleted file mode 100644 index 1a1ecd4..0000000 --- a/nvim/.config/nvim/after/plugin/comment.lua +++ /dev/null @@ -1,7 +0,0 @@ -local status_ok, comment = pcall(require, "Comment") -if not status_ok then - vim.notify("Comment not found!") - return -end - -comment.setup({}) diff --git a/nvim/.config/nvim/after/plugin/dap.lua b/nvim/.config/nvim/after/plugin/dap.lua deleted file mode 100644 index 8dbf905..0000000 --- a/nvim/.config/nvim/after/plugin/dap.lua +++ /dev/null @@ -1,25 +0,0 @@ -local dap_status_ok, dap = pcall(require, "dap") -if not dap_status_ok then - vim.notify("dap not found!") - return -end - -local dap_ui_status_ok, dapui = pcall(require, "dapui") -if not dap_ui_status_ok then - vim.notify("dapui not found!") - return -end - -dapui.setup({}) - -dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open({}) -end - -dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close({}) -end - -dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close({}) -end diff --git a/nvim/.config/nvim/after/plugin/git.lua b/nvim/.config/nvim/after/plugin/git.lua deleted file mode 100644 index 17a6ce9..0000000 --- a/nvim/.config/nvim/after/plugin/git.lua +++ /dev/null @@ -1,14 +0,0 @@ -local status_ok, git = pcall(require, "git") -if not status_ok then - vim.notify("git not found!") - return -end - -git.setup({ - keymaps = { - -- Open blame window - blame = "gb", - -- Open file/folder in git repository - browse = "go", - }, -}) diff --git a/nvim/.config/nvim/after/plugin/gitsigns.lua b/nvim/.config/nvim/after/plugin/gitsigns.lua deleted file mode 100644 index 04e816d..0000000 --- a/nvim/.config/nvim/after/plugin/gitsigns.lua +++ /dev/null @@ -1,7 +0,0 @@ -local status_ok, gitsigns = pcall(require, "gitsigns") -if not status_ok then - vim.notify("gitsings not found!") - return -end - -gitsigns.setup({}) diff --git a/nvim/.config/nvim/after/plugin/illuminate.lua b/nvim/.config/nvim/after/plugin/illuminate.lua deleted file mode 100644 index ade336e..0000000 --- a/nvim/.config/nvim/after/plugin/illuminate.lua +++ /dev/null @@ -1,8 +0,0 @@ -local plugin_name = "illuminate" -local status_ok, illuminate = pcall(require, plugin_name) -if not status_ok then - vim.notify(plugin_name .. " not found!") - return -end - -require("illuminate").configure() diff --git a/nvim/.config/nvim/after/plugin/impatient.lua b/nvim/.config/nvim/after/plugin/impatient.lua deleted file mode 100644 index 217eb94..0000000 --- a/nvim/.config/nvim/after/plugin/impatient.lua +++ /dev/null @@ -1,7 +0,0 @@ -local status_ok, impatient = pcall(require, "impatient") -if not status_ok then - vim.notify("impatient not found!") - return -end - -impatient.enable_profile() diff --git a/nvim/.config/nvim/after/plugin/keymaps/bufferline.lua b/nvim/.config/nvim/after/plugin/keymaps/bufferline.lua deleted file mode 100644 index 67551a2..0000000 --- a/nvim/.config/nvim/after/plugin/keymaps/bufferline.lua +++ /dev/null @@ -1,16 +0,0 @@ -local Remap = require("user.keymaps") -local nnoremap = Remap.nnoremap - --- nnoremap("", "BufferLineCycleNext") --- TODO: This keymap does not work(Should fix this) --- nnoremap("", "BufferLineCyclePrev") -nnoremap("", "bdelete") -nnoremap("", "BufferLineGoToBuffer 1") -nnoremap("", "BufferLineGoToBuffer 2") -nnoremap("", "BufferLineGoToBuffer 3") -nnoremap("", "BufferLineGoToBuffer 4") -nnoremap("", "BufferLineGoToBuffer 5") -nnoremap("", "BufferLineGoToBuffer 6") -nnoremap("", "BufferLineGoToBuffer 7") -nnoremap("", "BufferLineGoToBuffer 8") -nnoremap("", "BufferLineGoToBuffer 9") diff --git a/nvim/.config/nvim/after/plugin/keymaps/init.lua b/nvim/.config/nvim/after/plugin/keymaps/init.lua deleted file mode 100644 index 1bbf2f8..0000000 --- a/nvim/.config/nvim/after/plugin/keymaps/init.lua +++ /dev/null @@ -1,135 +0,0 @@ -local Remap = require("user.keymaps") -local nnoremap = Remap.nnoremap -local vnoremap = Remap.vnoremap -local inoremap = Remap.inoremap -local xnoremap = Remap.xnoremap - --- Increment/Decrement -nnoremap("+", "") -nnoremap("-", "") - --- Make file executable -nnoremap("x", "!chmod +x %") - --- Behave like the rest of the CAPITAL letters -nnoremap("Y", "yg$") - --- Keep cursor at the beginning -nnoremap("J", "mzJ`z") - --- Quit -nnoremap("", ":q") -inoremap("", "") - --- Keep same paste -vnoremap("p", '"_dP') - --- Keeping it centered -nnoremap("n", "nzzzv") -nnoremap("N", "Nzzzv") --- Move down UP and DOWN and center it -nnoremap("", "zz") -nnoremap("", "zz") - --- Do NOT lose your yank when you use --- x -nnoremap("x", '"_x') --- d -nnoremap("d", '"_d') -nnoremap("D", '"_D') -vnoremap("d", '"_d') -vnoremap("D", '"_D') --- c -nnoremap("c", '"_c') -nnoremap("C", '"_C') -vnoremap("c", '"_c') -vnoremap("C", '"_C') - --- Save -nnoremap("", ":w") -vnoremap("", ":w") -inoremap("", ":w") - --- Stay in indent mode -vnoremap("", "", ">gv") - --- Move text up and down --- Normal -nnoremap("", ":m .+1==") -nnoremap("", ":m .-2==") --- Visual -vnoremap("", ":m .+1==") -vnoremap("", ":m .+1==") -vnoremap("", ":m .-2==") -vnoremap("", ":m .-2==") --- Visual Block -xnoremap("J", ":move '>+1gv-gv") -xnoremap("K", ":move '<-2gv-gv") -xnoremap("", ":move '>+1gv-gv") -xnoremap("", ":move '>+1gv-gv") -xnoremap("", ":move '<-2gv-gv") -xnoremap("", ":move '<-2gv-gv") - --- Move between splits --- Vim -nnoremap("", "h") -nnoremap("", "j") -nnoremap("", "k") -nnoremap("", "l") --- Arrows -nnoremap("", ":vertical resize +3") -nnoremap("", ":vertical resize -3") -nnoremap("", ":resize +3") -nnoremap("", ":resize -3") - --- Tmux -nnoremap("", "!tmux neww tmux-sessionizer") - -local telescope = require("telescope.builtin") - --- Telescope -nnoremap("", telescope.find_files) -nnoremap("fw", function() - local word = vim.fn.expand("") - telescope.grep_string({ search = word }) -end) -nnoremap("fW", function() - local word = vim.fn.expand("") - telescope.grep_string({ search = word }) -end) --- nnoremap("fw", function() --- local word = vim.fn.expand("") --- telescope.live_grep({ default_text = word }) --- end) --- nnoremap("fW", function() --- local word = vim.fn.expand("") --- telescope.live_grep({ default_text = word }) --- end) - --- Nvim-tree -nnoremap("", ":NvimTreeToggle") - --- Comment with 'Ctrl-/' -nnoremap("", "lua require('Comment.api').toggle.linewise()") -inoremap("", "lua require('Comment.api').toggle.linewise()") -vnoremap("", "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())") - --- Source file -nnoremap("", function() - vim.cmd("so") -end) - --- Codeium -inoremap("", function() - return vim.fn["codeium#Accept"]() -end) -inoremap("", function() - return vim.fn["codeium#CycleCompletions"](1) -end) -inoremap("", function() - return vim.fn["codeium#CycleCompletions"](-1) -end) -inoremap("", function() - return vim.fn["codeium#Clear"]() -end) diff --git a/nvim/.config/nvim/after/plugin/lsp.lua b/nvim/.config/nvim/after/plugin/lsp.lua deleted file mode 100644 index 8ea9d9f..0000000 --- a/nvim/.config/nvim/after/plugin/lsp.lua +++ /dev/null @@ -1,73 +0,0 @@ -local lsp_status_ok, lsp = pcall(require, "lsp-zero") -if not lsp_status_ok then - vim.notify("lsp-zero not found!") - return -end - -lsp.preset("recommended") - -local cmp_status_ok, cmp = pcall(require, "cmp") -if not cmp_status_ok then - vim.notify("cmp not found!") - return -end -local cmp_select = { behavior = cmp.SelectBehavior.Select } -local cmp_mappings = lsp.defaults.cmp_mappings({ - [""] = cmp.mapping.select_prev_item(cmp_select), - [""] = cmp.mapping.select_next_item(cmp_select), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), -}) --- disable completion with tab --- this helps with copilot setup --- cmp_mappings[""] = nil --- cmp_mappings[""] = nil - -local cmp = require("cmp") -local cmp_action = lsp.cmp_action() - -cmp.setup({ - mapping = cmp_mappings, -}) - -require("mason").setup({}) -require("mason-lspconfig").setup({ - -- Replace the language servers listed here - -- with the ones you want to install - ensure_installed = { - "cssls", - "cssmodules_ls", - "html", - "jsonls", - "tsserver", - "lua_ls", - "yamlls", - "bashls", - "prismals", - "jdtls", - }, - handlers = { - lsp.default_setup, - }, -}) - --- Fix Undefined global 'vim' -lsp.nvim_lua_ls() - -lsp.set_preferences({ - suggest_lsp_servers = false, - sign_icons = { - error = "E", - warn = "W", - hint = "H", - info = "I", - }, -}) - -lsp.on_attach(require("user.lsp").on_attach) - -lsp.setup() - -vim.diagnostic.config({ - virtual_text = true, -}) diff --git a/nvim/.config/nvim/after/plugin/lualine.lua b/nvim/.config/nvim/after/plugin/lualine.lua deleted file mode 100644 index fb0b6ed..0000000 --- a/nvim/.config/nvim/after/plugin/lualine.lua +++ /dev/null @@ -1,173 +0,0 @@ -local status_ok, lualine = pcall(require, "lualine") -if not status_ok then - vim.notify("lualine not found!") - return -end - --- Color table for highlights --- stylua: ignore -local colors = { - bg = '#101019', - fg = '#cdd6f4', - yellow = '#f9e2af', - cyan = '#89dceb', - darkblue = '#45475a', - green = '#a6e3a1', - orange = '#fab387', - violet = '#cba6f7', - magenta = '#f5c2e7', - blue = '#89b4fa', - red = '#f38ba8', -} - -local conditions = { - buffer_not_empty = function() - return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 - end, - hide_in_width = function() - return vim.fn.winwidth(0) > 80 - end, - check_git_workspace = function() - local filepath = vim.fn.expand("%:p:h") - local gitdir = vim.fn.finddir(".git", filepath .. ";") - return gitdir and #gitdir > 0 and #gitdir < #filepath - end, -} - --- Config -local config = { - options = { - -- Disable sections and component separators - component_separators = "", - section_separators = "", - theme = { - -- We are going to use lualine_c an lualine_x as left and - -- right section. Both are highlighted by c theme . So we - -- are just setting default looks o statusline - normal = { c = { fg = colors.fg, bg = colors.bg } }, - inactive = { c = { fg = colors.fg, bg = colors.bg } }, - }, - disabled_filetypes = { "NvimTree", "alpha" }, - }, - sections = { - -- these are to remove the defaults - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - -- These will be filled later - lualine_c = {}, - lualine_x = {}, - }, - inactive_sections = { - -- these are to remove the defaults - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - lualine_c = {}, - lualine_x = {}, - }, -} - --- Inserts a component in lualine_c at left section -local function ins_left(component) - table.insert(config.sections.lualine_c, component) -end - --- Inserts a component in lualine_x to right section -local function ins_right(component) - table.insert(config.sections.lualine_x, component) -end - -ins_left({ - -- filesize component - "filesize", - cond = conditions.buffer_not_empty, -}) - -ins_left({ - "filename", - cond = conditions.buffer_not_empty, - color = { fg = colors.magenta, gui = "bold" }, -}) - -ins_left({ "location" }) - -ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } }) - -ins_left({ - "diagnostics", - sources = { "nvim_diagnostic" }, - symbols = { error = " ", warn = " ", info = " " }, - diagnostics_color = { - color_error = { fg = colors.red }, - color_warn = { fg = colors.yellow }, - color_info = { fg = colors.cyan }, - }, -}) - --- Insert mid section. You can make any number of sections in neovim :) --- for lualine it's any number greater then 2 -ins_left({ - function() - return "%=" - end, -}) - -ins_left({ - -- Lsp server name . - function() - local msg = "No Active Lsp" - local buf_ft = vim.api.nvim_buf_get_option(0, "filetype") - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end - return msg - end, - icon = " LSP:", - color = { fg = "#ffffff", gui = "bold" }, -}) - --- Add components to right sections -ins_right({ - "o:encoding", -- option component same as &encoding in viml - fmt = string.upper, -- I'm not sure why it's upper case either ;) - cond = conditions.hide_in_width, - color = { fg = colors.green, gui = "bold" }, -}) - -ins_right({ - "fileformat", - fmt = string.upper, - icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh - color = { fg = colors.green, gui = "bold" }, -}) - -ins_right({ - "branch", - icon = "", - color = { fg = colors.violet, gui = "bold" }, -}) - -ins_right({ - "diff", - -- Is it me or the symbol for modified us really weird - symbols = { added = " ", modified = "柳 ", removed = " " }, - diff_color = { - added = { fg = colors.green }, - modified = { fg = colors.orange }, - removed = { fg = colors.red }, - }, - cond = conditions.hide_in_width, -}) - --- Now don't forget to initialize lualine -lualine.setup(config) diff --git a/nvim/.config/nvim/after/plugin/null-ls.lua b/nvim/.config/nvim/after/plugin/null-ls.lua deleted file mode 100644 index d5a56de..0000000 --- a/nvim/.config/nvim/after/plugin/null-ls.lua +++ /dev/null @@ -1,39 +0,0 @@ -local null_ls_status_ok, null_ls = pcall(require, "null-ls") -if not null_ls_status_ok then - vim.notify("null-ls not found!") - return -end - --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting -local formatting = null_ls.builtins.formatting --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics -local diagnostics = null_ls.builtins.diagnostics -local code_actions = null_ls.builtins.code_actions - -local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - -null_ls.setup({ - debug = false, - sources = { - formatting.stylua, -- Lua - formatting.beautysh, -- Bash, Zsh - diagnostics.codespell, -- Codespell - diagnostics.eslint, -- javascript etc - code_actions.eslint, -- javascript etc - formatting.prettier, -- javascript etc - formatting.google_java_format, -- java - }, - -- you can reuse a shared lspconfig on_attach callback here - on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - vim.lsp.buf.format({ bufnr = bufnr }) - end, - }) - end - end, -}) diff --git a/nvim/.config/nvim/after/plugin/nvim-tree.lua b/nvim/.config/nvim/after/plugin/nvim-tree.lua deleted file mode 100644 index 0d3ee5a..0000000 --- a/nvim/.config/nvim/after/plugin/nvim-tree.lua +++ /dev/null @@ -1,119 +0,0 @@ -local status_ok, nvim_tree = pcall(require, "nvim-tree") -if not status_ok then - vim.notify("nvim-tree not found!") - return -end - -nvim_tree.setup({ - hijack_directories = { - enable = false, - }, - -- update_to_buf_dir = { - -- enable = false, - -- }, - -- disable_netrw = true, - -- hijack_netrw = true, - -- ignore_ft_on_setup = { - -- "startify", - -- "dashboard", - -- "alpha", - -- }, - filters = { - custom = { "^.git$" }, - }, - -- auto_close = true, - -- open_on_tab = false, - -- hijack_cursor = false, - update_cwd = true, - -- update_to_buf_dir = { - -- enable = true, - -- auto_open = true, - -- }, - -- --  error - -- --  info - -- --  question - -- --  warning - -- --  lightbulb - renderer = { - add_trailing = false, - group_empty = false, - highlight_git = false, - highlight_opened_files = "none", - root_folder_modifier = ":t", - indent_markers = { - enable = false, - icons = { - corner = "└ ", - edge = "│ ", - none = " ", - }, - }, - icons = { - webdev_colors = true, - git_placement = "before", - padding = " ", - symlink_arrow = " ➛ ", - show = { - file = true, - folder = true, - folder_arrow = true, - git = true, - }, - glyphs = { - default = "", - symlink = "", - folder = { - default = "", - open = "", - empty = "", - empty_open = "", - symlink = "", - symlink_open = "", - }, - git = { - unstaged = "", - staged = "S", - unmerged = "", - renamed = "➜", - untracked = "U", - deleted = "", - ignored = "◌", - }, - }, - }, - }, - diagnostics = { - enable = true, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, - update_focused_file = { - enable = true, - update_cwd = true, - ignore_list = {}, - }, - -- system_open = { - -- cmd = nil, - -- args = {}, - -- }, - -- filters = { - -- dotfiles = false, - -- custom = {}, - -- }, - git = { - enable = true, - ignore = true, - timeout = 500, - }, - view = { - adaptive_size = true, - side = "left", - -- auto_resize = true, - number = false, - relativenumber = false, - }, -}) diff --git a/nvim/.config/nvim/after/plugin/telescope.lua b/nvim/.config/nvim/after/plugin/telescope.lua deleted file mode 100644 index 720b7f4..0000000 --- a/nvim/.config/nvim/after/plugin/telescope.lua +++ /dev/null @@ -1,41 +0,0 @@ -local status_ok, telescope = pcall(require, "telescope") -if not status_ok then - vim.notify("telescope not found!") - return -end - -telescope.setup({ - defaults = { - prompt_prefix = " > ", - file_ignore_patterns = { - ".git/", - "node_modules/", - }, - 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, - }, - }, - pickers = { - find_files = { - show_untracked = true, - hidden = true, - }, - git_files = { - show_untracked = true, - hidden = true, - }, - live_grep = { - additional_args = function() - return { "--hidden" } - end, - }, - }, -}) diff --git a/nvim/.config/nvim/after/plugin/todo-comments.lua b/nvim/.config/nvim/after/plugin/todo-comments.lua deleted file mode 100644 index 2bc5b76..0000000 --- a/nvim/.config/nvim/after/plugin/todo-comments.lua +++ /dev/null @@ -1,7 +0,0 @@ -local status_ok, todo_comments = pcall(require, "todo-comments") -if not status_ok then - vim.notify("todo-comments not found!") - return -end - -todo_comments.setup({}) diff --git a/nvim/.config/nvim/after/plugin/treesitter.lua b/nvim/.config/nvim/after/plugin/treesitter.lua deleted file mode 100644 index b7768c5..0000000 --- a/nvim/.config/nvim/after/plugin/treesitter.lua +++ /dev/null @@ -1,23 +0,0 @@ -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then - vim.notify("nvim-treesitter.configs not found!") - return -end - -configs.setup({ - ensure_installed = "all", - sync_install = false, - autopairs = { - enable = true, - }, - highlight = { - enable = true, - additional_vim_regex_highlighting = true, - }, - indent = { - enable = true, - }, - autotag = { - enable = true, - }, -}) diff --git a/nvim/.config/nvim/after/plugin/web-devicons.lua b/nvim/.config/nvim/after/plugin/web-devicons.lua deleted file mode 100644 index 60ce253..0000000 --- a/nvim/.config/nvim/after/plugin/web-devicons.lua +++ /dev/null @@ -1,14 +0,0 @@ -local status_ok, icons = pcall(require, "nvim-web-devicons") -if not status_ok then - vim.notify("nvim-web-devicons not found!") - return -end - -icons.setup({ - -- your personal icons can go here (to override) - -- DevIcon will be appended to `name` - override = {}, - -- globally enable default icons (default to false) - -- will get overridden by `get_icons` option - default = true, -}) diff --git a/nvim/.config/nvim/after/plugin/whichkey.lua b/nvim/.config/nvim/after/plugin/whichkey.lua deleted file mode 100644 index 9e5bcf2..0000000 --- a/nvim/.config/nvim/after/plugin/whichkey.lua +++ /dev/null @@ -1,77 +0,0 @@ -local status_ok, which_key = pcall(require, "which-key") -if not status_ok then - vim.notify("which-key not found!") - return -end - -local mappings = { - r = { ":%s/\\<\\>//gI", "Replace word" }, - g = { - name = "Git", - d = { ":DiffviewOpen", "Diff" }, - ["dc"] = { ":DiffviewClose", "Diff Close" }, - -- d = { - -- "Gitsigns diffthis HEAD", - -- "Diff", - -- }, - }, - f = { - name = "Find", - f = { "Telescope find_files", "Find files" }, - g = { "Telescope live_grep", "Find text in files" }, - b = { "Telescope buffers", "Find buffers" }, - t = { "Telescope help_tags", "Find tags" }, - r = { "Telescope resume", "Last search" }, - d = { "Telescope diagnostics", "Find diagnostics" }, - }, - l = { - name = "LSP", - a = { "lua vim.lsp.buf.code_action()", "Code Action" }, - i = { "LspInfo", "Info" }, - f = { "lua vim.lsp.buf.format({ async = true })", "Format" }, - F = { "LspToggleAutoFormat", "Toggle Autoformat" }, - r = { "lua vim.lsp.buf.rename()", "Rename" }, - R = { "TroubleToggle lsp_references", "References" }, - }, - s = { - name = "Tabs", - l = { ":vsp", "Split vertically" }, - j = { ":sp", "Split horizontally" }, - v = { "tH", "Change to vertical split" }, - h = { "tK", "Change to horizontal split" }, - }, - p = { - name = "Packer", - r = { ":PackerClean", "Remove Unused Plugins" }, - c = { ":PackerCompile profile=true", "Recompile Plugins" }, - i = { ":PackerInstall", "Install Plugins" }, - p = { ":PackerProfile", "Packer Profile" }, - s = { ":PackerSync", "Sync Plugins" }, - S = { ":PackerStatus", "Packer Status" }, - u = { ":PackerUpdate", "Update Plugins" }, - }, - d = { - name = "Debug", - b = { "lua require'dap'.toggle_breakpoint()", "Breakpoint" }, - c = { "lua require'dap'.continue()", "Continue" }, - i = { "lua require'dap'.step_into()", "Into" }, - o = { "lua require'dap'.step_over()", "Over" }, - O = { "lua require'dap'.step_out()", "Out" }, - r = { "lua require'dap'.repl.toggle()", "Repl" }, - l = { "lua require'dap'.run_last()", "Last" }, - u = { "lua require'dapui'.toggle()", "UI" }, - x = { "lua require'dap'.terminate()", "Exit" }, - }, - b = { - name = "Background", - i = { - function() - require("user.telescope").background_image_selector() - end, - "Background images", - }, - }, -} - -local opts = { prefix = "" } -which_key.register(mappings, opts) diff --git a/nvim/.config/nvim/ftplugin/java.lua b/nvim/.config/nvim/ftplugin/java.lua index fb23ba8..d6e15da 100644 --- a/nvim/.config/nvim/ftplugin/java.lua +++ b/nvim/.config/nvim/ftplugin/java.lua @@ -70,7 +70,30 @@ local config = { "-data", java_path .. "/jdt-language-server/workspace/folder", }, - on_attach = require("user.lsp").on_attach, + on_attach = function(client, bufnr) + local opts = { buffer = bufnr, remap = false } + + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "gl", vim.diagnostic.open_float, opts) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) + vim.keymap.set("n", "", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "gR", vim.lsp.buf.rename, opts) + vim.keymap.set("i", "gs", vim.lsp.buf.signature_help, opts) + + if client.name == "jdt.ls" then + vim.lsp.codelens.refresh() + if JAVA_DAP_ACTIVE then + require("jdtls").setup_dap({ hotcodereplace = "auto" }) + require("jdtls.dap").setup_dap_main_class_configs() + end + end + end, + capabilities = capabilities, -- This is the default if not provided, you can remove it. Or adjust as needed. -- One dedicated LSP server & client will be started per unique root_dir @@ -167,7 +190,7 @@ if not which_key_status_ok then end local opts = { - mode = "n", -- NORMAL mode + mode = "n", -- NORMAL mode prefix = "", buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings silent = true, -- use `silent` when creating keymaps @@ -176,7 +199,7 @@ local opts = { } local vopts = { - mode = "v", -- VISUAL mode + mode = "v", -- VISUAL mode prefix = "", buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings silent = true, -- use `silent` when creating keymaps diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index ea49ffa..5f80779 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1 +1,31 @@ -require("user") +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("options") +require("keymaps") +require("lazy").setup("plugins") + +local augroup = vim.api.nvim_create_augroup +local autocmd = vim.api.nvim_create_autocmd + +local yank_group = augroup("HighlightYank", {}) +autocmd("TextYankPost", { + group = yank_group, + pattern = "*", + callback = function() + vim.highlight.on_yank({ + higroup = "IncSearch", + timeout = 40, + }) + end, +}) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..7457a84 --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,36 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LazyVim": { "branch": "main", "commit": "879e29504d43e9f178d967ecc34d482f902e5a91" }, + "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, + "bufferline.nvim": { "branch": "main", "commit": "e48ce1805697e4bb97bc171c081e849a65859244" }, + "cloak.nvim": { "branch": "main", "commit": "951b163e55ce7639eb320c450bde9283c4fe968b" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "codeium.vim": { "branch": "main", "commit": "4063291e335e74e9ee2be04beb47d40b376312fa" }, + "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, + "dracula.nvim": { "branch": "main", "commit": "8fc749e2479d62829c9c627867770035b74529a4" }, + "friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" }, + "git.nvim": { "branch": "main", "commit": "741696687486f25f8b73d9e4c76ab2ede9998f39" }, + "gitsigns.nvim": { "branch": "main", "commit": "4aaacbf5e5e2218fd05eb75703fe9e0f85335803" }, + "impatient.nvim": { "branch": "main", "commit": "47302af74be7b79f002773011f0d8e85679a7618" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" }, + "mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" }, + "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" }, + "nvim-dap-ui": { "branch": "master", "commit": "a6beb3a855b42faa1d0fee1081602257719c2c5e" }, + "nvim-jdtls": { "branch": "master", "commit": "66b5ace68a5d1c45fdfb1afa8d847e87af2aa1f8" }, + "nvim-lspconfig": { "branch": "master", "commit": "7eed8b2150192e5ad05e1886fdf133493ddf2928" }, + "nvim-tree.lua": { "branch": "master", "commit": "f24afa2cef551122b8bd53bb2e4a7df42343ce2e" }, + "nvim-treesitter": { "branch": "master", "commit": "07c8c3d84f67b1530f636dcad31971f569a3df5f" }, + "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, + "nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" }, + "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" }, + "vim-fugitive": { "branch": "master", "commit": "ec8f7eed103c6d5b75eac69196bb87db0825629a" }, + "vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/nvim/.config/nvim/lazyvim.json b/nvim/.config/nvim/lazyvim.json new file mode 100644 index 0000000..691497a --- /dev/null +++ b/nvim/.config/nvim/lazyvim.json @@ -0,0 +1,7 @@ +{ + "extras": [], + "news": { + "NEWS.md": "2123" + }, + "version": 2 +} diff --git a/nvim/.config/nvim/.luarc.json b/nvim/.config/nvim/lua/.luarc.json similarity index 100% rename from nvim/.config/nvim/.luarc.json rename to nvim/.config/nvim/lua/.luarc.json diff --git a/nvim/.config/nvim/lua/keymaps.lua b/nvim/.config/nvim/lua/keymaps.lua new file mode 100644 index 0000000..18c0631 --- /dev/null +++ b/nvim/.config/nvim/lua/keymaps.lua @@ -0,0 +1,94 @@ +-- Increment/Decrement +vim.api.nvim_set_keymap("n", "+", "", { noremap = true }) +vim.api.nvim_set_keymap("n", "-", "", { noremap = true }) + +-- Make file executable +vim.api.nvim_set_keymap("n", "x", ":!chmod +x %", { noremap = true, silent = true }) + +-- Behave like the rest of the CAPITAL letters +vim.api.nvim_set_keymap("n", "Y", "yg$", { noremap = true }) + +-- Keep cursor at the beginning +vim.api.nvim_set_keymap("n", "J", "mzJ`z", { noremap = true }) + +-- Quit +vim.api.nvim_set_keymap("n", "", ":q", { noremap = true }) +vim.api.nvim_set_keymap("i", "", "", { noremap = true }) + +-- Keep same paste +vim.api.nvim_set_keymap("x", "p", '"_dP', { noremap = true }) +-- vim.api.nvim_set_keymap("n", "p", '"_dP', { noremap = true }) + +-- Keeping it centered +vim.api.nvim_set_keymap("n", "n", "nzzzv", { noremap = true }) +vim.api.nvim_set_keymap("n", "N", "Nzzzv", { noremap = true }) +vim.api.nvim_set_keymap("n", "", "zz", { noremap = true }) +vim.api.nvim_set_keymap("n", "", "zz", { noremap = true }) + +-- Do NOT lose your yank when you use +-- x +vim.api.nvim_set_keymap("n", "x", '"_x', { noremap = true }) +-- d +vim.api.nvim_set_keymap("n", "d", '"_d', { noremap = true }) +vim.api.nvim_set_keymap("n", "D", '"_D', { noremap = true }) +vim.api.nvim_set_keymap("v", "d", '"_d', { noremap = true }) +vim.api.nvim_set_keymap("v", "D", '"_D', { noremap = true }) +-- c +vim.api.nvim_set_keymap("n", "c", '"_c', { noremap = true }) +vim.api.nvim_set_keymap("n", "C", '"_C', { noremap = true }) +vim.api.nvim_set_keymap("v", "c", '"_c', { noremap = true }) +vim.api.nvim_set_keymap("v", "C", '"_C', { noremap = true }) + +-- Save +vim.api.nvim_set_keymap("n", "", ":w", { noremap = true }) +vim.api.nvim_set_keymap("v", "", ":w", { noremap = true }) +vim.api.nvim_set_keymap("i", "", ":w", { noremap = true }) + +-- Stay in indent mode +vim.api.nvim_set_keymap("v", "", "", ">gv", { noremap = true }) + +-- Move text up and down +-- Normal +vim.api.nvim_set_keymap("n", "", ":m .+1==", { noremap = true }) +vim.api.nvim_set_keymap("n", "", ":m .-2==", { noremap = true }) +-- Visual +vim.api.nvim_set_keymap("v", "", ":m .+1==", { noremap = true }) +vim.api.nvim_set_keymap("v", "", ":m .+1==", { noremap = true }) +vim.api.nvim_set_keymap("v", "", ":m .-2==", { noremap = true }) +vim.api.nvim_set_keymap("v", "", ":m .-2==", { noremap = true }) +-- Visual Block +vim.api.nvim_set_keymap("x", "J", ":move '>+1gv-gv", { noremap = true }) +vim.api.nvim_set_keymap("x", "K", ":move '<-2gv-gv", { noremap = true }) +vim.api.nvim_set_keymap("x", "", ":move '>+1gv-gv", { noremap = true }) +vim.api.nvim_set_keymap("x", "", ":move '>+1gv-gv", { noremap = true }) +vim.api.nvim_set_keymap("x", "", ":move '<-2gv-gv", { noremap = true }) +vim.api.nvim_set_keymap("x", "", ":move '<-2gv-gv", { noremap = true }) + +-- Move between splits +-- Vim +vim.api.nvim_set_keymap("n", "", "h", { noremap = true }) +vim.api.nvim_set_keymap("n", "", "j", { noremap = true }) +vim.api.nvim_set_keymap("n", "", "k", { noremap = true }) +vim.api.nvim_set_keymap("n", "", "l", { noremap = true }) +-- Arrows +vim.api.nvim_set_keymap("n", "", ":vertical resize +3", { noremap = true }) +vim.api.nvim_set_keymap("n", "", ":vertical resize -3", { noremap = true }) +vim.api.nvim_set_keymap("n", "", ":resize +3", { noremap = true }) +vim.api.nvim_set_keymap("n", "", ":resize -3", { noremap = true }) + +-- Tmux +vim.api.nvim_set_keymap("n", "", "!tmux neww tmux-sessionizer", { noremap = true }) + +-- Comment with 'Ctrl-/' +vim.api.nvim_set_keymap("n", "", 'lua require("Comment.api").toggle.linewise()', { noremap = true }) +vim.api.nvim_set_keymap("i", "", 'lua require("Comment.api").toggle.linewise()', { noremap = true }) +vim.api.nvim_set_keymap( + "v", + "", + 'lua require("Comment.api").toggle.linewise(vim.fn.visualmode())', + { noremap = true } +) + +-- Source file +vim.api.nvim_set_keymap("n", "", "so", { noremap = true }) diff --git a/nvim/.config/nvim/lua/options.lua b/nvim/.config/nvim/lua/options.lua new file mode 100644 index 0000000..0dc4b66 --- /dev/null +++ b/nvim/.config/nvim/lua/options.lua @@ -0,0 +1,51 @@ +local home = os.getenv("HOME") + +local options = { + exrc = true, + hlsearch = false, -- highlight all matches on previous search pattern + hidden = true, + errorbells = false, + tabstop = 4, -- insert 4 spaces for a tab + softtabstop = 4, + shiftwidth = 4, -- the number of spaces inserted for each indentation + expandtab = true, -- convert tabs to spaces + number = true, -- set numbered lines + relativenumber = true, -- set relative numbered lines + wrap = false, -- display lines as one long line + smartcase = true, -- smart case + smartindent = true, -- make indenting smarter again + swapfile = false, -- creates a swapfile + backup = false, -- creates a backup file + clipboard = "unnamedplus", -- allows neovim to access the system clipboard + undodir = vim.fn.expand("~/.vim/undodir"), + undofile = true, -- enable persistent undo + incsearch = true, + scrolloff = 8, -- determine the number of context lines you would like to see above and below the cursor + signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time + cursorcolumn = true, + cursorline = true, -- highlight the current line + ignorecase = true, -- ignore case in search patterns + splitbelow = true, -- force all horizontal splits to go below current window + splitright = true, -- force all vertical splits to go to the right of current window + colorcolumn = "80", + updatetime = 50, -- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable delays and poor user experience. +} + +for k, v in pairs(options) do + vim.opt[k] = v +end + +-- Leader +vim.g.mapleader = " " + +-- Turns off netrw +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +vim.g.loaded_netrwSettings = 1 +vim.g.loaded_netrwFileHandlers = 1 + +-- Fillchars(eob: end of buffer) +vim.opt.fillchars = vim.opt.fillchars + "eob: " + +-- Shorter messages +vim.opt.shortmess:append("c") diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.lua @@ -0,0 +1 @@ +return {} diff --git a/nvim/.config/nvim/lua/plugins/autotags.lua b/nvim/.config/nvim/lua/plugins/autotags.lua new file mode 100644 index 0000000..3a5588b --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/autotags.lua @@ -0,0 +1,9 @@ +return { + { + "windwp/nvim-ts-autotag", + config = function() + require("nvim-ts-autotag").setup({}) + end, + }, +} + diff --git a/nvim/.config/nvim/lua/plugins/bufferline.lua b/nvim/.config/nvim/lua/plugins/bufferline.lua new file mode 100644 index 0000000..068667f --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/bufferline.lua @@ -0,0 +1,179 @@ +return { + { + "akinsho/bufferline.nvim", + config = function() + require("bufferline").setup({ options = { + numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, + -- close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + -- right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" + -- left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" + -- middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + -- NOTE: this plugin is designed with this icon in mind, + -- and so changing this is NOT recommended, this is intended + -- as an escape hatch for people who cannot bear it for whatever reason + indicator = { + icon = "│", + style = "icon", + }, + buffer_close_icon = "", + -- buffer_close_icon = '', + modified_icon = "●", + close_icon = "", + -- close_icon = '', + left_trunc_marker = "", + right_trunc_marker = "", + --- name_formatter can be used to change the buffer's label in the bufferline. + --- Please note some names can/will break the + --- bufferline so use this at your discretion knowing that it has + --- some limitations that will *NOT* be fixed. + -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" + -- -- remove extension from markdown files for example + -- if buf.name:match('%.md') then + -- return vim.fn.fnamemodify(buf.name, ':t:r') + -- end + -- end, + max_name_length = 30, + max_prefix_length = 30, -- prefix used when a buffer is de-duplicated + tab_size = 21, + diagnostics = false, -- | "nvim_lsp" | "coc", + diagnostics_update_in_insert = false, + -- diagnostics_indicator = function(count, level, diagnostics_dict, context) + -- return "("..count..")" + -- end, + -- NOTE: this will be called a lot so don't do any heavy processing here + -- custom_filter = function(buf_number) + -- -- filter out filetypes you don't want to see + -- if vim.bo[buf_number].filetype ~= "" then + -- return true + -- end + -- -- filter out by buffer name + -- if vim.fn.bufname(buf_number) ~= "" then + -- return true + -- end + -- -- filter out based on arbitrary rules + -- -- e.g. filter out vim wiki buffer from tabline in your work repo + -- if vim.fn.getcwd() == "" and vim.bo[buf_number].filetype ~= "wiki" then + -- return true + -- end + -- end, + offsets = { { filetype = "NvimTree", text = "", 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 + -- can also be a table containing 2 custom separators + -- [focused and unfocused]. eg: { '|', '|' } + separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, + enforce_regular_tabs = true, + always_show_bufferline = true, + -- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b) + -- -- add custom logic + -- return buffer_a.modified > buffer_b.modified + -- end + }, + highlights = { + background = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + + -- buffer_selected = { + -- fg = {attribute='fg',highlight='#ff0000'}, + -- bg = {attribute='bg',highlight='#0000ff'}, + -- gui = 'none' + -- }, + buffer_visible = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + + close_button = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + close_button_visible = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + -- close_button_selected = { + -- fg = {attribute='fg',highlight='TabLineSel'}, + -- bg ={attribute='bg',highlight='TabLineSel'} + -- }, + + 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" }, + }, + duplicate_visible = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + duplicate = { + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + }, + + 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" }, + }, + -- separator_visible = { + -- fg = {attribute='bg',highlight='TabLine'}, + -- bg = {attribute='bg',highlight='TabLine'} + -- }, + indicator_selected = { + fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, + bg = { attribute = "bg", highlight = "Normal" }, + }, + },}) + + vim.api.nvim_set_keymap('n', '', 'bdelete', { noremap = true }) + vim.api.nvim_set_keymap('n', '', 'BufferLineGoToBuffer 1', { noremap = true }) + vim.api.nvim_set_keymap('n', '', 'BufferLineGoToBuffer 2', { noremap = true }) + vim.api.nvim_set_keymap('n', '', 'BufferLineGoToBuffer 3', { noremap = true }) + vim.api.nvim_set_keymap('n', '', 'BufferLineGoToBuffer 4', { noremap = true }) + vim.api.nvim_set_keymap('n', '', 'BufferLineGoToBuffer 5', { noremap = true }) + vim.api.nvim_set_keymap('n', '', 'BufferLineGoToBuffer 6', { noremap = true }) + vim.api.nvim_set_keymap('n', '', 'BufferLineGoToBuffer 7', { noremap = true }) + vim.api.nvim_set_keymap('n', '', 'BufferLineGoToBuffer 8', { noremap = true }) + vim.api.nvim_set_keymap('n', '', 'BufferLineGoToBuffer 9', { noremap = true }) + + end, + }, +} + + + + diff --git a/nvim/.config/nvim/lua/plugins/cloak.lua b/nvim/.config/nvim/lua/plugins/cloak.lua new file mode 100644 index 0000000..8e3656b --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/cloak.lua @@ -0,0 +1,22 @@ +return { + { + "laytan/cloak.nvim", + config = function() + require("cloak").setup({ + enabled = true, + cloak_character = "*", + highlight_group = "Comment", + patterns = { + { + file_pattern = ".netrc", + cloak_pattern = " .+", + }, + { + file_pattern = ".pipeline", + cloak_pattern = ":.+", + }, + }, + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/codeium.lua b/nvim/.config/nvim/lua/plugins/codeium.lua new file mode 100644 index 0000000..1ef5b64 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/codeium.lua @@ -0,0 +1,22 @@ +return { + { + "Exafunction/codeium.vim", + event = "InsertEnter", + config = function() + vim.api.nvim_set_keymap("i", "", [[lua vim.fn["codeium#Accept"]()]], { noremap = true }) + vim.api.nvim_set_keymap( + "i", + "", + [[lua vim.fn["codeium#CycleCompletions"](1)]], + { noremap = true } + ) + vim.api.nvim_set_keymap( + "i", + "", + [[lua vim.fn["codeium#CycleCompletions"](-1)]], + { noremap = true } + ) + vim.api.nvim_set_keymap("i", "", [[lua vim.fn["codeium#Clear"]()]], { noremap = true }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/comments.lua b/nvim/.config/nvim/lua/plugins/comments.lua new file mode 100644 index 0000000..0610412 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/comments.lua @@ -0,0 +1,17 @@ +return { + { + "numToStr/Comment.nvim", + config = function() + require("Comment").setup({}) + + -- Comment with 'Ctrl-/' + vim.api.nvim_set_keymap('n', '', 'lua require("Comment.api").toggle.linewise()', { noremap = true }) + vim.api.nvim_set_keymap('i', '', 'lua require("Comment.api").toggle.linewise()', { noremap = true }) + vim.api.nvim_set_keymap('v', '', 'lua require("Comment.api").toggle.linewise(vim.fn.visualmode())', { noremap = true }) + + end, + }, +} + + + diff --git a/nvim/.config/nvim/lua/plugins/completions.lua b/nvim/.config/nvim/lua/plugins/completions.lua new file mode 100644 index 0000000..aa7edd1 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/completions.lua @@ -0,0 +1,44 @@ +return { + { + "hrsh7th/cmp-nvim-lsp" + }, + { + "L3MON4D3/LuaSnip", + dependencies = { + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + }, + { + "hrsh7th/nvim-cmp", + config = function() + local cmp = require("cmp") + local cmp_select = { behavior = cmp.SelectBehavior.Select } + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(cmp_select), + [""] = cmp.mapping.select_next_item(cmp_select), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, { + { name = "buffer" }, + }), + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/dap.lua b/nvim/.config/nvim/lua/plugins/dap.lua new file mode 100644 index 0000000..4507f1c --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/dap.lua @@ -0,0 +1,26 @@ +return { + "mfussenegger/nvim-dap", + event = "VeryLazy", + dependencies = { + "rcarriga/nvim-dap-ui", + "tpope/vim-fugitive", + }, + config = function() + require("dapui").setup() + + local dap, dapui = require("dap"), require("dapui") + + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + end, +} diff --git a/nvim/.config/nvim/lua/plugins/dracula.lua b/nvim/.config/nvim/lua/plugins/dracula.lua new file mode 100644 index 0000000..2ece62f --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/dracula.lua @@ -0,0 +1,9 @@ +return { + { "Mofiqul/dracula.nvim" }, + { + "LazyVim/LazyVim", + opts = { + colorscheme = "dracula", + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/git.lua b/nvim/.config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..ea0c0d2 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/git.lua @@ -0,0 +1,19 @@ +return { + { + "dinhhuy258/git.nvim", + config = function() + require("git").setup({}) + end, + }, + { + "sindrets/diffview.nvim", + event = "VeryLazy", + }, + { + "lewis6991/gitsigns.nvim", + event = "VeryLazy", + config = function() + require("gitsigns").setup({}) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/illuminate.lua b/nvim/.config/nvim/lua/plugins/illuminate.lua new file mode 100644 index 0000000..b26df26 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/illuminate.lua @@ -0,0 +1,8 @@ +return { + { + "RRethy/vim-illuminate", + config = function() + require("illuminate").configure() + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/impatient.lua b/nvim/.config/nvim/lua/plugins/impatient.lua new file mode 100644 index 0000000..3713e16 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/impatient.lua @@ -0,0 +1,9 @@ +return { + { + "lewis6991/impatient.nvim", + config = function() + require("impatient").enable_profile() + end, + }, +} + diff --git a/nvim/.config/nvim/lua/plugins/java.lua b/nvim/.config/nvim/lua/plugins/java.lua new file mode 100644 index 0000000..738eb7d --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/java.lua @@ -0,0 +1,3 @@ +return { + "mfussenegger/nvim-jdtls", +} diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..af8e3ff --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,67 @@ +return { + { + "williamboman/mason.nvim", + lazy = false, + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", + lazy = false, + opts = { + auto_install = true, + }, + config = function() + require("mason-lspconfig").setup({ + -- Replace the language servers listed here + -- with the ones you want to install + ensure_installed = { + "cssls", + "cssmodules_ls", + "html", + "jsonls", + "tsserver", + "lua_ls", + "yamlls", + "bashls", + "prismals", + "jdtls", + }, + }) + end, + }, + { + "neovim/nvim-lspconfig", + lazy = false, + config = function() + local capabilities = require("cmp_nvim_lsp").default_capabilities() + + local lspconfig = require("lspconfig") + lspconfig.tsserver.setup({ + capabilities = capabilities, + }) + lspconfig.html.setup({ + capabilities = capabilities, + }) + lspconfig.lua_ls.setup({ + capabilities = capabilities, + }) + lspconfig.jdtls.setup({ + capabilities = capabilities, + }) + + vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, {}) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {}) + vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) + vim.keymap.set("n", "gl", vim.diagnostic.open_float, {}) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, {}) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next, {}) + vim.keymap.set("n", "", vim.lsp.buf.code_action, {}) + vim.keymap.set("n", "gr", vim.lsp.buf.references, {}) + vim.keymap.set("n", "gR", vim.lsp.buf.rename, {}) + vim.keymap.set("i", "gs", vim.lsp.buf.signature_help, {}) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/lualine.lua b/nvim/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..bcc1707 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,175 @@ +return { + { + "nvim-lualine/lualine.nvim", + config = function() + local lualine = require("lualine") + -- Color table for highlights + -- stylua: ignore + local colors = { + bg = '#101019', + fg = '#cdd6f4', + yellow = '#f9e2af', + cyan = '#89dceb', + darkblue = '#45475a', + green = '#a6e3a1', + orange = '#fab387', + violet = '#cba6f7', + magenta = '#f5c2e7', + blue = '#89b4fa', + red = '#f38ba8', + } + + local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand("%:p:h") + local gitdir = vim.fn.finddir(".git", filepath .. ";") + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, + } + + -- Config + local config = { + options = { + -- Disable sections and component separators + component_separators = "", + section_separators = "", + theme = { + -- We are going to use lualine_c an lualine_x as left and + -- right section. Both are highlighted by c theme . So we + -- are just setting default looks o statusline + normal = { c = { fg = colors.fg, bg = colors.bg } }, + inactive = { c = { fg = colors.fg, bg = colors.bg } }, + }, + disabled_filetypes = { "NvimTree", "alpha" }, + }, + sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + -- These will be filled later + lualine_c = {}, + lualine_x = {}, + }, + inactive_sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + } + + -- Inserts a component in lualine_c at left section + local function ins_left(component) + table.insert(config.sections.lualine_c, component) + end + + -- Inserts a component in lualine_x to right section + local function ins_right(component) + table.insert(config.sections.lualine_x, component) + end + + ins_left({ + -- filesize component + "filesize", + cond = conditions.buffer_not_empty, + }) + + ins_left({ + "filename", + cond = conditions.buffer_not_empty, + color = { fg = colors.magenta, gui = "bold" }, + }) + + ins_left({ "location" }) + + ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } }) + + ins_left({ + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { error = " ", warn = " ", info = " " }, + diagnostics_color = { + color_error = { fg = colors.red }, + color_warn = { fg = colors.yellow }, + color_info = { fg = colors.cyan }, + }, + }) + + -- Insert mid section. You can make any number of sections in neovim :) + -- for lualine it's any number greater then 2 + ins_left({ + function() + return "%=" + end, + }) + + ins_left({ + -- Lsp server name . + function() + local msg = "No Active Lsp" + local buf_ft = vim.api.nvim_buf_get_option(0, "filetype") + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end, + icon = " LSP:", + color = { fg = "#ffffff", gui = "bold" }, + }) + + -- Add components to right sections + ins_right({ + "o:encoding", -- option component same as &encoding in viml + fmt = string.upper, -- I'm not sure why it's upper case either ;) + cond = conditions.hide_in_width, + color = { fg = colors.green, gui = "bold" }, + }) + + ins_right({ + "fileformat", + fmt = string.upper, + icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh + color = { fg = colors.green, gui = "bold" }, + }) + + ins_right({ + "branch", + icon = "", + color = { fg = colors.violet, gui = "bold" }, + }) + + ins_right({ + "diff", + -- Is it me or the symbol for modified us really weird + symbols = { added = " ", modified = "柳 ", removed = " " }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.orange }, + removed = { fg = colors.red }, + }, + cond = conditions.hide_in_width, + }) + + -- Now don't forget to initialize lualine + lualine.setup(config) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/null-ls.lua b/nvim/.config/nvim/lua/plugins/null-ls.lua new file mode 100644 index 0000000..1196f2f --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/null-ls.lua @@ -0,0 +1,41 @@ +return { + { + "jose-elias-alvarez/null-ls.nvim", + config = function() + local null_ls = require("null-ls") + -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting + local formatting = null_ls.builtins.formatting + -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics + local diagnostics = null_ls.builtins.diagnostics + local code_actions = null_ls.builtins.code_actions + + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + + null_ls.setup({ + debug = false, + sources = { + formatting.stylua, -- Lua + formatting.beautysh, -- Bash, Zsh + diagnostics.codespell, -- Codespell + diagnostics.eslint, -- JavaScript etc + code_actions.eslint, -- JavaScript etc + formatting.prettier, -- JavaScript etc + formatting.google_java_format, -- Java + }, + -- you can reuse a shared lspconfig on_attach callback here + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ bufnr = bufnr }) + end, + }) + end + end, + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/nvim-tree.lua b/nvim/.config/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..c0fd70a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/nvim-tree.lua @@ -0,0 +1,123 @@ +return { + { + "kyazdani42/nvim-tree.lua", + event = "VeryLazy", + config = function() + require("nvim-tree").setup({ + hijack_directories = { + enable = false, + }, + -- update_to_buf_dir = { + -- enable = false, + -- }, + -- disable_netrw = true, + -- hijack_netrw = true, + -- ignore_ft_on_setup = { + -- "startify", + -- "dashboard", + -- "alpha", + -- }, + filters = { + custom = { "^.git$" }, + }, + -- auto_close = true, + -- open_on_tab = false, + -- hijack_cursor = false, + update_cwd = true, + -- update_to_buf_dir = { + -- enable = true, + -- auto_open = true, + -- }, + -- --  error + -- --  info + -- --  question + -- --  warning + -- --  lightbulb + renderer = { + add_trailing = false, + group_empty = false, + highlight_git = false, + highlight_opened_files = "none", + root_folder_modifier = ":t", + indent_markers = { + enable = false, + icons = { + corner = "└ ", + edge = "│ ", + none = " ", + }, + }, + icons = { + webdev_colors = true, + git_placement = "before", + padding = " ", + symlink_arrow = " ➛ ", + show = { + file = true, + folder = true, + folder_arrow = true, + git = true, + }, + glyphs = { + default = "", + symlink = "", + folder = { + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + symlink_open = "", + }, + git = { + unstaged = "", + staged = "S", + unmerged = "", + renamed = "➜", + untracked = "U", + deleted = "", + ignored = "◌", + }, + }, + }, + }, + diagnostics = { + enable = true, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {}, + }, + -- system_open = { + -- cmd = nil, + -- args = {}, + -- }, + -- filters = { + -- dotfiles = false, + -- custom = {}, + -- }, + git = { + enable = true, + ignore = true, + timeout = 500, + }, + view = { + adaptive_size = true, + side = "left", + -- auto_resize = true, + number = false, + relativenumber = false, + }, + }) + + vim.keymap.set("n", "", ":NvimTreeToggle") + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..d05cd83 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,56 @@ +return { + { + "nvim-telescope/telescope.nvim", + tag = "0.1.5", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("telescope").setup({ + defaults = { + prompt_prefix = " > ", + file_ignore_patterns = { + ".git/", + "node_modules/", + }, + 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, + }, + }, + pickers = { + find_files = { + show_untracked = true, + hidden = true, + }, + git_files = { + show_untracked = true, + hidden = true, + }, + live_grep = { + additional_args = function() + return { "--hidden" } + end, + }, + }, + }) + + local builtin = require("telescope.builtin") + vim.keymap.set("n", "", builtin.find_files) + vim.keymap.set("n", "fg", builtin.live_grep) + vim.keymap.set("n", "fw", function() + local word = vim.fn.expand("") + builtin.grep_string({ search = word }) + end) + vim.keymap.set("n", "fW", function() + local word = vim.fn.expand("") + builtin.grep_string({ search = word }) + end) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/todo-comments.lua b/nvim/.config/nvim/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..e247b46 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/todo-comments.lua @@ -0,0 +1,9 @@ +return { + { + "folke/todo-comments.nvim", + event = "BufReadPre", + config = function() + require("todo-comments").setup({}) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..66a6212 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,14 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local config = require("nvim-treesitter.configs") + config.setup({ + ensure_installed = {"lua", "javascript"}, + highlight = { enable = true }, + indent = { enable = true }, + }) + end + } +} diff --git a/nvim/.config/nvim/lua/plugins/web-devicons.lua b/nvim/.config/nvim/lua/plugins/web-devicons.lua new file mode 100644 index 0000000..0030476 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/web-devicons.lua @@ -0,0 +1,16 @@ +return { + { + "kyazdani42/nvim-web-devicons", + event = "VeryLazy", + config = function() + require("nvim-web-devicons").setup({ + -- your personal icons can go here (to override) + -- DevIcon will be appended to `name` + override = {}, + -- globally enable default icons (default to false) + -- will get overridden by `get_icons` option + default = true, + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/whichkey.lua b/nvim/.config/nvim/lua/plugins/whichkey.lua new file mode 100644 index 0000000..4307454 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/whichkey.lua @@ -0,0 +1,116 @@ +return { + { + "folke/which-key.nvim", + event = "VeryLazy", + config = function() + local function set_background(content) + print(content) + vim.fn.system("feh --bg-max " .. content) + end + + local function select_background(prompt_bufnr, map) + local function set_the_background(close) + local content = require("telescope.actions.state").get_selected_entry(prompt_bufnr) + set_background(content.cwd .. "/" .. content.value) + if close then + require("telescope.actions").close(prompt_bufnr) + end + end + + map("i", "", function() + set_the_background() + end) + + map("i", "", function() + set_the_background(true) + end) + end + + local function background_image_selector(prompt, cwd) + return function() + require("telescope.builtin").find_files({ + prompt_title = prompt, + cwd = cwd, + previewer = false, + + attach_mappings = function(prompt_bufnr, map) + select_background(prompt_bufnr, map) + + return true + end, + }) + end + end + + local mappings = { + r = { ":%s/\\<\\>//gI", "Replace word" }, + g = { + name = "Git", + d = { ":DiffviewOpen", "Diff" }, + ["dc"] = { ":DiffviewClose", "Diff Close" }, + -- d = { + -- "Gitsigns diffthis HEAD", + -- "Diff", + -- }, + }, + f = { + name = "Find", + f = { "Telescope find_files", "Find files" }, + g = { "Telescope live_grep", "Find text in files" }, + b = { "Telescope buffers", "Find buffers" }, + t = { "Telescope help_tags", "Find tags" }, + r = { "Telescope resume", "Last search" }, + d = { "Telescope diagnostics", "Find diagnostics" }, + }, + l = { + name = "LSP", + a = { "lua vim.lsp.buf.code_action()", "Code Action" }, + i = { "LspInfo", "Info" }, + f = { "lua vim.lsp.buf.format({ async = true })", "Format" }, + F = { "LspToggleAutoFormat", "Toggle Autoformat" }, + r = { "lua vim.lsp.buf.rename()", "Rename" }, + R = { "TroubleToggle lsp_references", "References" }, + }, + s = { + name = "Tabs", + l = { ":vsp", "Split vertically" }, + j = { ":sp", "Split horizontally" }, + v = { "tH", "Change to vertical split" }, + h = { "tK", "Change to horizontal split" }, + }, + p = { + name = "Packer", + r = { ":PackerClean", "Remove Unused Plugins" }, + c = { ":PackerCompile profile=true", "Recompile Plugins" }, + i = { ":PackerInstall", "Install Plugins" }, + p = { ":PackerProfile", "Packer Profile" }, + s = { ":PackerSync", "Sync Plugins" }, + S = { ":PackerStatus", "Packer Status" }, + u = { ":PackerUpdate", "Update Plugins" }, + }, + d = { + name = "Debug", + b = { "lua require'dap'.toggle_breakpoint()", "Breakpoint" }, + c = { "lua require'dap'.continue()", "Continue" }, + i = { "lua require'dap'.step_into()", "Into" }, + o = { "lua require'dap'.step_over()", "Over" }, + O = { "lua require'dap'.step_out()", "Out" }, + r = { "lua require'dap'.repl.toggle()", "Repl" }, + l = { "lua require'dap'.run_last()", "Last" }, + u = { "lua require'dapui'.toggle()", "UI" }, + x = { "lua require'dap'.terminate()", "Exit" }, + }, + b = { + name = "Background", + i = { + background_image_selector("Background images", "~/personal-projects/background-images"), + "Background images", + }, + }, + } + + local opts = { prefix = "" } + require("which-key").register(mappings, opts) + end, + }, +} diff --git a/nvim/.config/nvim/lua/user/colorscheme.lua b/nvim/.config/nvim/lua/user/colorscheme.lua deleted file mode 100644 index 982f272..0000000 --- a/nvim/.config/nvim/lua/user/colorscheme.lua +++ /dev/null @@ -1,7 +0,0 @@ -local colorscheme = "dracula" - -local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) -if not status_ok then - vim.notify("colorscheme " .. colorscheme .. " not found!") - return -end diff --git a/nvim/.config/nvim/lua/user/init.lua b/nvim/.config/nvim/lua/user/init.lua deleted file mode 100644 index bae98aa..0000000 --- a/nvim/.config/nvim/lua/user/init.lua +++ /dev/null @@ -1,28 +0,0 @@ -require("user.options") -require("user.keymaps") -require("user.colorscheme") -require("user.packer") - -local augroup = vim.api.nvim_create_augroup -local autocmd = vim.api.nvim_create_autocmd - -local yank_group = augroup("HighlightYank", {}) -autocmd("TextYankPost", { - group = yank_group, - pattern = "*", - callback = function() - vim.highlight.on_yank({ - higroup = "IncSearch", - timeout = 40, - }) - end, -}) - --- local open_telescope_find_files = augroup("FindFilesOnStartUp", {}) --- autocmd("VimEnter", { --- group = open_telescope_find_files, --- pattern = "*", --- callback = function() --- vim.cmd("lua require('user.telescope').find_files()") --- end, --- }) diff --git a/nvim/.config/nvim/lua/user/keymaps.lua b/nvim/.config/nvim/lua/user/keymaps.lua deleted file mode 100644 index edca20b..0000000 --- a/nvim/.config/nvim/lua/user/keymaps.lua +++ /dev/null @@ -1,25 +0,0 @@ -local M = {} - -local function bind(op, outer_opts) - outer_opts = outer_opts or { noremap = true } - return function(lhs, rhs, opts) - opts = vim.tbl_extend("force", outer_opts, opts or {}) - vim.keymap.set(op, lhs, rhs, opts) - end -end - --- Modes --- normal_mode = "n", --- insert_mode = "i", --- visual_mode = "v", --- visual_block_mode = "x", --- term_mode = "t", --- command_mode = "c", - -M.nmap = bind("n", { noremap = false }) -M.nnoremap = bind("n") -M.vnoremap = bind("v") -M.xnoremap = bind("x") -M.inoremap = bind("i") - -return M diff --git a/nvim/.config/nvim/lua/user/lsp.lua b/nvim/.config/nvim/lua/user/lsp.lua deleted file mode 100644 index a5f2bc7..0000000 --- a/nvim/.config/nvim/lua/user/lsp.lua +++ /dev/null @@ -1,31 +0,0 @@ -local M = {} - -M.on_attach = function(client, bufnr) - local opts = { buffer = bufnr, remap = false } - - local keymap = vim.keymap - local buf = vim.lsp.buf - local diagnostic = vim.diagnostic - - keymap.set("n", "gd", buf.definition, opts) - keymap.set("n", "gD", buf.declaration, opts) - keymap.set("n", "gi", buf.implementation, opts) - keymap.set("n", "K", buf.hover, opts) - keymap.set("n", "gl", diagnostic.open_float, opts) - keymap.set("n", "[d", diagnostic.goto_prev, opts) - keymap.set("n", "]d", diagnostic.goto_next, opts) - keymap.set("n", "", buf.code_action, opts) - keymap.set("n", "gr", buf.references, opts) - keymap.set("n", "gR", buf.rename, opts) - keymap.set("i", "gs", buf.signature_help, opts) - - if client.name == "jdt.ls" then - vim.lsp.codelens.refresh() - if JAVA_DAP_ACTIVE then - require("jdtls").setup_dap({ hotcodereplace = "auto" }) - require("jdtls.dap").setup_dap_main_class_configs() - end - end -end - -return M diff --git a/nvim/.config/nvim/lua/user/options.lua b/nvim/.config/nvim/lua/user/options.lua deleted file mode 100644 index 534e2cc..0000000 --- a/nvim/.config/nvim/lua/user/options.lua +++ /dev/null @@ -1,51 +0,0 @@ -local home = os.getenv("HOME") - -local options = { - exrc = true, - hlsearch = false, -- highlight all matches on previous search pattern - hidden = true, - errorbells = false, - tabstop = 4, -- insert 4 spaces for a tab - softtabstop = 4, - shiftwidth = 4, -- the number of spaces inserted for each indentation - expandtab = true, -- convert tabs to spaces - number = true, -- set numbered lines - relativenumber = true, -- set relative numbered lines - wrap = false, -- display lines as one long line - smartcase = true, -- smart case - smartindent = true, -- make indenting smarter again - swapfile = false, -- creates a swapfile - backup = false, -- creates a backup file - clipboard = "unnamedplus", -- allows neovim to access the system clipboard - undodir = vim.fn.expand("~/.vim/undodir"), - undofile = true, -- enable persistent undo - incsearch = true, - scrolloff = 8, -- determine the number of context lines you would like to see above and below the cursor - signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time - cursorcolumn = true, - cursorline = true, -- highlight the current line - ignorecase = true, -- ignore case in search patterns - splitbelow = true, -- force all horizontal splits to go below current window - splitright = true, -- force all vertical splits to go to the right of current window - colorcolumn = "80", - updatetime = 50, -- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable delays and poor user experience. -} - -for k, v in pairs(options) do - vim.opt[k] = v -end - --- Leader -vim.g.mapleader = " " - --- Turns off netrw -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 -vim.g.loaded_netrwSettings = 1 -vim.g.loaded_netrwFileHandlers = 1 - --- Fillchars(eob: end of buffer) -vim.opt.fillchars = vim.opt.fillchars + "eob: " - --- Shorter messages -vim.opt.shortmess:append("c") diff --git a/nvim/.config/nvim/lua/user/packer.lua b/nvim/.config/nvim/lua/user/packer.lua deleted file mode 100644 index 373c5f2..0000000 --- a/nvim/.config/nvim/lua/user/packer.lua +++ /dev/null @@ -1,144 +0,0 @@ -local fn = vim.fn - --- Automatically install packer -local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" -if fn.empty(fn.glob(install_path)) > 0 then - PACKER_BOOTSTRAP = fn.system({ - "git", - "clone", - "--depth", - "1", - "https://github.com/wbthomason/packer.nvim", - install_path, - }) - print("Installing packer close and reopen Neovim...") - vim.cmd([[packadd packer.nvim]]) -end - --- Autocommand that reloads neovim whenever you save the packer.lua file -vim.cmd([[ - augroup packer_user_config - autocmd! - autocmd BufWritePost packer.lua source | PackerSync - augroup end -]]) - --- Use a protected call so we don't error out on first use -local status_ok, packer = pcall(require, "packer") -if not status_ok then - vim.notify("packer not found!") - return -end - --- Have packer use a popup window -packer.init({ - display = { - open_fn = function() - return require("packer.util").float({ border = "rounded" }) - end, - }, -}) - --- Install your plugins here -return packer.startup(function(use) - -- My plugins here - - -- Have packer manage itself - use({ "wbthomason/packer.nvim" }) - -- An implementation of the Popup API from vim in Neovim - use({ "nvim-lua/popup.nvim" }) - -- Useful lua functions used ny lots of plugins - use({ "nvim-lua/plenary.nvim" }) - use({ "windwp/nvim-ts-autotag" }) - use({ "akinsho/bufferline.nvim" }) - use({ "nvim-lualine/lualine.nvim" }) - use({ "kyazdani42/nvim-tree.lua" }) - use({ "laytan/cloak.nvim" }) - - -- UTILITIES - use({ "lewis6991/impatient.nvim" }) - - -- ICONS - use({ "kyazdani42/nvim-web-devicons" }) - - -- COMMENTS - use({ "numToStr/Comment.nvim" }) - use({ "folke/todo-comments.nvim" }) - - -- UI - use({ "folke/which-key.nvim" }) - - -- COLORSCHME - use({ "Mofiqul/dracula.nvim" }) - - -- TabNine - use({ "tzachar/cmp-tabnine", run = "./install.sh" }) - - -- Telescope - use({ "nvim-telescope/telescope.nvim", tag = "0.1.5" }) - - -- Treesitter - use({ - "nvim-treesitter/nvim-treesitter", - run = function() - local ts_update = require("nvim-treesitter.install").update({ with_sync = true }) - ts_update() - end, - }) - -- Sticky header - use({ "nvim-treesitter/nvim-treesitter-context" }) - - -- Illuminate - use({ "RRethy/vim-illuminate" }) - - -- Git - use({ "dinhhuy258/git.nvim" }) - use({ "lewis6991/gitsigns.nvim" }) - use({ - "sindrets/diffview.nvim", - requires = "nvim-lua/plenary.nvim", - }) - - -- LSP - use({ - "VonHeikemen/lsp-zero.nvim", - requires = { - -- LSP Support - { "neovim/nvim-lspconfig" }, - { "williamboman/mason.nvim" }, - { "williamboman/mason-lspconfig.nvim" }, - - -- Autocompletion - { "hrsh7th/nvim-cmp" }, - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/cmp-path" }, - { "saadparwaiz1/cmp_luasnip" }, - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-nvim-lua" }, - - -- Snippets - { "L3MON4D3/LuaSnip" }, - { "rafamadriz/friendly-snippets" }, - }, - }) - - -- Formatters and linters - use({ "jose-elias-alvarez/null-ls.nvim" }) - - -- Java - use({ "mfussenegger/nvim-jdtls" }) - - -- DAP - use({ "mfussenegger/nvim-dap" }) - use({ "rcarriga/nvim-dap-ui" }) - use({ "ravenxrz/DAPInstall.nvim" }) - - -- AI - use({ "Exafunction/codeium.vim" }) - - -- Automatically set up your configuration after cloning packer.nvim - -- Put this at the end after all plugins - if PACKER_BOOTSTRAP then - require("packer").sync() - end -end) diff --git a/nvim/.config/nvim/lua/user/telescope.lua b/nvim/.config/nvim/lua/user/telescope.lua deleted file mode 100644 index fb9ebad..0000000 --- a/nvim/.config/nvim/lua/user/telescope.lua +++ /dev/null @@ -1,62 +0,0 @@ -local utilities = require("user.utilities") -local existsDir = utilities.existsDir - -local M = {} - -local function set_background(content) - print(content) - vim.fn.system("feh --bg-max " .. content) -end - -local function select_background(prompt_bufnr, map) - local function set_the_background(close) - local content = require("telescope.actions.state").get_selected_entry(prompt_bufnr) - set_background(content.cwd .. "/" .. content.value) - if close then - require("telescope.actions").close(prompt_bufnr) - end - end - - map("i", "", function() - set_the_background() - end) - - map("i", "", function() - set_the_background(true) - end) -end - -local function image_selector(prompt, cwd) - return function() - require("telescope.builtin").find_files({ - prompt_title = prompt, - cwd = cwd, - previewer = false, - - attach_mappings = function(prompt_bufnr, map) - select_background(prompt_bufnr, map) - - return true - end, - }) - end -end - -local function find_files() - local tele_built = require("telescope.builtin") - - local pwd = vim.fn.getcwd() - local current_git_dir = pwd .. "/.git" - - local ok, err = existsDir(current_git_dir) - if ok then - tele_built.git_files() - else - tele_built.find_files() - end -end - -M.background_image_selector = image_selector("Background images", "~/personal-projects/background-images") -M.find_files = find_files - -return M diff --git a/nvim/.config/nvim/lua/user/utilities.lua b/nvim/.config/nvim/lua/user/utilities.lua deleted file mode 100644 index dfd2fda..0000000 --- a/nvim/.config/nvim/lua/user/utilities.lua +++ /dev/null @@ -1,20 +0,0 @@ -local M = {} - -local function exists(file) - local ok, err, code = os.rename(file, file) - if not ok then - if code == 13 then - -- Permission denied, but it exists - return true - end - end - return ok, err -end - -local function existsDir(path) - return exists(path .. "/") -end - -M.existsDir = existsDir - -return M