diff --git a/init.lua b/init.lua index 1427b6c7..472abdef 100644 --- a/init.lua +++ b/init.lua @@ -163,7 +163,8 @@ vim.opt.confirm = true -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` - +vim.opt.foldmethod = 'indent' +vim.opt.foldlevel = 99 -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') @@ -171,6 +172,7 @@ 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', 'gn', 'tab split | lua vim.lsp.buf.definition()', {}) -- 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 -- is not what someone will guess without a bit more experience. @@ -208,6 +210,16 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) +-- Write the last file closed and its cursor position to a temporary file +vim.api.nvim_create_autocmd('VimLeavePre', { + callback = function() + local filepath = vim.fn.expand '%:p' + local line = vim.fn.line '.' + if filepath ~= '' then + vim.fn.writefile({ filepath, tostring(line) }, '/tmp/nvim_last_closed') + end + end, +}) -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -231,6 +243,7 @@ vim.opt.rtp:prepend(lazypath) -- :Lazy update -- -- NOTE: Here is where you install your plugins. + require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -254,7 +267,8 @@ require('lazy').setup({ -- } -- -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. + -- options to `gitsigns.nvim`. This is equivalent to the following Lua: + -- 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 @@ -270,6 +284,17 @@ require('lazy').setup({ }, }, + { + 'joshuavial/aider.nvim', + opts = { + -- your configuration comes here + -- if you don't want to use the default settings + auto_manage_context = true, -- automatically manage buffer context + default_bindings = true, -- use default A keybindings + debug = false, -- enable debug logging + }, + }, + -- 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 @@ -663,9 +688,9 @@ 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 = { - -- clangd = {}, + clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -673,7 +698,7 @@ 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 = {}, -- lua_ls = { @@ -990,14 +1015,14 @@ require('lazy').setup({ -- require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.neo-tree', -- 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' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000..c47ee997 --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,13 @@ +-- You can add your own plugins here or in other files in this directory! +-- I promise not to create any merge conflicts in this directory :) +-- +-- See the kickstart.nvim README for more information +return { + -- Github Copilot + 'github/copilot.vim', + config = function() + vim.g.copilot_assume_mapped = true + vim.g.copilot_no_tab_map = true + vim.api.nvim_set_keymap('i', '', 'copilot#Accept("")', { silent = true, expr = true }) + end, +} diff --git a/lua/custom/plugins/gitsigns.lua b/lua/custom/plugins/gitsigns.lua new file mode 100644 index 00000000..bcf0229c --- /dev/null +++ b/lua/custom/plugins/gitsigns.lua @@ -0,0 +1,5 @@ +return { + require('gitsigns').setup { + current_line_blame = true, + }, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index be0eb9d8..00000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -1,5 +0,0 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information -return {} diff --git a/lua/custom/plugins/stickyscroll.lua b/lua/custom/plugins/stickyscroll.lua new file mode 100644 index 00000000..c9e3d13a --- /dev/null +++ b/lua/custom/plugins/stickyscroll.lua @@ -0,0 +1,9 @@ +return { + 'nvim-treesitter/nvim-treesitter-context', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + config = function() + require('treesitter-context').setup { + mode = 'topline', + } + end, +}