From 49096a6aebfe4d9186da845717443eb68faa7e95 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 6 Aug 2023 22:51:23 +0200 Subject: Formatted the file --- lua/user/keys.lua | 120 ++++++++++++++---------------------------------------- 1 file changed, 30 insertions(+), 90 deletions(-) (limited to 'lua/user') diff --git a/lua/user/keys.lua b/lua/user/keys.lua index 88b3822..36f7fbd 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -13,16 +13,16 @@ local term_opts = { noremap = true, silent = false } -- Semi-colon as leader key vim.g.mapleader = ";" +-- "jk" and "kj" to exit insert-mode +map("i", "jk", "") +map("i", "kj", "") + -- Jump to next match on line using `.` instead of `;` NOTE: commented out in favour of "ggandor/flit.nvim" --map("n", ".", ";") -- Repeat last command using `` instead of `.` NOTE: commented out in favour of "ggandor/flit.nvim" --map("n", "", ".") --- "jk" and "kj" to exit insert-mode -map("i", "jk", "") -map("i", "kj", "") - -- Reload nvim config map( "n", @@ -193,29 +193,13 @@ map("n", "o", ":!xdg-open %") -- URL handling if vim.fn.has("mac") == 1 then - map( - "", - "gx", - 'call jobstart(["open", expand("")], {"detach": v:true})', - {} - ) + map("", "gx", 'call jobstart(["open", expand("")], {"detach": v:true})', {}) elseif vim.fn.has("unix") == 1 then - map( - "", - "gx", - 'call jobstart(["xdg-open", expand("")], {"detach": v:true})', - {} - ) + map("", "gx", 'call jobstart(["xdg-open", expand("")], {"detach": v:true})', {}) elseif vim.fn.has("wsl") == 1 then - map( - "", - "gx", - 'call jobstart(["wslview", expand("")], {"detach": v:true})', - {} - ) + map("", "gx", 'call jobstart(["wslview", expand("")], {"detach": v:true})', {}) else - map[""].gx = - { 'lua print("Error: gx is not supported on this OS!")' } + map[""].gx = { 'lua print("Error: gx is not supported on this OS!")' } end -- Substitute globally and locally in the selected region. @@ -285,6 +269,16 @@ map("n", "", "NavigatorDown") map({ "n", "t" }, "tt", "ToggleTerm") map({ "n", "t" }, "th", "lua Horizontal_term_toggle()") map({ "n", "t" }, "tv", "lua Vertical_term_toggle()") +-- map[""] = { "ToggleTerm", desc = "Toggle terminal" } +-- map["tn"] = { function() toggle_term_cmd "node" end, desc = "ToggleTerm node" } +-- map["tu"] = { function() toggle_term_cmd "ncdu" end, desc = "ToggleTerm NCDU" } +-- map["tt"] = { function() toggle_term_cmd "htop" end, desc = "ToggleTerm htop" } +-- map["tp"] = { function() toggle_term_cmd "python" end, desc = "ToggleTerm python" } +-- map["tl"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" } +-- map["tf"] = { "ToggleTerm direction=float", desc = "ToggleTerm float" } +-- map["th"] = { "ToggleTerm size=10 direction=horizontal", desc = "ToggleTerm horizontal split" } +-- map["tv"] = { "ToggleTerm size=80 direction=vertical", desc = "ToggleTerm vertical split" } +--end -- LazyGit map({ "n", "t" }, "gg", "lua Lazygit_toggle()") @@ -310,16 +304,6 @@ map("n", "gm", ":Gmove") --map("n", "go", ":Git checkout") --map("n", "gps", ":Dispatch! git push") --map("n", "gpl", ":Dispatch! git pull") --- map[""] = { "ToggleTerm", desc = "Toggle terminal" } --- map["tn"] = { function() toggle_term_cmd "node" end, desc = "ToggleTerm node" } --- map["tu"] = { function() toggle_term_cmd "ncdu" end, desc = "ToggleTerm NCDU" } --- map["tt"] = { function() toggle_term_cmd "htop" end, desc = "ToggleTerm htop" } --- map["tp"] = { function() toggle_term_cmd "python" end, desc = "ToggleTerm python" } --- map["tl"] = { function() toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" } --- map["tf"] = { "ToggleTerm direction=float", desc = "ToggleTerm float" } --- map["th"] = { "ToggleTerm size=10 direction=horizontal", desc = "ToggleTerm horizontal split" } --- map["tv"] = { "ToggleTerm size=80 direction=vertical", desc = "ToggleTerm vertical split" } ---end -- Telescope map("n", "ff", function() @@ -330,55 +314,19 @@ map("n", "fg", "lua require('telescope.builtin').live_grep()") map("n", "fb", "lua require('telescope.builtin').buffers()") map("n", "fh", "lua require('telescope.builtin').help_tags()") map("n", "fc", "lua require('telescope.builtin').commands()") -map( - "n", - "ffc", - "lua require('telescope.builtin').current_buffer_fuzzy_find()" -) +map("n", "ffc", "lua require('telescope.builtin').current_buffer_fuzzy_find()") map("n", "cf", "Telescope changed_files") map("n", "fp", "Telescope pickers") -map( - "n", - "fr", - "lua require('telescope.builtin').registers({})" -) -- registers picker -map( - "n", - "fd", - "lua require('telescope.builtin').diagnostics()" -) +map("n", "fr", "lua require('telescope.builtin').registers({})") -- registers picker +map("n", "fd", "lua require('telescope.builtin').diagnostics()") map("n", "fk", "lua require('telescope.builtin').keymaps()") -map("n", "fn", [[lua require'plugins.telescope'.find_notes()]]) -- find notes -map( - "n", - "fgn", - [[lua require'plugins.telescope'.grep_notes()]] -) -- search notes -map( - "n", - "f.", - [[lua require'plugins.telescope'.find_configs()]] -) -- find configs -map( - "n", - "fs", - [[lua require'plugins.telescope'.find_scripts()]] -) -- find scripts -map( - "n", - "fw", - [[lua require'plugins.telescope'.find_projects()]] -) -- find projects -map( - "n", - "fm", - "lua require('telescope').extensions.media_files.media_files({})" -) -- find media files -map( - "n", - "fi", - "lua require('telescope').extensions.notify.notify({})" -) -- find notifications +map("n", "fn", [[lua require'plugins.telescope'.find_notes()]]) -- find notes +map("n", "fgn", [[lua require'plugins.telescope'.grep_notes()]]) -- search notes +map("n", "f.", [[lua require'plugins.telescope'.find_configs()]]) -- find configs +map("n", "fs", [[lua require'plugins.telescope'.find_scripts()]]) -- find scripts +map("n", "fw", [[lua require'plugins.telescope'.find_projects()]]) -- find projects +map("n", "fm", "lua require('telescope').extensions.media_files.media_files({})") -- find media files +map("n", "fi", "lua require('telescope').extensions.notify.notify({})") -- find notifications --map("n", "f/", "lua require('plugins.telescope').curbuf()") -- find files with hidden option map( "n", @@ -404,11 +352,7 @@ map("n", "mg", "Glow") map("n", "ww", "lua require('user.mods').Toggle_autopairs()") -- Zen-mode toggle -map( - "n", - "zm", - "ZenMode | :echom ('Zen Mode') | :sl! | echo ('')" -) +map("n", "zm", "ZenMode | :echom ('Zen Mode') | :sl! | echo ('')") -- Vim-rooter map( @@ -457,11 +401,7 @@ vim.fn.sign_define("DapBreakpoint", { text = "🐞" }) map("n", "ds", function() dap.continue() ui.toggle({}) - vim.api.nvim_feedkeys( - vim.api.nvim_replace_termcodes("=", false, true, true), - "n", - false - ) -- Spaces buffers evenly + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("=", false, true, true), "n", false) -- Spaces buffers evenly end) -- Set breakpoints, get variable values, step into/out of functions, etc. -- cgit v1.2.3