Minor house cleaning.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
-- Terminals should open with insert mode
|
||||
vim.api.nvim_create_autocmd("BufEnter", { pattern = "term://*", callback = function() vim.cmd("startinsert") end })
|
||||
|
||||
-- Start treesitter
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = '*',
|
||||
@@ -8,6 +9,7 @@ vim.api.nvim_create_autocmd('FileType', {
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end,
|
||||
})
|
||||
|
||||
-- highlights yanked text
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
callback = function()
|
||||
@@ -17,6 +19,7 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Set absolute numbers when in insert mode otherwise relativenumbers
|
||||
local nums = vim.api.nvim_create_augroup('smart_numbers', {})
|
||||
vim.api.nvim_create_autocmd('InsertEnter', {
|
||||
@@ -31,6 +34,7 @@ vim.api.nvim_create_autocmd('InsertLeave', {
|
||||
vim.opt.relativenumber = true
|
||||
end,
|
||||
})
|
||||
|
||||
-- removes trailing whitespace on save
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
callback = function()
|
||||
@@ -39,6 +43,7 @@ vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
vim.fn.setpos(".", save_cursor)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Lsp autocomplete
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||
@@ -93,6 +98,4 @@ local function smart_format()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- :FF (Format Function) works in normal and visual mode
|
||||
vim.api.nvim_create_user_command("FF", smart_format, { range = true })
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
vim.pack.add({
|
||||
{ src = "https://github.com/ibhagwan/fzf-lua" },
|
||||
{ src = "https://github.com/catppuccin/nvim", name = "catppuccin" },
|
||||
{ src = "https://github.com/tribela/transparent.nvim" },
|
||||
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
||||
{ src = "https://github.com/romus204/tree-sitter-manager.nvim" }
|
||||
{ src = "https://github.com/romus204/tree-sitter-manager.nvim" },
|
||||
{ src = "https://github.com/catppuccin/nvim", name = "catppuccin" },
|
||||
{ src = "https://github.com/tribela/transparent.nvim" }
|
||||
})
|
||||
vim.cmd(":colorscheme catppuccin-nvim")
|
||||
|
||||
@@ -19,3 +19,8 @@ map("n", "<leader>ss", ":lua FzfLua.grep_project()<CR>")
|
||||
map("n", "<leader>sf", ":lua FzfLua.grep_curbuf()<CR>")
|
||||
map("n", "<leader>sw", ":lua FzfLua.grep_cword()<CR>")
|
||||
|
||||
-- Lsp specific, uses nvim-lspconfigs with the below
|
||||
vim.lsp.enable({ "gopls" })
|
||||
map("n", "L", ":lua vim.diagnostic.open_float()<CR>")
|
||||
map("n", "gd", ":lua vim.lsp.buf.definition()<CR>")
|
||||
map("n", "<leader>r", ":lua vim.lsp.buf.rename()<CR>")
|
||||
|
||||
Reference in New Issue
Block a user