diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000..bd675496 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,36 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "3657c3f3cb2214a681fc7e95b6ffb509d076ebfb" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, + "gitsigns.nvim": { "branch": "main", "commit": "bce4576a9047085a528c479a7fe1e2f6b787b6c1" }, + "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, + "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" }, + "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, + "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f014db32437aa61c86fc0ef1067cd2bc6a37205c" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "6148b51db945b55b3b725da39eaea6441e59dff8" }, + "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, + "neodev.nvim": { "branch": "main", "commit": "471324e6c746284dbbdc1d357799d1911bb7e120" }, + "neoformat": { "branch": "master", "commit": "0c285d7a7c06a6ee88db70871a274797693fce42" }, + "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-dap": { "branch": "master", "commit": "b3d4408e29d924fe130c9397a7c3b3630b3ea671" }, + "nvim-dap-go": { "branch": "main", "commit": "1b508e9db330108d3b5d62a6d9cc01fe6bbdd4e0" }, + "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, + "nvim-lspconfig": { "branch": "master", "commit": "f3195835c0447ee2c80152b893ab51ca162b04a9" }, + "nvim-tree.lua": { "branch": "master", "commit": "a3aa3b47eac8b6289f028743bef4ce9eb0f6782e" }, + "nvim-treesitter": { "branch": "master", "commit": "42d0fb31bde4c99a0a03620ba7414e77fe4713b7" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" }, + "nvim-web-devicons": { "branch": "master", "commit": "973ab742f143a796a779af4d786ec409116a0d87" }, + "onedark.nvim": { "branch": "master", "commit": "dac8c39812dae025255c9069a260e1f69d967927" }, + "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, + "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, + "vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } +} \ No newline at end of file diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000..74adc086 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,27 @@ +return { + 'ThePrimeagen/harpoon', + config = function() + local mark = require("harpoon.mark") + local ui = require("harpoon.ui") + + vim.keymap.set('n', "aa", mark.add_file, { desc = 'add file to list' }) + vim.keymap.set('n', "al", ui.toggle_quick_menu, { desc = 'quick list' }) + vim.keymap.set('n', "ap", ui.nav_prev) + vim.keymap.set('n', "an", ui.nav_next) + + vim.keymap.set('n', "", function() + ui.nav_file(1) + end) + vim.keymap.set('n', "", function() + ui.nav_file(2) + end) + + vim.keymap.set('n', "", function() + ui.nav_file(3) + end) + + vim.keymap.set('n', "", function() + ui.nav_file(4) + end) + end, +} diff --git a/lua/custom/plugins/keymap.lua b/lua/custom/plugins/keymap.lua new file mode 100644 index 00000000..fd15193c --- /dev/null +++ b/lua/custom/plugins/keymap.lua @@ -0,0 +1,32 @@ +vim.keymap.set('n', 'w', 'w', { desc = 'Write file' }) +vim.keymap.set('n', '', 'h', { desc = 'Window left' }) +vim.keymap.set('n', '', 'l', { desc = 'Window right' }) +vim.keymap.set('n', '', 'j', { desc = 'Window down' }) +vim.keymap.set('n', '', 'k', { desc = 'Window up' }) + +vim.keymap.set('i', '', '', { desc = 'Move left' }) +vim.keymap.set('i', '', '', { desc = 'Move right' }) + +vim.keymap.set('n', 'c', 'q', { desc = 'Move right' }) + +vim.keymap.set('n', '', ":m .+1==") +vim.keymap.set('n', '', ":m .-2==") + +vim.keymap.set('i', '', ":m .-2==gi") +vim.keymap.set('i', '', ":m .+1==gi") + +vim.keymap.set('v', '', ":m '>+1gv-gv") +vim.keymap.set('v', '', ":m '<-2gv-gv") + +vim.keymap.set('n', 'J', "mzJ`z") + +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', '', 'zz') + +vim.keymap.set('n', 'n', 'nzzzv') +vim.keymap.set('n', 'N', 'Nzzzv') + +vim.keymap.set('x', 'p', "\"_dP") + + +return {} diff --git a/lua/custom/plugins/neoformat.lua b/lua/custom/plugins/neoformat.lua new file mode 100644 index 00000000..19936ce9 --- /dev/null +++ b/lua/custom/plugins/neoformat.lua @@ -0,0 +1,10 @@ +vim.g.neoformat_try_node_exe = 1 + +vim.api.nvim_create_autocmd("BufWritePre", { + pattern = { "*.json", "*.jsonc", "*.js", "*.ts", "*.tsx", "*.jsx" }, + command = "silent Neoformat prettier", +}) + +return { + "sbdchd/neoformat", +} diff --git a/lua/custom/plugins/tree.lua b/lua/custom/plugins/tree.lua new file mode 100644 index 00000000..46da2cbd --- /dev/null +++ b/lua/custom/plugins/tree.lua @@ -0,0 +1,226 @@ +-- disable netrw at the very start of your init.lua +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- set termguicolors to enable highlight groups +vim.opt.termguicolors = true + +vim.keymap.set('n', 'e', 'NvimTreeToggle') + + +function on_text_search() + local api = require("nvim-tree.api") + local node = api.tree.get_node_under_cursor() + + vim.cmd("Telescope live_grep search_dirs=" .. node.absolute_path) +end + +function folder_search(bufnr) + local api = require("nvim-tree.api") + api.config.mappings.default_on_attach(bufnr) + + vim.api.nvim_buf_set_keymap( + bufnr, + "n", + "st", + "lua on_text_search()", + { silent = false, nowait = true } + ) +end + +function NvimTreeWidth() + local winwidth = vim.fn.winwidth(0) + if winwidth <= 100 then + return 30 + elseif winwidth <= 200 then + return 40 + else + return 50 + end +end + +return { + 'nvim-tree/nvim-tree.lua', + dependencies = { + 'nvim-tree/nvim-web-devicons' + }, + opts = { + on_attach = folder_search, + + auto_reload_on_write = false, + disable_netrw = false, + hijack_cursor = false, + hijack_netrw = true, + hijack_unnamed_buffer_when_opening = false, + sort_by = "name", + root_dirs = {}, + prefer_startup_root = false, + sync_root_with_cwd = true, + reload_on_bufenter = false, + respect_buf_cwd = false, + select_prompts = false, + view = { + adaptive_size = false, + centralize_selection = true, + width = NvimTreeWidth(), + hide_root_folder = false, + side = "left", + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", + float = { + enable = false, + quit_on_focus_loss = true, + open_win_config = { + relative = "editor", + border = "rounded", + width = 30, + height = 30, + row = 1, + col = 1, + }, + }, + }, + renderer = { + add_trailing = false, + group_empty = false, + highlight_git = true, + full_name = false, + highlight_opened_files = "none", + root_folder_label = ":t", + indent_width = 2, + indent_markers = { + enable = false, + inline_arrows = true, + icons = { + corner = "└", + edge = "│", + item = "│", + none = " ", + }, + }, + special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" }, + symlink_destination = true, + }, + hijack_directories = { + enable = false, + auto_open = true, + }, + update_focused_file = { + enable = true, + debounce_delay = 15, + update_root = true, + ignore_list = {}, + }, + -- diagnostics = { + -- enable = lvim.use_icons, + -- show_on_dirs = false, + -- show_on_open_dirs = true, + -- debounce_delay = 50, + -- severity = { + -- min = vim.diagnostic.severity.HINT, + -- max = vim.diagnostic.severity.ERROR, + -- }, + -- icons = { + -- hint = lvim.icons.diagnostics.BoldHint, + -- info = lvim.icons.diagnostics.BoldInformation, + -- warning = lvim.icons.diagnostics.BoldWarning, + -- error = lvim.icons.diagnostics.BoldError, + -- }, + -- }, + filters = { + dotfiles = false, + git_clean = false, + no_buffer = false, + -- custom = { "node_modules", "\\.cache" }, + custom = { "\\.cache" }, + exclude = {}, + }, + filesystem_watchers = { + enable = true, + debounce_delay = 50, + ignore_dirs = {}, + }, + git = { + enable = true, + ignore = false, + show_on_dirs = true, + show_on_open_dirs = true, + timeout = 200, + }, + actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + restrict_above_cwd = false, + }, + expand_all = { + max_folder_discovery = 300, + exclude = {}, + }, + file_popup = { + open_win_config = { + col = 1, + row = 1, + relative = "cursor", + border = "shadow", + style = "minimal", + }, + }, + open_file = { + quit_on_open = false, + resize_window = false, + window_picker = { + enable = true, + picker = "default", + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", + exclude = { + filetype = { "notify", "lazy", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "nofile", "terminal", "help" }, + }, + }, + }, + remove_file = { + close_window = true, + }, + }, + trash = { + cmd = "trash", + require_confirm = true, + }, + live_filter = { + prefix = "[FILTER]: ", + always_show_folders = true, + }, + tab = { + sync = { + open = false, + close = false, + ignore = {}, + }, + }, + notify = { + threshold = vim.log.levels.INFO, + }, + log = { + enable = false, + truncate = false, + types = { + all = false, + config = false, + copy_paste = false, + dev = false, + diagnostics = false, + git = false, + profile = false, + watcher = false, + }, + }, + system_open = { + cmd = nil, + args = {}, + }, + }, +} diff --git a/lua/custom/plugins/undotree.lua b/lua/custom/plugins/undotree.lua new file mode 100644 index 00000000..5daf5dab --- /dev/null +++ b/lua/custom/plugins/undotree.lua @@ -0,0 +1,5 @@ +vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle) + +return { + 'mbbill/undotree' +}