From 90faa4a60f21335ba461970f52f67bc1069cc4ef Mon Sep 17 00:00:00 2001 From: abs3nt Date: Thu, 2 Mar 2023 22:48:47 -0800 Subject: [PATCH] updates --- lua/autocmds.lua | 16 ---------------- lua/mappings.lua | 36 +++++++++++++++--------------------- lua/plugins.lua | 21 ++++++++++++++------- 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/lua/autocmds.lua b/lua/autocmds.lua index 7b78f3c..64df71f 100644 --- a/lua/autocmds.lua +++ b/lua/autocmds.lua @@ -54,22 +54,6 @@ autocmd("CursorMoved", { group = _group, }) -function Toggleln() - if vim.b.lnstatus == nil then - vim.b.lnstatus = "number" - end - - if vim.b.lnstatus == "number" then - vim.o.number = false - vim.o.relativenumber = false - vim.b.lnstatus = "nonumber" - else - vim.o.number = true - vim.o.relativenumber = true - vim.b.lnstatus = "number" - end -end - -- change tmux title autocmd("BufReadPost", { pattern = "*", diff --git a/lua/mappings.lua b/lua/mappings.lua index 611f614..6220b73 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -3,27 +3,11 @@ local vimp = require('vimp') -- Map leader vim.g.mapleader = " " --- NvimTree -vimp.noremap({ 'silent' }, 'n', [[:NvimTreeToggle]]) - --- Telescope -vimp.noremap({ 'silent' }, 'ff', [[:Telescope find_files]]) -vimp.noremap({ 'silent' }, 'fg', [[:Telescope live_grep]]) -vimp.noremap({ 'silent' }, 'fb', [[:Telescope buffers]]) - -- tabs and stuff vimp.vnoremap('', [[]]) vimp.noremap("", [[>gv]]) vimp.noremap("", [[', [[:TablineBufferNext]]) -vimp.nnoremap({ 'silent' }, '', [[:TablineBufferPrevious]]) - --- markdown -vimp.noremap({ 'silent' }, 'md', [[:MarkdownPreviewToggle]]) - - -- Remove search highlight on Enter vimp.nnoremap("", [[:nohlsearch]]) @@ -31,8 +15,18 @@ vimp.nnoremap("", [[:nohlsearch]]) vimp.xnoremap("<", [[", [[>gv]]) --- ArgWrap -vimp.nnoremap({ 'silent' }, 'a', [[:ArgWrap]]) - --- Toggle Line -vimp.nnoremap({ 'silent' }, 'l', [[:lua Toggleln()]]) +-- Toggle Lines +vimp.nnoremap({ 'silent' }, 'l', function() + if vim.b.lnstatus == nil then + vim.b.lnstatus = "number" + end + if vim.b.lnstatus == "number" then + vim.o.number = false + vim.o.relativenumber = false + vim.b.lnstatus = "nonumber" + else + vim.o.number = true + vim.o.relativenumber = true + vim.b.lnstatus = "number" + end +end) diff --git a/lua/plugins.lua b/lua/plugins.lua index 545541b..48d01a0 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,3 +1,4 @@ +local vimp = require('vimp') return { --vimp (in mappings.lua) @@ -66,7 +67,8 @@ return { { "iamcco/markdown-preview.nvim", run = "cd app && npm install", - init = function() + config = function() + vimp.noremap({ 'silent' }, 'md', [[:MarkdownPreviewToggle]]) vim.g.mkdp_filetypes = { "markdown" } vim.g.mkdp_markdown_css = os.getenv("XDG_CONFIG_HOME") .. '/nvim/static/custom.css' vim.g.mkdp_highlight_css = os.getenv("XDG_CACHE_HOME") .. '/wal/colors.css' @@ -133,12 +135,18 @@ return { 'nvim-lua/plenary.nvim', lazy = true }, - } + }, + config = function() + vimp.noremap({ 'silent' }, 'ff', [[:Telescope find_files]]) + vimp.noremap({ 'silent' }, 'fg', [[:Telescope live_grep]]) + vimp.noremap({ 'silent' }, 'fb', [[:Telescope buffers]]) + end }, -- file explorer { 'kyazdani42/nvim-tree.lua', + vimp.noremap({ 'silent' }, 'n', [[:NvimTreeToggle]]), dependencies = { 'kyazdani42/nvim-web-devicons' }, config = function() require('nvim-tree').setup { @@ -186,13 +194,10 @@ return { 'mg979/vim-visual-multi', -- wrap things inside pairs - 'FooSoft/vim-argwrap', - - -- which key { - "folke/which-key.nvim", + 'FooSoft/vim-argwrap', config = function() - require("which-key").setup {} + vimp.nnoremap({ 'silent' }, 'a', [[:ArgWrap]]) end }, @@ -340,6 +345,8 @@ return { 'kdheepak/tabline.nvim', dependencies = { { 'kyazdani42/nvim-web-devicons', lazy = true } }, config = function() + vimp.nnoremap({ 'silent' }, '', [[:TablineBufferNext]]) + vimp.nnoremap({ 'silent' }, '', [[:TablineBufferPrevious]]) require('tabline').setup({ options = { theme = 'pywal-nvim' } }) end, },