diff options
Diffstat (limited to '')
-rw-r--r-- | lua/conf/auto.lua | 85 | ||||
-rw-r--r-- | lua/conf/binds.lua (renamed from lua/core/binds.lua) | 28 | ||||
-rw-r--r-- | lua/conf/init.lua | 4 | ||||
-rw-r--r-- | lua/conf/opts.lua (renamed from lua/core/opts.lua) | 4 | ||||
-rw-r--r-- | lua/conf/plugins.lua (renamed from lua/core/plugins.lua) | 47 |
5 files changed, 138 insertions, 30 deletions
diff --git a/lua/conf/auto.lua b/lua/conf/auto.lua new file mode 100644 index 0000000..8c990d6 --- /dev/null +++ b/lua/conf/auto.lua @@ -0,0 +1,85 @@ +local function auto(event, opts) + a.nvim_create_autocmd(event, opts) +end + +local function augroup(name, opts) + opts = opts or {} + opts['clear'] = true + a.nvim_create_augroup(name, opts) +end + +local winchange = augroup('winchange') +local bufcheck = augroup('bufcheck') +local toggles = augroup('toggles') + +auto({ "FocusGained", "TermClose", "TermLeave" }, { + group = bufcheck, + desc = 'Update contents of file.', + command = "checktime", +}) + +auto("VimResized", { + group = winchange, + desc = 'Resize splits when window is resized.', + callback = function() + local current_tab = vim.fn.tabpagenr() + vim.cmd("tabdo wincmd =") + vim.cmd("tabnext " .. current_tab) + end, +}) + +auto('TextYankPost', { + group = bufcheck, + pattern = '*', + desc = 'Highlight on yank.', + callback = function() + vim.highlight.on_yank{ timeout = 250 } + end +}) + +auto('BufRead', { + pattern = '*', + group = bufcheck, + desc = 'Return to the last place the buffer was closed in.', + callback = function() vim.cmd([[call setpos(".", getpos("'\""))]]) end +}) + +auto('FileType', { + pattern = { 'gitcommit', 'markdown' }, + desc = 'Spell checking and wrapping in commit buffers and markdown files.', + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + end +}) + +auto('BufWritePre', { + pattern = '*', + group = bufcheck, + desc = 'Basically mkdir -p.', + callback = function(ctx) + if ctx.match:match("^%w%w+://") then return end + local dir = vim.fn.fnamemodify(ctx.file, ':p:h') + vim.fn.mkdir(dir, 'p') + end +}) + +auto('WinLeave', { + pattern = '!Alpha', + desc = 'Unset cursorline', + group = toggles, + callback = function() vim.opt.cursorline = false end +}) + +auto('WinEnter', { + pattern = '!Alpha', + desc = 'Set cursorline', + group = toggles, + callback = function() vim.opt.cursorline = true end +}) + +auto('ColorScheme', { + desc = 'Update statusline on colorscheme change', + group = winchange, + callback = function() require('el').reset_windows() end +}) diff --git a/lua/core/binds.lua b/lua/conf/binds.lua index b1e98be..5fc8055 100644 --- a/lua/core/binds.lua +++ b/lua/conf/binds.lua @@ -1,3 +1,5 @@ +local conf = require('core.conf') + local function map(mode, bind, cmd, opts) opts = opts or {} opts['noremap'] = true @@ -52,6 +54,9 @@ map('n', '][', '<cmd>tabc<CR>') map('n', '[[', '<cmd>tabp<CR>') map('n', ']]', '<cmd>tabN<CR>') +-- config binds --------------------------------------------------------------- +map('n', '<leader>m', conf.configmenu, { desc = 'Neovim config manager menu', }) + -- plugin binds --------------------------------------------------------------- -- pretty lsp view @@ -78,7 +83,7 @@ if pcall(require, "telescope") then { desc = 'Find LSP Symbols.' }) -- search for keybinds map('n', '<leader>sk', telebuilt.keymaps, - { desc = 'Find nvim Highlights.' }) + { desc = 'Find nvim Keymaps.' }) -- search for highlights map('n', '<leader>sh', telebuilt.highlights, { desc = 'Find nvim Highlights.' }) @@ -89,7 +94,13 @@ if pcall(require, "telescope") then map('n', '<leader>sv', telebuilt.vim_options, { desc = 'Find vim options.' }) -- search for string in project map('n', '<leader>sp', function() - telebuilt.grep_string({ search = vim.fn.input('Find string in project > ')}) + vim.ui.input({ prompt = 'Find string in project' }, function(input) + if not input or input == '' then + vim.notify('No query!', vim.log.levels.WARN, { title = misc.appid }) + return nil + end + telebuilt.grep_string({ search = input }) + end) end, { desc = 'Find string in project.' }) -- Code Actions (requires telescope) if pcall(require, "actions-preview") then @@ -141,17 +152,18 @@ end -- venn function _G.Toggle_venn() + local mapb = vim.api.nvim_buf_set_keymap local venn_enabled = vim.inspect(vim.b.venn_enabled) if venn_enabled == "nil" then vim.b.venn_enabled = true vim.cmd([[setlocal ve=all]]) -- draw a line on HJKL keystokes - vim.api.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", {noremap = true}) + mapb(0, "n", "J", "<C-v>j:VBox<CR>", { noremap = true }) + mapb(0, "n", "K", "<C-v>k:VBox<CR>", { noremap = true }) + mapb(0, "n", "L", "<C-v>l:VBox<CR>", { noremap = true }) + mapb(0, "n", "H", "<C-v>h:VBox<CR>", { noremap = true }) -- draw a box by pressing "f" with visual selection - vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", {noremap = true}) + mapb(0, "v", "f", ":VBox<CR>", { noremap = true }) else vim.cmd[[setlocal ve=]] vim.cmd[[mapclear <buffer>]] @@ -159,4 +171,4 @@ function _G.Toggle_venn() end end -- toggle keymappings for venn using <leader>v -vim.api.nvim_set_keymap('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true}) +map('n', '<leader>v', ":lua Toggle_venn()<CR>") diff --git a/lua/conf/init.lua b/lua/conf/init.lua new file mode 100644 index 0000000..2029141 --- /dev/null +++ b/lua/conf/init.lua @@ -0,0 +1,4 @@ +misc.include('conf.plugins') -- load plugins first to allow colorscheme to be set in opts +misc.include('conf.opts') +misc.include('conf.binds') +misc.include('conf.auto') diff --git a/lua/core/opts.lua b/lua/conf/opts.lua index 82d88bd..3997b5f 100644 --- a/lua/core/opts.lua +++ b/lua/conf/opts.lua @@ -31,11 +31,11 @@ o.softtabstop = tabwidth -- colorscheme o.termguicolors = true -vim.cmd('colorscheme mellow') -- mellow -vim.cmd('colorscheme mellow+') -- some changes +misc.colorscheme('mellow') -- better editing ------------------------------------------------------------- o.clipboard = 'unnamedplus' -- system clipboard +o.splitkeep = "screen" -- keep same text on screen when spliting -- file saving ---------------------------------------------------------------- o.swapfile = false diff --git a/lua/core/plugins.lua b/lua/conf/plugins.lua index db20075..23be6c6 100644 --- a/lua/core/plugins.lua +++ b/lua/conf/plugins.lua @@ -1,15 +1,11 @@ -require 'dep' { - sync = "always", +require('dep') { -- dep manages dep ---------------------------------------------------------- { 'squibid/dep', url = 'https://git.squi.bid/dep', + pin = true, -- branch = 'dev' }, - { 'squibid/git-yodel', - url = 'https://git.squi.bid/git-yodel' - }, - -- colorschemes ------------------------------------------------------------- { 'kvrohit/mellow.nvim', requires = 'nvim-treesitter/nvim-treesitter' @@ -20,19 +16,24 @@ require 'dep' { { 'folke/which-key.nvim' }, -- key map help { 'rcarriga/nvim-notify' }, -- notifications { 'tjdevries/express_line.nvim', -- status bar - requires = 'nvim-lua/plenary.nvim', + requires = 'nvim-lua/plenary.nvim' }, { 'goolord/alpha-nvim' }, -- start page { 'dinhhuy258/sfm.nvim', -- tree view - deps = 'dinhhuy258/sfm-git.nvim', + deps = 'dinhhuy258/sfm-git.nvim' }, { 'matbme/JABS.nvim' }, -- buffer switcher - { 'tomiis4/Hypersonic.nvim' }, -- regex helper/displayer + { 'stevearc/dressing.nvim', -- nice ui selectors + requires = 'nvim-telescope/telescope.nvim' + }, + { 'lukas-reineke/headlines.nvim', + requires = 'nvim-neorg/neorg' + }, -- functional plugins ------------------------------------------------------- { 'lewis6991/gitsigns.nvim' }, -- very helpful git things { 'squibid/git-yodel', -- git cache diff preview when in commit buffer - url = 'https://git.squi.bid/git-yodel' + url = 'https://git.squi.bid/git-yodel', }, { 'chentoast/marks.nvim' }, -- marks in gutter { 'vidocqh/auto-indent.nvim' }, -- better tabbing into indents @@ -65,23 +66,28 @@ require 'dep' { requires = 'nvim-lua/plenary.nvim', deps = { 'nvim-telescope/telescope-file-browser.nvim', - 'nvim-telescope/telescope-ui-select.nvim', 'nvim-telescope/telescope-symbols.nvim', - 'axieax/urlview.nvim', + 'axieax/urlview.nvim' } }, + { 'nvim-telescope/telescope-fzf-native.nvim', + config = function() + vim.cmd('make') + end, + requires = 'nvim-telescope/telescope.nvim' + }, -- treesitter + colorizing -------------------------------------------------- { 'nvim-treesitter/nvim-treesitter', deps = { 'm-demare/hlargs.nvim', 'Wansmer/treesj', - 'nvim-treesitter/nvim-treesitter-context', + 'nvim-treesitter/nvim-treesitter-context' } }, { 'NvChad/nvim-colorizer.lua' }, { 'folke/todo-comments.nvim', - requires = 'nvim-lua/plenary.nvim', + requires = 'nvim-lua/plenary.nvim' }, -- cmp ---------------------------------------------------------------------- @@ -91,23 +97,24 @@ require 'dep' { 'hrsh7th/cmp-buffer', -- buffers 'FelipeLema/cmp-async-path', -- path 'hrsh7th/cmp-calc', -- calculator - 'saadparwaiz1/cmp_luasnip', -- snippets 'hrsh7th/cmp-nvim-lsp', -- lsp 'uga-rosa/cmp-dictionary', -- dictionary 'hrsh7th/cmp-nvim-lua', -- nvim lua api + { 'doxnit/cmp-luasnip-choice', -- luasnip + requires = 'L3MON4D3/LuaSnip' + } }, }, -- snippets ----------------------------------------------------------------- { 'L3MON4D3/LuaSnip', - deps = 'rafamadriz/friendly-snippets', + deps = 'rafamadriz/friendly-snippets' }, - { 'doxnit/cmp-luasnip-choice' }, -- lsp ---------------------------------------------------------------------- { 'neovim/nvim-lspconfig' }, -- setup lsp { 'j-hui/fidget.nvim', -- shows lsp progress - branch = 'legacy', + branch = 'legacy' }, { 'ray-x/lsp_signature.nvim' }, -- see information about the current function @@ -121,14 +128,14 @@ require 'dep' { }, { 'whynothugo/lsp_lines.nvim', - url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim', + url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim' }, -- mason -------------------------------------------------------------------- { 'williamboman/mason.nvim', deps = { 'WhoIsSethDaniel/mason-tool-installer.nvim', - 'williamboman/mason-lspconfig.nvim', + 'williamboman/mason-lspconfig.nvim' } } } |