diff --git a/init.lua b/init.lua index 776c6873..47e5f308 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.opt` @@ -110,14 +110,6 @@ vim.opt.mouse = 'a' -- Don't show the mode, since it's already in the status line vim.opt.showmode = false --- Sync clipboard between OS and Neovim. --- Schedule the setting after `UiEnter` because it can increase startup-time. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' -end) - -- Enable break indent vim.opt.breakindent = true @@ -223,8 +215,11 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) end -end ---@diagnostic disable-next-line: undefined-field -vim.opt.rtp:prepend(lazypath) +end + +---@type vim.Option +local rtp = vim.opt.rtp +rtp:prepend(lazypath) -- [[ Configure and install plugins ]] -- @@ -239,7 +234,7 @@ vim.opt.rtp:prepend(lazypath) -- 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 + 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following @@ -665,8 +660,8 @@ require('lazy').setup({ local servers = { -- clangd = {}, -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, + pyright = {}, + rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -761,10 +756,10 @@ require('lazy').setup({ formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, + 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' }, }, }, }, @@ -966,17 +961,17 @@ 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.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + 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/init.lua b/lua/custom/init.lua new file mode 100644 index 00000000..188cba3f --- /dev/null +++ b/lua/custom/init.lua @@ -0,0 +1,59 @@ +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + local copy_to_unnamedplus = require('vim.ui.clipboard.osc52').copy '+' + copy_to_unnamedplus(vim.v.event.regcontents) + local copy_to_unnamed = require('vim.ui.clipboard.osc52').copy '*' + copy_to_unnamed(vim.v.event.regcontents) + end, +}) + +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + local copy_to_unnamedplus = require('vim.ui.clipboard.osc52').copy '+' + copy_to_unnamedplus(vim.v.event.regcontents) + local copy_to_unnamed = require('vim.ui.clipboard.osc52').copy '*' + copy_to_unnamed(vim.v.event.regcontents) + end, +}) + +vim.keymap.set('n', 'st', function() + vim.cmd.vnew() + vim.cmd.term() + vim.cmd.wincmd 'J' + vim.api.nvim_win_set_height(0, 15) +end) + +vim.keymap.set( + 'n', + 'K', -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions + function() + vim.cmd.RustLsp { 'hover', 'actions' } + end +) + +vim.api.nvim_set_keymap('t', '', '', { noremap = true }) + +vim.api.nvim_create_autocmd('Filetype', { + pattern = 'terraform', + callback = function() + vim.bo.commentstring = '# %s' + end, +}) + +require('lazy').setup { + + { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = true, + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function + }, + { + 'mrcjkb/rustaceanvim', + version = '^6', -- Recommended + lazy = false, -- This plugin is already lazy + }, +}