From f35b13d669867209427449840ff0930a732591dc Mon Sep 17 00:00:00 2001 From: Squibid Date: Fri, 24 Nov 2023 21:38:31 -0500 Subject: more stuff too lazy to seperate --- lua/core/binds.lua | 162 ----------------------------------------------------- 1 file changed, 162 deletions(-) delete mode 100644 lua/core/binds.lua (limited to 'lua/core/binds.lua') diff --git a/lua/core/binds.lua b/lua/core/binds.lua deleted file mode 100644 index b1e98be..0000000 --- a/lua/core/binds.lua +++ /dev/null @@ -1,162 +0,0 @@ -local function map(mode, bind, cmd, opts) - opts = opts or {} - opts['noremap'] = true - opts['silent'] = true - - if type(bind) == 'table' then - for i in pairs(bind) do - vim.keymap.set(mode, bind[i], cmd, opts) - end - elseif type(bind) == 'string' then - vim.keymap.set(mode, bind, cmd, opts) - end -end - --- vim binds ------------------------------------------------------------------ -g.mapleader = ' ' -- set leader key - -map('x', 'p', [["_dP]], { desc = 'Greatest remap of all time.' }) -map('n', '', ':nohlsearch:echo', { desc = 'Clear search.' }) -map('t', '', '', { desc = 'make work in terminals.' }) --- move selected text up/down -map('v', '', ":m '<-2gv=gv", { desc = 'Move selected text up.' }) -map('v', '', ":m '>+1gv=gv", { desc = 'Move selected text down.' }) - --- the cursor STAYS IN THE MIDDLE -map('n', '', 'mzJ`zdelm z') -- when combining lines -map('n', 'n', 'nzzzv') -- when searching -map('n', 'N', 'Nzzzv') -map('n', '', 'zz') -- half page jumping -map('n', '', 'zz') - -map('n', 'x', '!chmod +x "%"') -- execute order 111 - --- add some keybinds to the file view (netrw) -a.nvim_create_autocmd('FileType', { - pattern = 'netrw', - callback = function() - local bind = function(lhs, rhs) - vim.keymap.set('n', lhs, rhs, { remap = true, buffer = true }) - end - bind('h', '-^') -- Go up a directory - bind('l', '') -- Go down a directory / open a file - bind('.', 'gh') -- Toggle hidden files - bind('P', 'z') -- Close preview window - bind('', 'q') -- Close netrw - end -}) - --- tabs -map('n', '[]', 'tabnew') -map('n', '][', 'tabc') -map('n', '[[', 'tabp') -map('n', ']]', 'tabN') - --- plugin binds --------------------------------------------------------------- - --- pretty lsp view -map('n', 'gd', 'Glance definitions') -map('n', 'gr', 'Glance references') -map('n', 'gy', 'Glance type_definitions') -map('n', 'gi', 'Glance implementations') - -if pcall(require, "treesj") then - local treesj = require('treesj') -- treesj - map('n', 'j', treesj.toggle) -end - -if pcall(require, "telescope") then - local telebuilt = require('telescope.builtin') -- telescope - -- local telexten = require('telescope').extensions - map('n', 'sf', telebuilt.find_files, { desc = 'Find files.' }) - map('n', 'so', telebuilt.oldfiles, { desc = 'Find old files.' }) - map('n', 'sg', telebuilt.git_files, { desc = 'Find git files.' }) - -- search urls in buffer - map('n', 'su', 'UrlView', { desc = 'Find urls in buffer.' }) - -- search lsp symbols - map('n', 'ss', telebuilt.lsp_document_symbols, - { desc = 'Find LSP Symbols.' }) - -- search for keybinds - map('n', 'sk', telebuilt.keymaps, - { desc = 'Find nvim Highlights.' }) - -- search for highlights - map('n', 'sh', telebuilt.highlights, - { desc = 'Find nvim Highlights.' }) - -- search for autocommands - map('n', 'sa', telebuilt.autocommands, - { desc = 'Find nvim Autocommands.' }) - -- search for vim options - map('n', 'sv', telebuilt.vim_options, { desc = 'Find vim options.' }) - -- search for string in project - map('n', 'sp', function() - telebuilt.grep_string({ search = vim.fn.input('Find string in project > ')}) - end, { desc = 'Find string in project.' }) - -- Code Actions (requires telescope) - if pcall(require, "actions-preview") then - map({ "n", "v" }, "ca", require("actions-preview").code_actions, { - desc = 'preview code actions' - }) - end -end - -map('n', 'u', 'UndotreeToggle', { desc = 'Open undo tree.' }) -map('n', 'f', 'SFMToggle', { desc = 'Open file tree view.' }) -map('n', 'b', 'JABSOpen', { desc = 'Switch between buffers.' }) - -if pcall(require, "smart-splits") then - local smartsplits = require('smart-splits') -- resizing buffers (toggleable) - map('n', 'r', smartsplits.start_resize_mode) -end - --- toggle term (don't use leader key in these binds) -map({'n', 't'}, '', 'ToggleTerm direction=float') -map({'n', 't'}, '', 'lua _glow()') - --- true zen -if pcall(require, "true-zen") then - map('n', 'zf', require("true-zen.focus").toggle, { - desc = 'fullscreen', - }) - map('n', 'zm', require("true-zen.minimalist").toggle, { - desc = 'minimal', - }) - map('n', 'za', require("true-zen.ataraxis").toggle, { - desc = 'zen', - }) -end - --- git -map('n', 'gp', 'Gitsigns preview_hunk_inline') -map('n', 'gs', 'Gitsigns stage_hunk') -map('n', 'gb', 'Gitsigns blame_line') -map('n', 'g]', 'Gitsigns next_hunk') -map('n', 'g[', 'Gitsigns prev_hunk') - --- neogen -if pcall(require, "neogen") then - map('n', 'df', require("neogen").generate, { - desc = 'Generate anotations', - }) -end - --- venn -function _G.Toggle_venn() - 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", "j:VBox", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "K", "k:VBox", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "L", "l:VBox", {noremap = true}) - vim.api.nvim_buf_set_keymap(0, "n", "H", "h:VBox", {noremap = true}) - -- draw a box by pressing "f" with visual selection - vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox", {noremap = true}) - else - vim.cmd[[setlocal ve=]] - vim.cmd[[mapclear ]] - vim.b.venn_enabled = nil - end -end --- toggle keymappings for venn using v -vim.api.nvim_set_keymap('n', 'v', ":lua Toggle_venn()", { noremap = true}) -- cgit v1.2.1