diff --git a/init.lua b/init.lua index ed50b69d7f3..01daf5f49f1 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.o.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.o.relativenumber = true +vim.o.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' @@ -198,10 +198,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -320,6 +320,8 @@ require('lazy').setup({ { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first { 'gr', group = 'LSP Actions', mode = { 'n' } }, + { 'g', group = '[G]it' }, + { 'n', group = '[N]otepad' }, }, }, }, @@ -401,6 +403,7 @@ require('lazy').setup({ -- Enable Telescope extensions if they are installed pcall(require('telescope').load_extension, 'fzf') + --TODO: need to install the telescope ui-select plugin? pcall(require('telescope').load_extension, 'ui-select') -- See `:help telescope.builtin` @@ -492,7 +495,12 @@ require('lazy').setup({ ---@module 'mason.settings' ---@type MasonSettings ---@diagnostic disable-next-line: missing-fields - opts = {}, + opts = { + registries = { + 'github:mason-org/mason-registry', + 'github:Crashdummyy/mason-registry', + }, + }, }, -- Maps LSP server names between nvim-lspconfig and Mason package names. 'mason-org/mason-lspconfig.nvim', @@ -600,9 +608,9 @@ require('lazy').setup({ -- See `:help lsp-config` for information about keys and how to configure ---@type table local servers = { - -- clangd = {}, + clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, -- rust_analyzer = {}, -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -611,6 +619,8 @@ require('lazy').setup({ -- But for many setups, the LSP (`ts_ls`) will work just fine -- ts_ls = {}, + omnisharp = {}, + stylua = {}, -- Used to format Lua code -- Special Lua Config, as recommended by neovim help docs @@ -653,6 +663,7 @@ require('lazy').setup({ local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { -- You can add other tools here that you want Mason to install + 'omnisharp', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -700,7 +711,9 @@ require('lazy').setup({ -- python = { "isort", "black" }, -- -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, + javascript = { 'prettierd', 'prettier', stop_after_first = true }, + typescript = { 'prettierd', 'prettier', stop_after_first = true }, + typescriptreact = { 'prettierd', 'prettier', stop_after_first = true }, }, }, }, @@ -724,6 +737,7 @@ require('lazy').setup({ dependencies = { -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: + -- TODO: look into friendly-snippets -- https://github.com/rafamadriz/friendly-snippets -- { -- 'rafamadriz/friendly-snippets', @@ -760,7 +774,7 @@ require('lazy').setup({ -- : Toggle signature help -- -- See :h blink-cmp-config-keymap for defining your own keymap - preset = 'default', + preset = 'super-tab', -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps @@ -791,13 +805,16 @@ require('lazy').setup({ -- the rust implementation via `'prefer_rust_with_warning'` -- -- See :h blink-cmp-config-fuzzy for more information - fuzzy = { implementation = 'lua' }, + fuzzy = { implementation = 'prefer_rust_with_warning' }, -- Shows a signature help window while you type arguments for a function signature = { enabled = true }, }, }, + -- THEMES + { 'catppuccin/nvim', name = 'catppuccin', priority = 1000 }, + { 'rose-pine/neovim', name = 'rose-pine', priority = 1000 }, { -- 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. @@ -816,7 +833,7 @@ require('lazy').setup({ -- 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' + vim.cmd.colorscheme 'rose-pine' end, }, @@ -831,42 +848,6 @@ require('lazy').setup({ opts = { signs = false }, }, - { -- Collection of various small independent plugins/modules - 'nvim-mini/mini.nvim', - config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [Q]uote - -- - ci' - [C]hange [I]nside [']quote - require('mini.ai').setup { n_lines = 500 } - - -- Add/delete/replace surroundings (brackets, quotes, etc.) - -- - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren - -- - sd' - [S]urround [D]elete [']quotes - -- - sr)' - [S]urround [R]eplace [)] ['] - require('mini.surround').setup() - - -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, - -- and try some other statusline plugin - local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } - - -- You can configure sections in the statusline by overriding their - -- default behavior. For example, here we set the section for - -- cursor location to LINE:COLUMN - ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() return '%2l:%-2v' end - - -- ... and there is more! - -- Check out: https://github.com/nvim-mini/mini.nvim - end, - }, - { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', lazy = false, @@ -910,9 +891,9 @@ require('lazy').setup({ -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.autopairs', -- require 'kickstart.plugins.neo-tree', -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommended keymaps @@ -920,7 +901,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! @@ -948,5 +929,11 @@ require('lazy').setup({ }, }) +-- FIX: godot-server: should check if the server is already running first... +local gdprojectfilepath = vim.fn.getcwd() .. '/project.godot' +local isInGdDirectory = vim.fn.filereadable(gdprojectfilepath) == 1 + +if isInGdDirectory then vim.fn.serverstart '127.0.0.1:55432' end + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/mini.lua b/lua/custom/plugins/mini.lua new file mode 100644 index 00000000000..d7f197caebe --- /dev/null +++ b/lua/custom/plugins/mini.lua @@ -0,0 +1,32 @@ +return { + 'nvim-mini/mini.nvim', + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + require('mini.surround').setup() + + require('mini.move').setup() + require('mini.git').setup() + + local statusline = require 'mini.statusline' + statusline.setup { use_icons = vim.g.have_nerd_font } + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() return '%2l:%-2v' end + + vim.keymap.set('n', 'ga', 'Git add -A', { desc = 'Git add all' }) + vim.keymap.set('n', 'gc', 'Git commit', { desc = 'Git commit' }) + vim.keymap.set('n', 'gs', 'Git stash', { desc = 'Git stash' }) + vim.keymap.set('n', 'gg', 'Git log --graph --oneline --all', { desc = 'Git graph' }) + end, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000000..66018eb682f --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,7 @@ +return { + 'stevearc/oil.nvim', + config = function() + require('oil').setup() + vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) + end, +} diff --git a/lua/custom/plugins/snacks.lua b/lua/custom/plugins/snacks.lua new file mode 100644 index 00000000000..8144c975650 --- /dev/null +++ b/lua/custom/plugins/snacks.lua @@ -0,0 +1,24 @@ +return { + 'folke/snacks.nvim', + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + --TODO: Use this for a bit and compare to mini dashboard + --TODO: design a style and featuers for my dashboard (add opening parent directory with Oil) + dashboard = { enabled = true }, + gitbrowse = { enabled = true }, + lazygit = { enabled = true }, + --TODO: determine a method for deleting scratches easily + scratch = { enabled = true }, + terminal = { enabled = true }, + }, + keys = { + { '=', function() Snacks.dashboard.open() end, desc = 'Dashboard' }, + { 'gb', function() Snacks.gitbrowse.open() end, desc = 'Open Git Repository in Browser' }, + { 'gl', function() Snacks.lazygit.open() end, desc = 'Open Lazy Git' }, + { 'no', function() Snacks.scratch() end, desc = 'Open Notepad' }, + { 'ns', function() Snacks.scratch.select() end, desc = 'Select Note' }, + { '', function() Snacks.terminal() end, desc = 'Open Terminal' }, + }, +} diff --git a/lua/custom/plugins/typescript-tools.lua b/lua/custom/plugins/typescript-tools.lua new file mode 100644 index 00000000000..ba7fb2046e7 --- /dev/null +++ b/lua/custom/plugins/typescript-tools.lua @@ -0,0 +1,5 @@ +return { + 'pmizio/typescript-tools.nvim', + dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' }, + opts = {}, +} diff --git a/lua/custom/plugins/vimtmuxnavigator.lua b/lua/custom/plugins/vimtmuxnavigator.lua new file mode 100644 index 00000000000..d4aaccb2af5 --- /dev/null +++ b/lua/custom/plugins/vimtmuxnavigator.lua @@ -0,0 +1,3 @@ +return { + 'christoomey/vim-tmux-navigator', +}