diff --git a/init.lua b/init.lua index a00054d..3246b85 100644 --- a/init.lua +++ b/init.lua @@ -15,17 +15,22 @@ vim.opt.termguicolors = true vim.opt.completeopt = "menu,menuone,noselect" vim.opt.cursorline = true -vim.api.nvim_create_autocmd("FileType", { pattern = { "org" }, command = "setlocal nowrap" }) +vim.api.nvim_create_autocmd('FileType', { pattern = 'org', command = 'setlocal nowrap' }) +vim.api.nvim_create_autocmd('TextYankPost', { + pattern = '*', + callback = function() + vim.highlight.on_yank { higroup = 'IncSearch' } + end, +}) local ensure_packer = function() - local fn = vim.fn - local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' - if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) - vim.cmd [[packadd packer.nvim]] - return true - end - return false + local install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' + if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + vim.fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) + vim.cmd [[packadd packer.nvim]] + return true + end + return false end local packer_bootstrap = ensure_packer() @@ -57,19 +62,19 @@ require('packer').startup(function(use) use { 'nvim-orgmode/orgmode', config = function() require('orgmode').setup_ts_grammar() - require'nvim-treesitter.configs'.setup { + require 'nvim-treesitter.configs'.setup { highlight = { enable = true, - additional_vim_regex_highlighting = {'org'}, -- Required for spellcheck, some LaTex highlights and code block highlights that do not have ts grammar + additional_vim_regex_highlighting = { 'org' }, -- Required for spellcheck, some LaTex highlights and code block highlights that do not have ts grammar }, - ensure_installed = {'org'}, -- Or run :TSUpdate org + ensure_installed = { 'org' }, -- Or run :TSUpdate org } require('orgmode').setup({ - org_agenda_files = {'~/Sync/Notes/*'}, + org_agenda_files = { '~/Sync/Notes/*' }, org_default_notes_file = '~/Sync/Notes/Main.org', }) - end} + end } use { "catppuccin/nvim", @@ -146,21 +151,21 @@ require('packer').startup(function(use) 'VonHeikemen/lsp-zero.nvim', requires = { -- LSP Support - {'neovim/nvim-lspconfig'}, - {'williamboman/mason.nvim'}, - {'williamboman/mason-lspconfig.nvim'}, + { 'neovim/nvim-lspconfig' }, + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, -- Autocompletion - {'hrsh7th/nvim-cmp'}, - {'hrsh7th/cmp-buffer'}, - {'hrsh7th/cmp-path'}, - {'saadparwaiz1/cmp_luasnip'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/cmp-nvim-lua'}, + { 'hrsh7th/nvim-cmp' }, + { 'hrsh7th/cmp-buffer' }, + { 'hrsh7th/cmp-path' }, + { 'saadparwaiz1/cmp_luasnip' }, + { 'hrsh7th/cmp-nvim-lsp' }, + { 'hrsh7th/cmp-nvim-lua' }, -- Snippets - {'L3MON4D3/LuaSnip'}, - {'rafamadriz/friendly-snippets'}, + { 'L3MON4D3/LuaSnip' }, + { 'rafamadriz/friendly-snippets' }, }, config = function() local lsp = require('lsp-zero') @@ -188,7 +193,7 @@ require('packer').startup(function(use) use { 'JoosepAlviste/nvim-ts-context-commentstring', config = function() - require'nvim-treesitter.configs'.setup({ + require 'nvim-treesitter.configs'.setup({ context_commentstring = { enable = true } @@ -200,7 +205,7 @@ require('packer').startup(function(use) 'goolord/alpha-nvim', requires = { 'kyazdani42/nvim-web-devicons' }, config = function() - require'alpha'.setup(require'alpha.themes.startify'.config) + require 'alpha'.setup(require 'alpha.themes.startify'.config) end } @@ -213,7 +218,7 @@ require('packer').startup(function(use) use { 'alexghergh/nvim-tmux-navigation', config = function() - require'nvim-tmux-navigation'.setup { + require 'nvim-tmux-navigation'.setup { keybindings = { left = "", down = "", @@ -242,7 +247,10 @@ require('packer').startup(function(use) use { "akinsho/toggleterm.nvim", tag = '*', config = function() - require("toggleterm").setup({ direction = 'float' }) + require("toggleterm").setup({ + direction = 'float', + open_mapping = [[]] + }) end } @@ -261,9 +269,9 @@ require('packer').startup(function(use) end } - if packer_bootstrap then - require('packer').sync() - end + if packer_bootstrap then + require('packer').sync() + end end) local wk = require("which-key") @@ -284,6 +292,7 @@ wk.register({ r = { "Telescope oldfiles", "Recent Files" }, b = { "Telescope buffers", "Buffers" }, }, + F = { ":lua vim.lsp.buf.format()", "Format Buffer" }, J = { ":SplitjoinJoin", "Join" }, t = { name = "Table", @@ -302,5 +311,4 @@ wk.register({ }, [""] = { ":BufferLineCycleNext", "Next Tab" }, [""] = { ":BufferLineCyclePrev", "Previous Tab" }, - [""] = { ":ToggleTerm", "Terminal" }, })