diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua index e177292..a1bc0eb 100644 --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -11,13 +11,13 @@ if u.has_plugin("packer") then }, } - require "core.plugins" require "impatient" + require "core.plugins" require "core.options" require "core.autocommands" - require "core.keymappings" require "core.theme" + require "core.keymappings" require "configs.dashboard" require "configs.command-center" diff --git a/configs/nvim/lua/configs/command-center.lua b/configs/nvim/lua/configs/command-center.lua index b627073..e2fb683 100644 --- a/configs/nvim/lua/configs/command-center.lua +++ b/configs/nvim/lua/configs/command-center.lua @@ -2,6 +2,11 @@ local command_center = require("command_center") local noremap = { noremap = true } command_center.add({ + { + description = "Show Sessions", + cmd = ":lua require('session-lens').search_session()", + keybindings = { "n", "", noremap } + }, { description = "Search inside current buffer", cmd = "Telescope current_buffer_fuzzy_find", @@ -24,10 +29,12 @@ command_center.add({ { description = "Show function signaure (hover)", cmd = "lua vim.lsp.buf.hover()", - }, { + }, + { description = "(TS) Organize Imports", cmd = "OrganizeImports" - }, { + }, + { description = "ZenMode", cmd = "ZenMode", keybindings = { "n", "z", noremap } diff --git a/configs/nvim/lua/configs/telescope.lua b/configs/nvim/lua/configs/telescope.lua index ba49128..16877ea 100644 --- a/configs/nvim/lua/configs/telescope.lua +++ b/configs/nvim/lua/configs/telescope.lua @@ -1,55 +1,57 @@ local telescope = require("telescope") local default = { - defaults = { - vimgrep_arguments = { - "rg", - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - "--smart-case" - }, - prompt_prefix = "  ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "ascending", - layout_strategy = "horizontal", - layout_config = { - horizontal = { - prompt_position = "top", - preview_width = 0.55, - results_width = 0.8 - }, - vertical = { - mirror = false - }, - width = 0.87, - height = 0.80, - preview_cutoff = 120 - }, - file_sorter = require("telescope.sorters").get_fuzzy_file, - file_ignore_patterns = {"node_modules"}, - generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - path_display = {"truncate"}, - winblend = 0, - border = {}, - borderchars = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"}, - color_devicons = true, - use_less = true, - set_env = {["COLORTERM"] = "truecolor"}, -- default = nil, - file_previewer = require("telescope.previewers").vim_buffer_cat.new, - grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, - qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, - -- Developer configurations: Not meant for general override - buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker - } + defaults = { + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case" + }, + prompt_prefix = "  ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + preview_width = 0.55, + results_width = 0.8 + }, + vertical = { + mirror = false + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120 + }, + file_sorter = require("telescope.sorters").get_fuzzy_file, + file_ignore_patterns = { "node_modules" }, + generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + path_display = { "truncate" }, + winblend = 0, + border = {}, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + color_devicons = true, + use_less = true, + set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, + file_previewer = require("telescope.previewers").vim_buffer_cat.new, + grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker + } } telescope.setup(default) -- telescope.load_extension("themes"); +-- +telescope.load_extension("session-lens") telescope.load_extension("command_center"); telescope.load_extension("notify"); diff --git a/configs/nvim/lua/configs/tree.lua b/configs/nvim/lua/configs/tree.lua index 5f2fa6d..e8bc703 100644 --- a/configs/nvim/lua/configs/tree.lua +++ b/configs/nvim/lua/configs/tree.lua @@ -4,37 +4,29 @@ local g = vim.g g.nvim_tree_highlight_opened_files = 1 g.nvim_tree_group_empty = 1 g.nvim_tree_show_icons = { - folder_arrows = 0, - folders = 1, - files = 1, - git = 1 + folder_arrows = 0, + folders = 1, + files = 1, + git = 1 } require("nvim-tree").setup { - auto_open = 1, - gitignore = 1, - group_empty = 1, - hijack_cursor = 1, - update_cwd = true, - update_focused_file = { - enable = false - }, - renderer = { - indent_markers = { - enable = 0 - } - }, - diagnostics = { - enable = true, - icons = { - hint = "", - info = "", - warning = "", - error = "" - } - }, - view = { - auto_resize = true, - hide_root_folder = true, - signcolumn = "no" + hijack_cursor = true, + update_cwd = false, + trash = { + cmd = "trash", + require_confirm = true, + }, + diagnostics = { + enable = true, + icons = { + hint = "", + info = "", + warning = "", + error = "" } + }, + view = { + hide_root_folder = true, + signcolumn = "no" + } } diff --git a/configs/nvim/lua/core/autocommands.lua b/configs/nvim/lua/core/autocommands.lua index 19cf3d6..67edffd 100644 --- a/configs/nvim/lua/core/autocommands.lua +++ b/configs/nvim/lua/core/autocommands.lua @@ -1,11 +1,12 @@ local cmd = vim.cmd -cmd [[ - augroup highlight_yank - au! - au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 150 } - augroup END -]] +local config_group = vim.api.nvim_create_augroup('Config', {}) +vim.api.nvim_create_autocmd({ 'TextYankPost' }, { + group = config_group, + callback = function() + vim.highlight.on_yank() + end, +}) cmd [[ augroup filetypedetect diff --git a/configs/nvim/lua/core/keymappings.lua b/configs/nvim/lua/core/keymappings.lua index c2dd2c3..d561c2b 100644 --- a/configs/nvim/lua/core/keymappings.lua +++ b/configs/nvim/lua/core/keymappings.lua @@ -1,16 +1,16 @@ local map = vim.api.nvim_set_keymap local g = vim.g -local options = { noremap = true } +local options = { noremap = true, silent = true } local remap = { noremap = false } g.mapleader = " " -map("n", "", ":Telescope find_files", options) -map("n", "", ":Telescope live_grep", options) +map("n", "", ":Telescope git_files", options) +map("n", "", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }", options) map("n", "", ":Telescope command_center", options) map("n", "", "za", options) - +vim.notify("keys") -- LSP Functionality map("n", "gD", "lua vim.lsp.buf.declaration()", options) map("n", "gd", "lua vim.lsp.buf.definition()", options) @@ -36,7 +36,7 @@ map("n", "", ":bprevious", options); map("n", "", ":bnext", options); -- Backspace Delete like Browser -map('i', '', 'caw', options) +map('i', '', 'dbxi', options) -- Copy visual selection to keyboard map("v", "Y", '"+y', options) diff --git a/configs/nvim/lua/core/options.lua b/configs/nvim/lua/core/options.lua index 5ddc66f..6eeb9a1 100644 --- a/configs/nvim/lua/core/options.lua +++ b/configs/nvim/lua/core/options.lua @@ -12,7 +12,7 @@ set.clipboard = "unnamedplus" -- Copy paste between vim and everything else set.smarttab = true -- Makes tabbing smarter will realize you have 2 vs 4 set.expandtab = true -- Converts tabs to spaces set.autoindent = true -- Good auto indent -set.autochdir = true -- Your working directory will always be the same as your working directory +set.autochdir = false -- Your working directory will always be the same as your working directory set.incsearch = true -- sets incremental search set.shell = "/bin/zsh" -- Set your shell to bash or zsh set.shortmess:append "sI" -- Disable nvim intro diff --git a/configs/nvim/lua/core/plugins.lua b/configs/nvim/lua/core/plugins.lua index 5613405..aee94be 100644 --- a/configs/nvim/lua/core/plugins.lua +++ b/configs/nvim/lua/core/plugins.lua @@ -8,10 +8,13 @@ return require("packer").startup( use "nvim-lua/plenary.nvim" -- Theming Section + use "rktjmp/fwatch.nvim" -- Used to check dark/light theme use "EdenEast/nightfox.nvim" use "nvim-lualine/lualine.nvim" -- Layout Plugins + use "dstein64/nvim-scrollview" -- ScrollBars + use "akinsho/nvim-toggleterm.lua" use { "folke/zen-mode.nvim", config = function() require("zen-mode").setup {} end } use "rcarriga/nvim-notify" use "kyazdani42/nvim-web-devicons" @@ -43,7 +46,6 @@ return require("packer").startup( use "neovim/nvim-lspconfig" use "hrsh7th/nvim-cmp" use "hrsh7th/cmp-nvim-lsp" - use "hrsh7th/cmp-nvim-lua" use "hrsh7th/cmp-path" use "hrsh7th/cmp-calc" use "hrsh7th/cmp-buffer" @@ -52,20 +54,18 @@ return require("packer").startup( use "L3MON4D3/LuaSnip" use "saadparwaiz1/cmp_luasnip" use "williamboman/nvim-lsp-installer" - use "brymer-meneses/grammar-guard.nvim" use { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" } - -- Autoformat - use "lukas-reineke/lsp-format.nvim" - - -- General Popup Window - use "akinsho/nvim-toggleterm.lua" - - use "rktjmp/fwatch.nvim" - + use { + 'rmagatti/session-lens', + requires = { 'rmagatti/auto-session', 'nvim-telescope/telescope.nvim' }, + config = function() + require('session-lens').setup({ path_display = { 'shorten' } }) + end + } -- Database Feature use "tpope/vim-dadbod" use "kristijanhusak/vim-dadbod-ui" diff --git a/configs/nvim/lua/lua b/configs/nvim/lua/lua deleted file mode 120000 index 881bb51..0000000 --- a/configs/nvim/lua/lua +++ /dev/null @@ -1 +0,0 @@ -/home/max/.dotfiles/configs/lua \ No newline at end of file diff --git a/configs/nvim/lua/overlays.lua b/configs/nvim/lua/overlays.lua index f2d0ff9..09ad92e 100644 --- a/configs/nvim/lua/overlays.lua +++ b/configs/nvim/lua/overlays.lua @@ -1,82 +1,63 @@ local Terminal = require("toggleterm.terminal").Terminal -local u = require("utils") local lazygit = - Terminal:new( - { - cmd = "lazygit", - dir = "git_dir", - direction = "float", - float_opts = { - winblend = 0, - border = "shadow" - }, - on_open = function(term) - vim.cmd("startinsert!") - vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", {noremap = true, silent = true}) - end, - on_close = function(term) - Terminal:close() - end - } +Terminal:new( + { + cmd = "lazygit", + dir = "git_dir", + direction = "float", + float_opts = { + winblend = 0, + border = "shadow" + }, + on_open = function(term) + vim.cmd("startinsert!") + vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", { noremap = true, silent = true }) + end, + on_close = function() + Terminal:close() + end +} ) -function _lazygit_toggle() - lazygit:toggle() +function _Lazygit_toggle() + lazygit:toggle() end -vim.api.nvim_set_keymap("n", "", "lua _lazygit_toggle()", {noremap = true, silent = true}) +vim.api.nvim_set_keymap("n", "", "lua _Lazygit_toggle()", { noremap = true, silent = true }) local pnpm = - Terminal:new( - { - cmd = "pnpm dev", - dir = "git_dir", - size = 5, - direction = "vertical", - on_close = function(term) - Terminal:close() - end - } +Terminal:new( + { + cmd = "pnpm dev", + dir = "git_dir", + size = 5, + direction = "vertical", + on_close = function(term) + Terminal:close() + end +} ) -function _pnpm_toggle() - pnpm:toggle() +function _Pnpm_toggle() + pnpm:toggle() end -vim.api.nvim_set_keymap("n", "d", "lua _pnpm_toggle()", {noremap = true, silent = true}) - -local nvimConfig = - Terminal:new( - { - cmd = "cd $HOME/.dotfiles && nvim configs/init.lua && cd -", - direction = "float", - on_close = function() - Terminal:close() - u.ReloadConfig() - end - } -) - -function _nvimConfig_toggle() - nvimConfig:toggle() -end - -vim.api.nvim_set_keymap("n", "", "lua _nvimConfig_toggle()", {noremap = true, silent = true}) +vim.api.nvim_set_keymap("n", "d", "lua _Pnpm_toggle()", { noremap = true, silent = true }) local chtConfig = - Terminal:new( - { - cmd = "cht", - direction = "float" - } +Terminal:new( + { + cmd = "cht", + direction = "float" +} ) function _chtConfig_toggle() - chtConfig:toggle() + chtConfig:toggle() end -vim.api.nvim_set_keymap("n", "", "lua _chtConfig_toggle()", {noremap = true, silent = true}) +vim.api.nvim_set_keymap("n", "", "lua _chtConfig_toggle()", { noremap = true, silent = true }) require("toggleterm").setup { - shade_terminals = true + shade_terminals = true }