From f8596bb0c6b130074b0ded9f6e900ad7dee1ff4d Mon Sep 17 00:00:00 2001 From: Nikola Savic Date: Mon, 9 Sep 2024 14:13:06 +0200 Subject: [PATCH] v1.0 --- init.lua | 212 +++++++++------ lua/custom/plugins/alpha.lua | 24 ++ lua/custom/plugins/autocompletions.lua | 175 +++++++++++++ lua/custom/plugins/bufferline.lua | 70 +++++ lua/custom/plugins/colorscheme.lua | 71 ++++++ lua/custom/plugins/comments.lua | 10 + lua/custom/plugins/copilot.lua | 46 ++++ lua/custom/plugins/cyberdreams.lua | 5 + lua/custom/plugins/dressing.lua | 167 ++++++++++++ lua/custom/plugins/gitsigns.lua | 20 ++ lua/custom/plugins/indent-blankline.lua | 25 ++ lua/custom/plugins/lazygit.lua | 20 ++ lua/custom/plugins/lualine.lua | 72 ++++++ lua/custom/plugins/misc.lua | 67 +++++ lua/custom/plugins/neotree.lua | 326 ++++++++++++++++++++++++ lua/custom/plugins/toggleterm.lua | 21 ++ 16 files changed, 1252 insertions(+), 79 deletions(-) create mode 100644 lua/custom/plugins/alpha.lua create mode 100644 lua/custom/plugins/autocompletions.lua create mode 100644 lua/custom/plugins/bufferline.lua create mode 100644 lua/custom/plugins/colorscheme.lua create mode 100644 lua/custom/plugins/comments.lua create mode 100644 lua/custom/plugins/copilot.lua create mode 100644 lua/custom/plugins/cyberdreams.lua create mode 100644 lua/custom/plugins/dressing.lua create mode 100644 lua/custom/plugins/gitsigns.lua create mode 100644 lua/custom/plugins/indent-blankline.lua create mode 100644 lua/custom/plugins/lazygit.lua create mode 100644 lua/custom/plugins/lualine.lua create mode 100644 lua/custom/plugins/misc.lua create mode 100644 lua/custom/plugins/neotree.lua create mode 100644 lua/custom/plugins/toggleterm.lua diff --git a/init.lua b/init.lua index 13c8143d..e3616cbc 100644 --- a/init.lua +++ b/init.lua @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -160,12 +160,15 @@ vim.opt.scrolloff = 10 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` +-- For conciseness +local opts = { noremap = true, silent = true } + -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) +-- vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- for people to discover. Otherwise, you normally need to press , which @@ -190,6 +193,45 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- Keymaps to save, quit and old habbits +vim.keymap.set('n', 'w', 'w!', { desc = 'Save file' }) +-- save file without auto-formatting +vim.keymap.set('n', 'W', 'noautocmd w ', { desc = 'Save without formatting' }) +vim.keymap.set('n', 'q', 'q!', { desc = 'Close file' }) + +-- Keep last yanked when pasting +vim.keymap.set('v', 'p', '"_dP', opts) + +-- Vertical scroll and center +vim.keymap.set('n', '', 'zz', opts) +vim.keymap.set('n', '', 'zz', opts) + +-- Find and center +vim.keymap.set('n', 'n', 'nzzzv', opts) +vim.keymap.set('n', 'N', 'Nzzzv', opts) + +-- Window management +vim.keymap.set('n', 'v', 'v', opts) -- split window vertically +vim.keymap.set('n', 'h', 's', opts) -- split window horizontally +vim.keymap.set('n', 'se', '=', opts) -- make split windows equal width & height +vim.keymap.set('n', 'xs', ':close', opts) -- close current split window + +-- Navigate between splits +vim.keymap.set('n', '', ':wincmd k', opts) +vim.keymap.set('n', '', ':wincmd j', opts) +vim.keymap.set('n', '', ':wincmd h', opts) +vim.keymap.set('n', '', ':wincmd l', opts) + +-- Tabs +vim.keymap.set('n', 'to', ':tabnew', opts) -- open new tab +vim.keymap.set('n', 'tx', ':tabclose', opts) -- close current tab +vim.keymap.set('n', 'tn', ':tabn', opts) -- go to next tab +vim.keymap.set('n', 'tp', ':tabp', opts) -- go to previous tab + +-- Stay in indent mode +vim.keymap.set('v', '<', '', '>gv', opts) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -243,19 +285,19 @@ require('lazy').setup({ -- require('gitsigns').setup({ ... }) -- -- See `:help gitsigns` to understand what the configuration keys do - { -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - }, - }, - + -- { -- Adds git related signs to the gutter, as well as utilities for managing changes + -- 'lewis6991/gitsigns.nvim', + -- opts = { + -- signs = { + -- add = { text = '+' }, + -- change = { text = '~' }, + -- delete = { text = '_' }, + -- topdelete = { text = '‾' }, + -- changedelete = { text = '~' }, + -- }, + -- }, + -- }, + -- -- NOTE: Plugins can also be configured to run Lua code when they are loaded. -- -- This is often very useful to both group configuration, as well as handle @@ -317,8 +359,8 @@ require('lazy').setup({ { 'c', group = '[C]ode', mode = { 'n', 'x' } }, { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, - { 's', group = '[S]earch' }, - { 'w', group = '[W]orkspace' }, + { 'f', group = '[S]earch' }, + -- { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, @@ -401,19 +443,19 @@ require('lazy').setup({ -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' - vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) - vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set('n', 'fh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'fk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) + vim.keymap.set('n', 'ff', builtin.find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + vim.keymap.set('n', 'fc', builtin.grep_string, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', 'fw', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', 'f', builtin.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', 'fo', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) -- Slightly advanced example of overriding default behavior and theme - vim.keymap.set('n', '/', function() + vim.keymap.set('n', 's/', function() -- You can pass additional configuration to Telescope to change the theme, layout, etc. builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { winblend = 10, @@ -423,12 +465,12 @@ require('lazy').setup({ -- It's also possible to pass additional configuration options. -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set('n', 's/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[S]earch [/] in Open Files' }) + -- vim.keymap.set('n', 's/', function() + -- builtin.live_grep { + -- grep_open_files = true, + -- prompt_title = 'Live Grep in Open Files', + -- } + -- end, { desc = '[S]earch [/] in Open Files' }) -- Shortcut for searching your Neovim configuration files vim.keymap.set('n', 'sn', function() @@ -533,15 +575,15 @@ require('lazy').setup({ -- Fuzzy find all the symbols in your current workspace. -- Similar to document symbols, except searches over your entire project. - map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + -- map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') -- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. - map('rn', vim.lsp.buf.rename, '[R]e[n]ame') + map('ln', vim.lsp.buf.rename, '[R]e[n]ame') -- Execute a code action, usually your cursor needs to be on top of an error -- or a suggestion from your LSP for this to activate. - map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) + map('la', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) -- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header. @@ -580,11 +622,11 @@ require('lazy').setup({ -- code, if the language server you are using supports them -- -- This may be unwanted, since they displace some of your code - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then - map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) - end, '[T]oggle Inlay [H]ints') - end + -- if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then + -- map('th', function() + -- vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + -- end, '[T]oggle Inlay [H]ints') + -- end end, }) @@ -605,6 +647,18 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { + intelephense = { + settings = { + intelephense = { + diagnostics = { + undefinedProperties = false, + undefinedMethods = false, + undefinedTypes = false, + undefinedFunctions = false, + }, + }, + }, + }, -- clangd = {}, -- gopls = {}, -- pyright = {}, @@ -728,12 +782,12 @@ require('lazy').setup({ -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, }, }, 'saadparwaiz1/cmp_luasnip', @@ -824,23 +878,23 @@ require('lazy').setup({ end, }, - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is. - -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. - init = function() - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' - - -- You can configure highlights by doing something like: - vim.cmd.hi 'Comment gui=none' - end, - }, + -- { -- You can easily change to a different colorscheme. + -- -- Change the name of the colorscheme plugin below, and then + -- -- change the command in the config to whatever the name of that colorscheme is. + -- -- + -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. + -- 'folke/tokyonight.nvim', + -- priority = 1000, -- Make sure to load this before all the other start plugins. + -- init = function() + -- -- Load the colorscheme here. + -- -- Like many other themes, this one has different styles, and you could load + -- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. + -- vim.cmd.colorscheme 'tokyonight-night' + -- + -- -- You can configure highlights by doing something like: + -- vim.cmd.hi 'Comment gui=none' + -- end, + -- }, -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, @@ -888,7 +942,7 @@ require('lazy').setup({ main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'php', 'javascript' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -929,25 +983,25 @@ require('lazy').setup({ -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table icons = vim.g.have_nerd_font and {} or { - cmd = '⌘', - config = '🛠', - event = '📅', - ft = '📂', - init = '⚙', - keys = '🗝', - plugin = '🔌', - runtime = '💻', - require = '🌙', - source = '📄', - start = '🚀', - task = '📌', - lazy = '💤 ', + -- cmd = '⌘', + -- config = '🛠', + -- event = '📅', + -- ft = '📂', + -- init = '⚙', + -- keys = '🗝', + -- plugin = '🔌', + -- runtime = '💻', + -- require = '🌙', + -- source = '📄', + -- start = '🚀', + -- task = '📌', + -- lazy = '💤 ', }, }, }) diff --git a/lua/custom/plugins/alpha.lua b/lua/custom/plugins/alpha.lua new file mode 100644 index 00000000..e510a981 --- /dev/null +++ b/lua/custom/plugins/alpha.lua @@ -0,0 +1,24 @@ +return { + 'goolord/alpha-nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + + config = function() + local alpha = require 'alpha' + local dashboard = require 'alpha.themes.startify' + + dashboard.section.header.val = { + [[ ]], + [[ ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ]], + [[ ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ]], + [[ ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ]], + [[ ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ]], + [[ ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ]], + [[ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]], + [[ ]], + } + + alpha.setup(dashboard.opts) + end, +} diff --git a/lua/custom/plugins/autocompletions.lua b/lua/custom/plugins/autocompletions.lua new file mode 100644 index 00000000..db7ee777 --- /dev/null +++ b/lua/custom/plugins/autocompletions.lua @@ -0,0 +1,175 @@ +return { -- Autocompletion + 'hrsh7th/nvim-cmp', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + { + 'L3MON4D3/LuaSnip', + build = (function() + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then + return + end + return 'make install_jsregexp' + end)(), + dependencies = { + -- `friendly-snippets` contains a variety of premade snippets. + -- See the README about individual language/framework/plugin snippets: + -- https://github.com/rafamadriz/friendly-snippets + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, + }, + }, + 'saadparwaiz1/cmp_luasnip', + + -- Adds other completion capabilities. + -- nvim-cmp does not ship with all sources by default. They are split + -- into multiple repos for maintenance purposes. + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + }, + config = function() + -- See `:help cmp` + local cmp = require 'cmp' + local luasnip = require 'luasnip' + luasnip.config.setup {} + + local kind_icons = { + Text = '󰉿', + Method = 'm', + Function = '󰊕', + Constructor = '', + Field = '', + Variable = '󰆧', + Class = '󰌗', + Interface = '', + Module = '', + Property = '', + Unit = '', + Value = '󰎠', + Enum = '', + Keyword = '󰌋', + Snippet = '', + Color = '󰏘', + File = '󰈙', + Reference = '', + Folder = '󰉋', + EnumMember = '', + Constant = '󰇽', + Struct = '', + Event = '', + Operator = '󰆕', + TypeParameter = '󰊄', + } + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { completeopt = 'menu,menuone,noinsert' }, + + -- For an understanding of why these mappings were + -- chosen, you will need to read `:help ins-completion` + -- + -- No, but seriously. Please read `:help ins-completion`, it is really good! + mapping = cmp.mapping.preset.insert { + -- Select the [n]ext item + [''] = cmp.mapping.select_next_item(), + -- Select the [p]revious item + [''] = cmp.mapping.select_prev_item(), + + -- Scroll the documentation window [b]ack / [f]orward + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + + -- Accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + -- [''] = cmp.mapping.confirm { select = true }, + + -- If you prefer more traditional completion keymaps, + -- you can uncomment the following lines + [''] = cmp.mapping.confirm { select = true }, + -- [''] = cmp.mapping.select_next_item(), + -- [''] = cmp.mapping.select_prev_item(), + + -- Manually trigger a completion from nvim-cmp. + -- Generally you don't need this, because nvim-cmp will display + -- completions whenever it has completion options available. + [''] = cmp.mapping.complete {}, + + -- Think of as moving to the right of your snippet expansion. + -- So if you have a snippet that's like: + -- function $name($args) + -- $body + -- end + -- + -- will move you to the right of each of the expansion locations. + -- is similar, except moving you backwards. + [''] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { 'i', 's' }), + + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + -- Select next/previous item with Tab / Shift + Tab + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }, + sources = { + { + name = 'lazydev', + -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it + group_index = 0, + }, + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path' }, + }, + formatting = { + fields = { 'kind', 'abbr', 'menu' }, + format = function(entry, vim_item) + vim_item.kind = string.format('%s', kind_icons[vim_item.kind]) + vim_item.menu = ({ + nvim_lsp = '[LSP]', + luasnip = '[Snippet]', + buffer = '[Buffer]', + path = '[Path]', + })[entry.source.name] + return vim_item + end, + }, + } + end, +} diff --git a/lua/custom/plugins/bufferline.lua b/lua/custom/plugins/bufferline.lua new file mode 100644 index 00000000..2b09d869 --- /dev/null +++ b/lua/custom/plugins/bufferline.lua @@ -0,0 +1,70 @@ +return { + + 'akinsho/bufferline.nvim', + dependencies = { + 'moll/vim-bbye', + 'nvim-tree/nvim-web-devicons', + }, + config = function() + local opts = { noremap = true, silent = true } + + require('bufferline').setup { + + options = { + mode = 'buffers', -- set to "tabs" to only show tabpages instead + themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default + numbers = 'none', -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, + close_command = 'Bdelete! %d', -- can be a string | function, see "Mouse actions" + buffer_close_icon = '✗', + close_icon = '✗', + path_components = 1, -- Show only the file name without the directory + modified_icon = '●', + left_trunc_marker = '', + right_trunc_marker = '', + max_name_length = 30, + max_prefix_length = 30, -- prefix used when a buffer is de-duplicated + tab_size = 21, + diagnostics = false, + diagnostics_update_in_insert = false, + color_icons = true, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_close_icon = true, + persist_buffer_sort = true, -- whether or not custom sorted buffers should persist + separator_style = { '│', '│' }, -- | "thick" | "thin" | { 'any', 'any' }, + enforce_regular_tabs = true, + always_show_bufferline = true, + show_tab_indicators = false, + indicator = { + -- icon = '▎', -- this should be omitted if indicator style is not 'icon' + style = 'none', -- Options: 'icon', 'underline', 'none' + }, + icon_pinned = '󰐃', + minimum_padding = 1, + maximum_padding = 5, + maximum_length = 15, + sort_by = 'insert_at_end', + }, + highlights = { + separator = { + fg = '#434C5E', + }, + buffer_selected = { + bold = true, + italic = false, + }, + -- separator_selected = {}, + -- tab_selected = {}, + -- background = {}, + -- indicator_selected = {}, + -- fill = {}, + }, + } + + -- Buffers + vim.keymap.set('n', '', ':bnext', opts) + vim.keymap.set('n', '', ':bprevious', opts) + vim.keymap.set('n', 'x', ':Bdelete!', opts) -- close buffer + vim.keymap.set('n', 'b', ' enew ', opts) -- new buffer + end, +} diff --git a/lua/custom/plugins/colorscheme.lua b/lua/custom/plugins/colorscheme.lua new file mode 100644 index 00000000..6ce58e31 --- /dev/null +++ b/lua/custom/plugins/colorscheme.lua @@ -0,0 +1,71 @@ +return { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + require('catppuccin').setup { + flavour = 'auto', -- latte, frappe, macchiato, mocha + background = { -- :h background + light = 'latte', + dark = 'mocha', + }, + transparent_background = true, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = false, -- dims the background color of inactive window + shade = 'dark', + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { 'italic' }, -- Change the style of comments + conditionals = { 'italic' }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + -- miscs = {}, -- Uncomment to turn off hard-coded styles + }, + color_overrides = {}, + custom_highlights = {}, + default_integrations = true, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = false, + mini = { + enabled = true, + indentscope_color = '', + }, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, + } + -- -- Toggle background transparency + local bg_transparent = true + -- + local toggle_transparency = function() + bg_transparent = not bg_transparent + -- vim.g.transparent_background = bg_transparent + require('catppuccin').setup { + transparent_background = bg_transparent, + } + vim.cmd [[colorscheme catppuccin]] + end + + vim.keymap.set('n', 'bg', toggle_transparency, { noremap = true, silent = true }) + + -- setup must be called before loading + vim.cmd.colorscheme 'catppuccin' + end, +} diff --git a/lua/custom/plugins/comments.lua b/lua/custom/plugins/comments.lua new file mode 100644 index 00000000..3de99b9e --- /dev/null +++ b/lua/custom/plugins/comments.lua @@ -0,0 +1,10 @@ +-- Easily comment visual regions/lines +return { + 'numToStr/Comment.nvim', + opts = {}, + config = function() + local opts = { noremap = true, silent = true } + vim.keymap.set('n', '/', require('Comment.api').toggle.linewise.current, opts) + vim.keymap.set('v', '/', "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", opts) + end, +} diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000..9f6d759c --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,46 @@ +return { + { + 'CopilotC-Nvim/CopilotChat.nvim', + branch = 'canary', + dependencies = { + { 'zbirenbaum/copilot.lua' }, -- or github/copilot.vim + { 'nvim-lua/plenary.nvim' }, -- for curl, log wrapper + }, + build = 'make tiktoken', -- Only on MacOS or Linux + keys = { + { + 'ccq', + function() + local input = vim.fn.input 'Quick Chat: ' + if input ~= '' then + require('CopilotChat').ask(input, { selection = require('CopilotChat.select').buffer }) + end + end, + desc = 'CopilotChat Buffer chat', + }, + { + 'cct', + 'CopilotChatToggle', + desc = 'Copilot Chat Toggle', + }, + -- { + -- 'ccs', + -- 'CopilotChatSave', + -- desc = 'CopilotChat - Quick chat', + -- }, + }, + opts = { + debug = false, -- Enable debug logging + window = { + layout = 'float', + relative = 'editor', + title = 'Copilot', + footer = ' to toggle chat | to clean chat', + width = 0.6, + height = 0.5, + row = 0, + border = 'rounded', -- 'none', single', 'double', 'rounded', 'solid', 'shadow' + }, + }, + }, +} diff --git a/lua/custom/plugins/cyberdreams.lua b/lua/custom/plugins/cyberdreams.lua new file mode 100644 index 00000000..e8a522fb --- /dev/null +++ b/lua/custom/plugins/cyberdreams.lua @@ -0,0 +1,5 @@ +return { + 'scottmckendry/cyberdream.nvim', + lazy = false, + -- priority = 1000, +} diff --git a/lua/custom/plugins/dressing.lua b/lua/custom/plugins/dressing.lua new file mode 100644 index 00000000..a339fc7f --- /dev/null +++ b/lua/custom/plugins/dressing.lua @@ -0,0 +1,167 @@ +return { + 'stevearc/dressing.nvim', + opts = { + -- require('dressing').setup { + input = { + -- Set to false to disable the vim.ui.input implementation + enabled = true, + + -- Default prompt string + default_prompt = 'Input', + + -- Trim trailing `:` from prompt + trim_prompt = true, + + -- Can be 'left', 'right', or 'center' + title_pos = 'left', + + -- When true, input will start in insert mode. + start_in_insert = true, + + -- These are passed to nvim_open_win + border = 'rounded', + -- 'editor' and 'win' will default to being centered + relative = 'cursor', + + -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + prefer_width = 40, + width = nil, + -- min_width and max_width can be a list of mixed types. + -- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total" + max_width = { 140, 0.9 }, + min_width = { 20, 0.2 }, + + buf_options = {}, + win_options = { + -- Disable line wrapping + wrap = false, + -- Indicator for when text exceeds window + list = true, + listchars = 'precedes:…,extends:…', + -- Increase this for more context when text scrolls off the window + sidescrolloff = 0, + }, + + -- Set to `false` to disable + mappings = { + n = { + [''] = 'Close', + [''] = 'Confirm', + }, + i = { + [''] = 'Close', + [''] = 'Confirm', + [''] = 'HistoryPrev', + [''] = 'HistoryNext', + }, + }, + + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + + -- see :help dressing_get_config + get_config = nil, + }, + select = { + -- Set to false to disable the vim.ui.select implementation + enabled = true, + + -- Priority list of preferred vim.select implementations + backend = { 'telescope', 'fzf_lua', 'fzf', 'builtin', 'nui' }, + + -- Trim trailing `:` from prompt + trim_prompt = true, + + -- Options for telescope selector + -- These are passed into the telescope picker directly. Can be used like: + -- telescope = require('telescope.themes').get_ivy({...}) + telescope = nil, + + -- Options for fzf selector + fzf = { + window = { + width = 0.5, + height = 0.4, + }, + }, + + -- Options for fzf-lua + fzf_lua = { + -- winopts = { + -- height = 0.5, + -- width = 0.5, + -- }, + }, + + -- Options for nui Menu + nui = { + position = '50%', + size = nil, + relative = 'editor', + border = { + style = 'rounded', + }, + buf_options = { + swapfile = false, + filetype = 'DressingSelect', + }, + win_options = { + winblend = 0, + }, + max_width = 80, + max_height = 40, + min_width = 40, + min_height = 10, + }, + + -- Options for built-in selector + builtin = { + -- Display numbers for options and set up keymaps + show_numbers = true, + -- These are passed to nvim_open_win + border = 'rounded', + -- 'editor' and 'win' will default to being centered + relative = 'editor', + + buf_options = {}, + win_options = { + cursorline = true, + cursorlineopt = 'both', + }, + + -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- the min_ and max_ options can be a list of mixed types. + -- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total" + width = nil, + max_width = { 140, 0.8 }, + min_width = { 40, 0.2 }, + height = nil, + max_height = 0.9, + min_height = { 10, 0.2 }, + + -- Set to `false` to disable + mappings = { + [''] = 'Close', + [''] = 'Close', + [''] = 'Confirm', + }, + + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + }, + + -- Used to override format_item. See :help dressing-format + format_item_override = {}, + + -- see :help dressing_get_config + get_config = nil, + }, + }, + -- }, +} diff --git a/lua/custom/plugins/gitsigns.lua b/lua/custom/plugins/gitsigns.lua new file mode 100644 index 00000000..a56976be --- /dev/null +++ b/lua/custom/plugins/gitsigns.lua @@ -0,0 +1,20 @@ +-- Adds git related signs to the gutter, as well as utilities for managing changes +return { + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + signs_staged = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, +} diff --git a/lua/custom/plugins/indent-blankline.lua b/lua/custom/plugins/indent-blankline.lua new file mode 100644 index 00000000..27e44089 --- /dev/null +++ b/lua/custom/plugins/indent-blankline.lua @@ -0,0 +1,25 @@ +return { + 'lukas-reineke/indent-blankline.nvim', + main = 'ibl', + opts = { + indent = { + char = '▏', + }, + scope = { + show_start = false, + show_end = false, + show_exact_scope = false, + }, + exclude = { + filetypes = { + 'help', + 'startify', + 'dashboard', + 'packer', + 'neogitstatus', + 'NvimTree', + 'Trouble', + }, + }, + }, +} diff --git a/lua/custom/plugins/lazygit.lua b/lua/custom/plugins/lazygit.lua new file mode 100644 index 00000000..50baa021 --- /dev/null +++ b/lua/custom/plugins/lazygit.lua @@ -0,0 +1,20 @@ +-- nvim v0.8.0 +return { + 'kdheepak/lazygit.nvim', + cmd = { + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', + }, + -- optional for floating window border decoration + dependencies = { + 'nvim-lua/plenary.nvim', + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { 'tg', 'LazyGit', desc = 'LazyGit' }, + }, +} diff --git a/lua/custom/plugins/lualine.lua b/lua/custom/plugins/lualine.lua new file mode 100644 index 00000000..e47ca8ad --- /dev/null +++ b/lua/custom/plugins/lualine.lua @@ -0,0 +1,72 @@ +return { + 'nvim-lualine/lualine.nvim', + config = function() + local mode = { + 'mode', + fmt = function(str) + return ' ' .. str + -- return ' ' .. str:sub(1, 1) -- displays only the first character of the mode + end, + } + + local filename = { + 'filename', + file_status = true, -- displays file status (readonly status, modified status) + path = 0, -- 0 = just filename, 1 = relative path, 2 = absolute path + } + + local hide_in_width = function() + return vim.fn.winwidth(0) > 100 + end + + local diagnostics = { + 'diagnostics', + sources = { 'nvim_diagnostic' }, + sections = { 'error', 'warn' }, + symbols = { error = ' ', warn = ' ', info = ' ', hint = ' ' }, + colored = false, + update_in_insert = false, + always_visible = false, + cond = hide_in_width, + } + + local diff = { + 'diff', + colored = false, + symbols = { added = ' ', modified = ' ', removed = ' ' }, -- changes diff symbols + cond = hide_in_width, + } + + require('lualine').setup { + options = { + icons_enabled = true, + theme = 'catppuccin', -- Set theme based on environment variable + -- Some useful glyphs: + -- https://www.nerdfonts.com/cheat-sheet + --         + section_separators = { left = '', right = '' }, + component_separators = { left = '', right = '' }, + disabled_filetypes = { 'neo-tree' }, + always_divide_middle = true, + }, + sections = { + lualine_a = { mode }, + lualine_b = { 'branch' }, + lualine_c = { filename }, + lualine_x = { diagnostics, diff, { 'encoding', cond = hide_in_width }, { 'filetype', cond = hide_in_width } }, + lualine_y = { 'location' }, + lualine_z = { 'progress' }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { { 'filename', path = 1 } }, + lualine_x = { { 'location', padding = 0 } }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + extensions = { 'lazy', 'toggleterm', 'mason', 'neo-tree', 'trouble' }, + } + end, +} diff --git a/lua/custom/plugins/misc.lua b/lua/custom/plugins/misc.lua new file mode 100644 index 00000000..d98ac3bd --- /dev/null +++ b/lua/custom/plugins/misc.lua @@ -0,0 +1,67 @@ +return { + { + -- smooth scroll + 'declancm/cinnamon.nvim', + version = '*', -- use latest release + opts = { + -- change default options here + }, + }, + { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = true, + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function + }, + { + -- sessions + 'folke/persistence.nvim', + event = 'BufReadPre', -- this will only start session saving when an actual file was opened + opts = { + -- load the session for the current directory + vim.keymap.set('n', 'Ss', function() + require('persistence').load() + end, { desc = 'Load session from directory' }), + + -- select a session to load + vim.keymap.set('n', 'SS', function() + require('persistence').select() + end, { desc = 'Select a sesion to load' }), + + -- load the last session + vim.keymap.set('n', 'Sl', function() + require('persistence').load { last = true } + end, { desc = 'Load the last session' }), + + -- stop Persistence => session won't be saved on exit + vim.keymap.set('n', 'Sd', function() + require('persistence').stop() + end, { desc = 'Stop Saving sessions' }), + -- add any custom options here + }, + }, + { + 'karb94/neoscroll.nvim', + config = function() + require('neoscroll').setup {} + end, + }, + { + 'christoomey/vim-tmux-navigator', + cmd = { + 'TmuxNavigateLeft', + 'TmuxNavigateDown', + 'TmuxNavigateUp', + 'TmuxNavigateRight', + 'TmuxNavigatePrevious', + }, + keys = { + { '', 'TmuxNavigateLeft' }, + { '', 'TmuxNavigateDown' }, + { '', 'TmuxNavigateUp' }, + { '', 'TmuxNavigateRight' }, + { '', 'TmuxNavigatePrevious' }, + }, + }, +} diff --git a/lua/custom/plugins/neotree.lua b/lua/custom/plugins/neotree.lua new file mode 100644 index 00000000..8bef2a1e --- /dev/null +++ b/lua/custom/plugins/neotree.lua @@ -0,0 +1,326 @@ +return { + { + 'nvim-neo-tree/neo-tree.nvim', + branch = 'v3.x', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + 'MunifTanjim/nui.nvim', + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + { + 's1n7ax/nvim-window-picker', + version = '2.*', + config = function() + require('window-picker').setup { + filter_rules = { + include_current_win = false, + autoselect_one = true, + -- filter using buffer options + bo = { + -- if the file type is one of following, the window will be ignored + filetype = { 'neo-tree', 'neo-tree-popup', 'notify' }, + -- if the buffer type is one of following, the window will be ignored + buftype = { 'terminal', 'quickfix' }, + }, + }, + } + end, + }, + }, + config = function() + -- If you want icons for diagnostic errors, you'll need to define them somewhere: + vim.fn.sign_define('DiagnosticSignError', { text = ' ', texthl = 'DiagnosticSignError' }) + vim.fn.sign_define('DiagnosticSignWarn', { text = ' ', texthl = 'DiagnosticSignWarn' }) + vim.fn.sign_define('DiagnosticSignInfo', { text = ' ', texthl = 'DiagnosticSignInfo' }) + vim.fn.sign_define('DiagnosticSignHint', { text = '󰌵', texthl = 'DiagnosticSignHint' }) + + require('neo-tree').setup { + close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab + popup_border_style = 'rounded', + enable_git_status = true, + enable_diagnostics = true, + open_files_do_not_replace_types = { 'terminal', 'trouble', 'qf' }, -- when opening files, do not use windows containing these filetypes or buftypes + sort_case_insensitive = false, -- used when sorting files and directories in the tree + sort_function = nil, -- use a custom function for sorting files and directories in the tree + -- sort_function = function (a,b) + -- if a.type == b.type then + -- return a.path > b.path + -- else + -- return a.type > b.type + -- end + -- end , -- this sorts files and directories descendantly + default_component_configs = { + container = { + enable_character_fade = true, + }, + indent = { + indent_size = 2, + padding = 1, -- extra padding on left hand side + -- indent guides + with_markers = true, + indent_marker = '│', + last_indent_marker = '└', + highlight = 'NeoTreeIndentMarker', + -- expander config, needed for nesting files + with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = '', + expander_expanded = '', + expander_highlight = 'NeoTreeExpander', + }, + icon = { + folder_closed = '', + folder_open = '', + folder_empty = '󰜌', + provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available + if node.type == 'file' or node.type == 'terminal' then + local success, web_devicons = pcall(require, 'nvim-web-devicons') + local name = node.type == 'terminal' and 'terminal' or node.name + if success then + local devicon, hl = web_devicons.get_icon(name) + icon.text = devicon or icon.text + icon.highlight = hl or icon.highlight + end + end + end, + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = '*', + highlight = 'NeoTreeFileIcon', + }, + modified = { + symbol = '[+]', + highlight = 'NeoTreeModified', + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = 'NeoTreeFileName', + }, + git_status = { + symbols = { + -- Change type + added = '', -- or "✚", but this is redundant info if you use git_status_colors on the name + modified = '', -- or "", but this is redundant info if you use git_status_colors on the name + deleted = '✖', -- this can only be used in the git_status source + renamed = '󰁕', -- this can only be used in the git_status source + -- Status type + untracked = '', + ignored = '', + unstaged = '󰄱', + staged = '', + conflict = '', + }, + }, + -- If you don't want to use these columns, you can set `enabled = false` for each of them individually + file_size = { + enabled = true, + required_width = 64, -- min width of window required to show this column + }, + type = { + enabled = true, + required_width = 122, -- min width of window required to show this column + }, + last_modified = { + enabled = true, + required_width = 88, -- min width of window required to show this column + }, + created = { + enabled = true, + required_width = 110, -- min width of window required to show this column + }, + symlink_target = { + enabled = false, + }, + }, + -- A list of functions, each representing a global custom command + -- that will be available in all sources (if not overridden in `opts[source_name].commands`) + -- see `:h neo-tree-custom-commands-global` + commands = {}, + window = { + position = 'right', + width = 40, + mapping_options = { + noremap = true, + nowait = true, + }, + mappings = { + [''] = { + 'toggle_node', + nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use + }, + ['<2-LeftMouse>'] = 'open', + [''] = 'open', + [''] = 'cancel', -- close preview or floating neo-tree window + ['P'] = { 'toggle_preview', config = { use_float = true, use_image_nvim = true } }, + -- Read `# Preview Mode` for more information + ['l'] = 'focus_preview', + ['S'] = 'open_split', + ['s'] = 'open_vsplit', + -- ["S"] = "split_with_window_picker", + -- ["s"] = "vsplit_with_window_picker", + ['t'] = 'open_tabnew', + -- [""] = "open_drop", + -- ["t"] = "open_tab_drop", + ['w'] = 'open_with_window_picker', + --["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing + ['C'] = 'close_node', + -- ['C'] = 'close_all_subnodes', + ['z'] = 'close_all_nodes', + --["Z"] = "expand_all_nodes", + ['a'] = { + 'add', + -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details + -- some commands may take optional config options, see `:h neo-tree-mappings` for details + config = { + show_path = 'none', -- "none", "relative", "absolute" + }, + }, + ['A'] = 'add_directory', -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. + ['d'] = 'delete', + ['r'] = 'rename', + ['y'] = 'copy_to_clipboard', + ['x'] = 'cut_to_clipboard', + ['p'] = 'paste_from_clipboard', + ['c'] = 'copy', -- takes text input for destination, also accepts the optional config.show_path option like "add": + -- ["c"] = { + -- "copy", + -- config = { + -- show_path = "none" -- "none", "relative", "absolute" + -- } + --} + ['m'] = 'move', -- takes text input for destination, also accepts the optional config.show_path option like "add". + ['q'] = 'close_window', + ['R'] = 'refresh', + ['?'] = 'show_help', + ['<'] = 'prev_source', + ['>'] = 'next_source', + ['i'] = 'show_file_details', + }, + }, + nesting_rules = {}, + filesystem = { + filtered_items = { + visible = false, -- when true, they will just be displayed differently than normal items + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + --"node_modules" + }, + hide_by_pattern = { -- uses glob style patterns + --"*.meta", + --"*/src/*/tsconfig.json", + }, + always_show = { -- remains visible even if other settings would normally hide it + --".gitignored", + }, + always_show_by_pattern = { -- uses glob style patterns + --".env*", + }, + never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show + --".DS_Store", + --"thumbs.db" + }, + never_show_by_pattern = { -- uses glob style patterns + --".null-ls_*", + }, + }, + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = false, -- when true, empty folders will be grouped together + hijack_netrw_behavior = 'open_default', -- netrw disabled, opening a directory opens neo-tree + -- in whatever position is specified in window.position + -- "open_current", -- netrw disabled, opening a directory opens within the + -- window like netrw would, regardless of window.position + -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs + use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes + -- instead of relying on nvim autocmd events. + window = { + mappings = { + [''] = 'navigate_up', + ['.'] = 'set_root', + ['H'] = 'toggle_hidden', + ['/'] = 'fuzzy_finder', + ['D'] = 'fuzzy_finder_directory', + ['#'] = 'fuzzy_sorter', -- fuzzy sorting using the fzy algorithm + -- ["D"] = "fuzzy_sorter_directory", + ['f'] = 'filter_on_submit', + [''] = 'clear_filter', + ['[g'] = 'prev_git_modified', + [']g'] = 'next_git_modified', + ['o'] = { 'show_help', nowait = false, config = { title = 'Order by', prefix_key = 'o' } }, + ['oc'] = { 'order_by_created', nowait = false }, + ['od'] = { 'order_by_diagnostics', nowait = false }, + ['og'] = { 'order_by_git_status', nowait = false }, + ['om'] = { 'order_by_modified', nowait = false }, + ['on'] = { 'order_by_name', nowait = false }, + ['os'] = { 'order_by_size', nowait = false }, + ['ot'] = { 'order_by_type', nowait = false }, + -- [''] = function(state) ... end, + }, + fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode + [''] = 'move_cursor_down', + [''] = 'move_cursor_down', + [''] = 'move_cursor_up', + [''] = 'move_cursor_up', + -- [''] = function(state, scroll_padding) ... end, + }, + }, + + commands = {}, -- Add a custom command or override a global one using the same function name + }, + buffers = { + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = true, -- when true, empty folders will be grouped together + show_unloaded = true, + window = { + mappings = { + ['bd'] = 'buffer_delete', + [''] = 'navigate_up', + ['.'] = 'set_root', + ['o'] = { 'show_help', nowait = false, config = { title = 'Order by', prefix_key = 'o' } }, + ['oc'] = { 'order_by_created', nowait = false }, + ['od'] = { 'order_by_diagnostics', nowait = false }, + ['om'] = { 'order_by_modified', nowait = false }, + ['on'] = { 'order_by_name', nowait = false }, + ['os'] = { 'order_by_size', nowait = false }, + ['ot'] = { 'order_by_type', nowait = false }, + }, + }, + }, + git_status = { + window = { + position = 'float', + mappings = { + ['A'] = 'git_add_all', + ['gu'] = 'git_unstage_file', + ['ga'] = 'git_add_file', + ['gr'] = 'git_revert_file', + ['gc'] = 'git_commit', + ['gp'] = 'git_push', + ['gg'] = 'git_commit_and_push', + ['o'] = { 'show_help', nowait = false, config = { title = 'Order by', prefix_key = 'o' } }, + ['oc'] = { 'order_by_created', nowait = false }, + ['od'] = { 'order_by_diagnostics', nowait = false }, + ['om'] = { 'order_by_modified', nowait = false }, + ['on'] = { 'order_by_name', nowait = false }, + ['os'] = { 'order_by_size', nowait = false }, + ['ot'] = { 'order_by_type', nowait = false }, + }, + }, + }, + } + + vim.cmd [[nnoremap \ :Neotree reveal]] + vim.keymap.set('n', 'e', ':Neotree toggle position=right', { noremap = true, silent = true }) -- focus file explorer + vim.keymap.set('n', 'ngs', ':Neotree float git_status', { noremap = true, silent = true }) -- open git status window + end, + }, +} diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua new file mode 100644 index 00000000..e4d4281e --- /dev/null +++ b/lua/custom/plugins/toggleterm.lua @@ -0,0 +1,21 @@ +return { + 'akinsho/toggleterm.nvim', + version = '*', + keys = { + { + 'tf', + 'ToggleTerm direction=float', + desc = 'Toggle Float Terminal', + }, + -- { + -- 'tv', + -- 'ToggleTerm direction=vertical', + -- desc = 'Toggle Vertcal Terminal', + -- }, + -- { + -- 'th', + -- 'ToggleTerm direction=horizontal', + -- desc = 'Toggle Horizontal Terminal', + -- }, + }, +}