-- these are my custom functions require("functions") --local fn = vim.fn -- to call Vim functions e.g. fn.bufnr() local function map(mode, lhs, rhs, opts) local options = {noremap = true} if opts then options = vim.tbl_extend("force", options, opts) end vim.api.nvim_set_keymap(mode, lhs, rhs, options) end vim.g.mapleader = "," map("v", "", '"+y') --map("n", "", ":bnext") --map("n", "", ":bprevious") map("n", "", ":lua harpoon_bnext()") map("n", "", ":lua harpoon_bprevious()") map("n", "", ":noh", {silent = true}) --After searching, pressing escape stops the highlight --map("n", "w", [[:%s/\s\+$//e]]) --map("n", "x", ":Bclose ") map("n", "t", ":tabnew") -- Move split map("n", "", "") map("n", "", "") map("n", "", "") map("n", "", "") --map("n", "", "") --map("n", "", "") --map("n", "", "") --map("n", "", "") -- Split navigations map("n", "", "") map("n", "", "") map("n", "", "") map("n", "", "") --map("n", "", "") --map("n", "", "") --map("n", "", "") --map("n", "", "") -- Resize split --map("n", "", "-") --map("n", "", "+") --map("n", "", "<") --map("n", "", ">") -- Scroll viewport map("n", "", "") map("n", "", "") map("v", "", "") map("v", "", "") map("i", "", "") map("i", "", "") --map("n", "", "") --map("n", "", "") --map("v", "", "") --map("v", "", "") --map("i", "", "") --map("i", "", "") -- Make visual yanks place the cursor back where started map("v", "y", "ygv") -- map Enter to switch tabs --map("n", "", ":tabnext") --map("n", "", ":tabprevious") --------- -- HOP -- --------- local hop_opts = "{ create_hl_autocmd = true }" local hopword = [[lua require'hop'.hint_words(]] .. hop_opts .. [[)]] local hopline = [[lua require'hop'.hint_lines_skip_whitespace(]] .. hop_opts .. [[)]] --map("n", "", hopline, {silent = true}) --map("v", "", hopline, {silent = true}) --map("n", "", hopword, {silent = true}) --map("v", "", hopword, {silent = true}) map("n", "W", hopline, {silent = true}) map("v", "W", hopline, {silent = true}) map("n", "w", hopword, {silent = true}) map("v", "w", hopword, {silent = true}) -- args: direction: bool, inclusive: bool -- inclusive is broken in hop as of this comment --local hop_hint_char1 = function(args) -- local direction = args.forward and "AFTER_CURSOR" or "BEFORE_CURSOR" -- local inclusive = args.inclusive and "true" or "false" -- -- return ("lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection." .. -- direction .. ", current_line_only = true, inclusive_jump = " .. inclusive .. " })") --end -- --vim.api.nvim_set_keymap("", "f", hop_hint_char1({forward = true, inclusive = false}), {}) --vim.api.nvim_set_keymap("", "F", hop_hint_char1({forward = false, inclusive = false}), {}) --vim.api.nvim_set_keymap("", "t", hop_hint_char1({forward = true, inclusive = false}), {}) --vim.api.nvim_set_keymap("", "T", hop_hint_char1({forward = false, inclusive = false}), {}) -- place this in one of your configuration file(s) --vim.api.nvim_set_keymap( -- "n", -- "f", -- "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", -- {} --) --vim.api.nvim_set_keymap( -- "n", -- "F", -- "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", -- {} --) --vim.api.nvim_set_keymap( -- "", -- "f", -- "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, inclusive_jump = true })", -- {} --) --vim.api.nvim_set_keymap( -- "", -- "F", -- "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, inclusive_jump = true })", -- {} --) --vim.api.nvim_set_keymap( -- "", -- "t", -- "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })", -- {} --) --vim.api.nvim_set_keymap( -- "", -- "T", -- "lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })", -- {} --) --------- -- FZF -- --------- map("n", "o", ":Files") --map("n", "O", [[:lua vim.fn['fzf#vim#files']('~/')]]) map("n", "O", ":Files ~/") map("n", "p", ":Buffers") map("n", "h", ":Helptags") map("n", ";", ":History:") map("n", "c", ":Commands") map("n", "r", ":Rg") map("n", "s", ":Lines") --map("n", "[", ":Windows ") map("n", "gf", ":GFiles") map("n", "gn", ":GFiles?") map("n", "gc", ":Commits") ------------------ -- FZF-CHECKOUT -- ------------------ map("n", "gb", ":GBranches") --------- -- ALE -- --------- --map("n", "", ":ALEPreviousWrap ", {silent = true}) --map("n", "", ":ALENextWrap ", {silent = true}) map("n", "f", ":ALEFix", {silent = true}) ------------- -- HARPOON -- ------------- --map("n", "m", [[:lua require("harpoon.mark").add_file() ]]) map("n", "x", ":lua harpoon_rm_file()") map("n", "ma", [[:lua harpoon_toggle_file()]]) map("n", "mc", [[:lua harpoon_clear_all()]]) map("n", "ml", [[:lua require("harpoon.ui").toggle_quick_menu()]]) map("n", "mt", [[:lua harpoon_btoggle()]]) --map("n", "n", [[:lua require("harpoon.ui").nav_next() ]]) --map("n", "N", [[:lua require("harpoon.ui").nav_prev() ]]) ----------- -- CODEX -- ----------- --local create_completion = ":lua vim.fn.CreateCompletion(200)" --local create_completion = ":lua vim.fn.CreateCompletionLine()" --map("n", "", create_completion) --map("i", "", ("" .. create_completion)) --map("i", "", "liul:CreateCompletion") -------------- -- NVIM FZF -- -------------- map("n", "mm", [[:lua fzf_buffer_add_to_harpoon()]]) map("n", "mo", [[:lua fzf_files_to_harpoon()]]) map("n", "ml", [[:lua fzf_select_harpoon_mark()]])