add some things

This commit is contained in:
Felix Ingram 2023-10-10 13:06:07 +01:00
parent 1c0c481daa
commit a32a33bde5
1 changed files with 39 additions and 1 deletions

View File

@ -35,6 +35,7 @@ vim.opt.splitright = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
-- Install package manager
-- https://github.com/folke/lazy.nvim
-- `:help lazy.nvim.txt` for more info
@ -202,6 +203,21 @@ require('lazy').setup({
"jose-elias-alvarez/null-ls.nvim",
},
},
{
"ray-x/go.nvim",
dependencies = { -- optional packages
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("go").setup()
end,
event = { "CmdlineEnter" },
ft = { "go", 'gomod' },
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
},
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
-- These are some example plugins that I've included in the kickstart repository.
@ -230,7 +246,7 @@ vim.o.mouse = 'a'
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.o.clipboard = 'unnamedplus'
-- vim.o.clipboard = 'unnamedplus'
-- Enable break indent
vim.o.breakindent = true
@ -286,6 +302,28 @@ vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
vim.keymap.set("n", "Q", "<nop>")
-- go/golang keymaps
vim.keymap.set("n", "<leader>ee", "oif err != nil {<CR>}<Esc>Oreturn err<Esc>")
vim.keymap.set("n", "<leader>ep", "oif err != nil {<CR>}<Esc>Opanic(err)<Esc>")
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" },
{ pattern = { "*.go" }, command = "setlocal shiftwidth=4 tabstop=4" })
-- Run gofmt + goimport on save
local format_sync_grp = vim.api.nvim_create_augroup("GoImport", {})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.go",
callback = function()
require('go.format').goimport()
end,
group = format_sync_grp,
})
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })