diff --git a/init.lua b/init.lua index 776c6873ff6..e34a5ea4970 100644 --- a/init.lua +++ b/init.lua @@ -83,6 +83,10 @@ I hope you enjoy your Neovim journey, P.S. You can delete this when you're done too. It's your config now! :) --]] +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = false -- Set as the leader key -- See `:help mapleader` @@ -91,18 +95,19 @@ 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.opt` -- NOTE: You can change these options as you wish! -- For more options, you can see `:help option-list` +vim.o.termguicolors = true -- Make line numbers default 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' @@ -164,6 +169,11 @@ vim.opt.confirm = true -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` +-- OIL NVIM +vim.keymap.set('n', 'e', 'Oil', { desc = 'Open file explorer' }) + +vim.keymap.set('n', '-', 'Oil', { desc = 'Open file explorer' }) + -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') @@ -179,11 +189,14 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn -- or just use to exit terminal mode vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) +vim.keymap.set('n', '[c', function() + require('treesitter-context').go_to_context(vim.v.count1) +end, { silent = true, desc = 'Jump to top of current function' }) -- 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 @@ -664,7 +677,13 @@ require('lazy').setup({ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { -- clangd = {}, - -- gopls = {}, + gopls = { + settings = { + format = { + indent = 'tab', + }, + }, + }, -- pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs @@ -673,7 +692,15 @@ require('lazy').setup({ -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, + ts_ls = { + settings = { + format = { + convertTabsToSpaces = false, -- Use tabs instead of spaces + tabSize = 4, -- Width of a tab character + indentSize = 4, + }, + }, + }, -- lua_ls = { @@ -713,7 +740,7 @@ require('lazy').setup({ require('mason-lspconfig').setup { ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) - automatic_installation = false, + automatic_installation = true, handlers = { function(server_name) local server = servers[server_name] or {} @@ -828,6 +855,11 @@ require('lazy').setup({ -- -- See :h blink-cmp-config-keymap for defining your own keymap preset = 'default', + [''] = { 'show', 'show_documentation', 'hide_documentation' }, + + [''] = { 'accept', 'fallback' }, + [''] = { 'select_next', 'fallback' }, + [''] = { 'select_prev', 'fallback' }, -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps @@ -842,12 +874,18 @@ require('lazy').setup({ completion = { -- By default, you may press `` to show the documentation. -- Optionally, set `auto_show = true` to show the documentation after a delay. - documentation = { auto_show = false, auto_show_delay_ms = 500 }, + documentation = { auto_show = true, auto_show_delay_ms = 500 }, }, sources = { - default = { 'lsp', 'path', 'snippets', 'lazydev' }, + default = { 'lsp', 'path', 'snippets', 'lazydev', 'copilot' }, providers = { + copilot = { + name = 'copilot', + module = 'blink-cmp-copilot', + score_offset = 100, + async = true, + }, lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, }, }, @@ -865,30 +903,34 @@ require('lazy').setup({ -- Shows a signature help window while you type arguments for a function signature = { enabled = true }, + + cmdline = { + enabled = false, + }, }, }, - { -- 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. - config = function() - ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { - styles = { - comments = { italic = false }, -- Disable italics in comments - }, - } - - -- 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' - 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. + -- config = function() + -- ---@diagnostic disable-next-line: missing-fields + -- require('tokyonight').setup { + -- styles = { + -- comments = { italic = false }, -- Disable italics in comments + -- }, + -- } + -- + -- -- 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' + -- end, + -- }, -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, @@ -965,18 +1007,18 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- 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.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- 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' }, + require 'custom.plugins.init', -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! @@ -1004,5 +1046,6 @@ require('lazy').setup({ }, }) +vim.api.nvim_set_hl(0, 'BlinkCmpKindCopilot', { fg = '#6CC644' }) -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/plugins/blink-compat.lua b/lua/custom/plugins/blink-compat.lua new file mode 100644 index 00000000000..2115f9c8e5e --- /dev/null +++ b/lua/custom/plugins/blink-compat.lua @@ -0,0 +1,8 @@ +return { + { + 'saghen/blink.compat', + version = '*', + lazy = true, + opts = {}, + }, +} diff --git a/lua/custom/plugins/copilot-cmp.lua b/lua/custom/plugins/copilot-cmp.lua new file mode 100644 index 00000000000..4d8572c26a8 --- /dev/null +++ b/lua/custom/plugins/copilot-cmp.lua @@ -0,0 +1,3 @@ +return { + 'giuxtaposition/blink-cmp-copilot', +} diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000000..9353ea2d85c --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,23 @@ +return { + 'zbirenbaum/copilot.lua', + requires = { + 'giuxtaposition/blink-cmp-copilot', + init = function() + vim.g.copilot_nes_debounce = 500 + end, + }, + cmd = 'Copilot', + event = 'InsertEnter', + config = function() + require('copilot').setup { + -- nes = { + -- enabled = true, + -- keymap = { + -- accept_and_goto = 'p', + -- accept = false, + -- dismiss = '', + -- }, + -- }, + } + end, +} diff --git a/lua/custom/plugins/crates.lua b/lua/custom/plugins/crates.lua new file mode 100644 index 00000000000..763d19deadb --- /dev/null +++ b/lua/custom/plugins/crates.lua @@ -0,0 +1,7 @@ +return { + 'saecki/crates.nvim', + tag = 'stable', + config = function() + require('crates').setup() + end, +} diff --git a/lua/custom/plugins/hardtime.lua b/lua/custom/plugins/hardtime.lua new file mode 100644 index 00000000000..028e83b9c50 --- /dev/null +++ b/lua/custom/plugins/hardtime.lua @@ -0,0 +1,6 @@ +return { + -- 'm4xshen/hardtime.nvim', + -- lazy = false, + -- dependencies = { 'MunifTanjim/nui.nvim' }, + -- opts = {}, +} diff --git a/lua/custom/plugins/leap.lua b/lua/custom/plugins/leap.lua new file mode 100644 index 00000000000..c50137fc1b5 --- /dev/null +++ b/lua/custom/plugins/leap.lua @@ -0,0 +1,10 @@ +return { + 'ggandor/leap.nvim', + init = function() + require('leap').add_default_mappings() + end, + dependencies = { + 'tpope/vim-repeat', + }, + lazy = false, +} diff --git a/lua/custom/plugins/markview.lua b/lua/custom/plugins/markview.lua new file mode 100644 index 00000000000..7c7040f5ade --- /dev/null +++ b/lua/custom/plugins/markview.lua @@ -0,0 +1,7 @@ +return { + 'OXY2DEV/markview.nvim', + lazy = false, + + -- Completion for `blink.cmp` + dependencies = { 'saghen/blink.cmp' }, +} diff --git a/lua/custom/plugins/mason-nvim-dap.lua b/lua/custom/plugins/mason-nvim-dap.lua new file mode 100644 index 00000000000..b575e2b7328 --- /dev/null +++ b/lua/custom/plugins/mason-nvim-dap.lua @@ -0,0 +1,14 @@ +return { + 'jay-babu/mason-nvim-dap.nvim', + dependencies = { + 'williamboman/mason.nvim', + 'mfussenegger/nvim-dap', + }, + config = function() + require('mason-nvim-dap').setup { + ensure_installed = { 'codelldb' }, + automatic_installation = true, + handlers = {}, + } + end, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000000..a23c0029b5b --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,10 @@ +return { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { 'nvim-tree/nvim-web-devicons' }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, +} diff --git a/lua/custom/plugins/snipe.lua b/lua/custom/plugins/snipe.lua new file mode 100644 index 00000000000..ae35a8e93fe --- /dev/null +++ b/lua/custom/plugins/snipe.lua @@ -0,0 +1,17 @@ +return { + 'leath-dub/snipe.nvim', + keys = { + { + 'gb', + function() + require('snipe').open_buffer_menu() + end, + desc = 'Open Snipe buffer menu', + }, + }, + opts = { + ui = { + position = 'center', + }, + }, +} diff --git a/lua/custom/plugins/store.lua b/lua/custom/plugins/store.lua new file mode 100644 index 00000000000..cd92f5e31f6 --- /dev/null +++ b/lua/custom/plugins/store.lua @@ -0,0 +1,6 @@ +return { + 'alex-popov-tech/store.nvim', + dependencies = { 'OXY2DEV/markview.nvim' }, + opts = {}, + cmd = 'Store', +} diff --git a/lua/custom/plugins/tscontext.lua b/lua/custom/plugins/tscontext.lua new file mode 100644 index 00000000000..b4b6ecbce6a --- /dev/null +++ b/lua/custom/plugins/tscontext.lua @@ -0,0 +1,5 @@ +return { + 'nvim-treesitter/nvim-treesitter-context', + opts = { mode = 'cursor', max_lines = 3 }, + dependencies = { 'nvim-treesitter/nvim-treesitter' }, +} diff --git a/lua/custom/plugins/typst.lua b/lua/custom/plugins/typst.lua new file mode 100644 index 00000000000..6f65f736acc --- /dev/null +++ b/lua/custom/plugins/typst.lua @@ -0,0 +1,6 @@ +return { + 'chomosuke/typst-preview.nvim', + lazy = false, -- or ft = 'typst' + version = '1.*', + opts = {}, -- lazy.nvim will implicitly calls `setup {}` +} diff --git a/lua/custom/plugins/vague.lua b/lua/custom/plugins/vague.lua new file mode 100644 index 00000000000..31110d9c384 --- /dev/null +++ b/lua/custom/plugins/vague.lua @@ -0,0 +1,12 @@ +return { + 'vague2k/vague.nvim', + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other plugins + config = function() + -- NOTE: you do not need to call setup if you don't want to. + require('vague').setup { + -- optional configuration here + } + vim.cmd 'colorscheme vague' + end, +} diff --git a/lua/custom/plugins/vimbegood.lua b/lua/custom/plugins/vimbegood.lua new file mode 100644 index 00000000000..e1ffd3834aa --- /dev/null +++ b/lua/custom/plugins/vimbegood.lua @@ -0,0 +1,4 @@ +return { + 'ThePrimeagen/vim-be-good', + event = 'VeryLazy', +} diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua index 386d392e7ad..fadbfce3054 100644 --- a/lua/kickstart/plugins/autopairs.lua +++ b/lua/kickstart/plugins/autopairs.lua @@ -4,5 +4,21 @@ return { 'windwp/nvim-autopairs', event = 'InsertEnter', - opts = {}, + opts = { + check_ts = true, -- use Treesitter for smart pairing + }, + config = function(_, opts) + local npairs = require 'nvim-autopairs' + npairs.setup(opts) + + -- Add custom rule for < > in Rust + local Rule = require 'nvim-autopairs.rule' + + npairs.add_rules { + Rule('<', '>', 'rust'):with_pair(function(opts) + local next_char = opts.line:sub(opts.col + 1, opts.col + 1) + return next_char ~= '=' -- avoid pairing in things like <= + end), + } + end, } diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua deleted file mode 100644 index bd4422695aa..00000000000 --- a/lua/kickstart/plugins/neo-tree.lua +++ /dev/null @@ -1,25 +0,0 @@ --- Neo-tree is a Neovim plugin to browse the file system --- https://github.com/nvim-neo-tree/neo-tree.nvim - -return { - 'nvim-neo-tree/neo-tree.nvim', - version = '*', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended - 'MunifTanjim/nui.nvim', - }, - cmd = 'Neotree', - keys = { - { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, - }, - opts = { - filesystem = { - window = { - mappings = { - ['\\'] = 'close_window', - }, - }, - }, - }, -}