diff --git a/init.lua b/init.lua index 776c6873..f5ad9dae 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,13 +110,38 @@ 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) +-- -- 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.opt.clipboard = 'unnamedplus' +-- vim.keymap.set({ 'n', 'x' }, 'y', '"+y', { desc = 'Copy to system clipboard' }) +-- vim.keymap.set({ 'n', 'x' }, 'Y', '"+yg_', { desc = 'Copy to system clipboard' }) +-- vim.keymap.set({ 'n', 'x' }, 'p', '"+p', { desc = 'Paste from system clipboard' }) +-- vim.keymap.set({ 'n', 'x' }, 'P', '"+P', { desc = 'Paste from system clipboard' }) +-- test + +-- vim.g.clipboard = { +-- name = 'OSC 52', +-- copy = { +-- ['+'] = require('vim.ui.clipboard.osc52').copy '+', +-- ['*'] = require('vim.ui.clipboard.osc52').copy '*', +-- }, +-- paste = { +-- ['+'] = require('vim.ui.clipboard.osc52').paste '+', +-- ['*'] = require('vim.ui.clipboard.osc52').paste '*', +-- }, +-- } + +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, +}) -- Enable break indent vim.opt.breakindent = true @@ -214,6 +239,31 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) +vim.api.nvim_create_autocmd('TermOpen', { + desc = 'gets rid of line numbers when using terminal', + group = vim.api.nvim_create_augroup('custom-term-open', { clear = true }), + callback = function() + vim.opt.number = false + vim.opt.relativenumber = false + 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.api.nvim_set_keymap('t', '', '', { noremap = true }) + +vim.api.nvim_create_autocmd('Filetype', { + pattern = 'terraform', + callback = function() + vim.bo.commentstring = '# %s' + 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' @@ -276,6 +326,14 @@ require('lazy').setup({ }, }, + { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = true, + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function + }, + -- 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 @@ -665,8 +723,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 +819,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,11 +1024,11 @@ 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.