This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / tools / astronvim / config / lua / plugins / mappings.lua
2.1 kB 66 lines
1function open_or_create_file(tfilename) 2 -- complete filepath from the file where this is called 3 local parent = vim.fn.expand("%:p:h") 4 local newfilepath = parent .. "/" .. vim.fn.expand(tfilename) 5 6 if vim.fn.filereadable(newfilepath) ~= 1 then 7 -- create parent directory 8 vim.fn.system("mkdir -p " .. vim.fn.shellescape(parent)) 9 vim.fn.system("touch " .. vim.fn.shellescape(newfilepath)) 10 end 11 vim.cmd(":e " .. newfilepath) 12end 13 14return { 15 "AstroNvim/astrocore", 16 ---@type AstroCoreOpts 17 opts = { 18 -- Mapping data with "desc" stored directly by vim.keymap.set(). 19 -- 20 -- Please use this mappings table to set keyboard mapping since this is the 21 -- lower level configuration and more robust one. (which-key will 22 -- automatically pick-up stored data by this setting.) 23 mappings = { 24 -- first key is the mode 25 n = { 26 -- tables with the `name` key will be registered with which-key if it's installed 27 -- this is useful for naming menus 28 ["<leader>b"] = { name = "Buffers" }, 29 -- quick save 30 -- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command 31 32 -- Switch between tabs 33 ["<S-Tab>"] = { ":bprev<CR>" }, 34 ["<Tab>"] = { ":bnext<CR>" }, 35 36 -- Don't error if file doesn't exist 37 ["gf"] = { 38 function() 39 open_or_create_file(vim.fn.expand("<cfile>")) 40 end, 41 desc = "Create file", 42 }, 43 ["<leader>*"] = { 44 function() 45 require("telescope.builtin").grep_string() 46 end, 47 desc = "Find for word under cursor", 48 }, 49 ["<leader><leader>"] = { 50 function() 51 require("telescope.builtin").find_files() 52 end, 53 desc = "Find files", 54 }, 55 }, 56 t = { 57 -- setting a mapping to false will disable it 58 -- ["<esc>"] = false, 59 }, 60 c = { 61 -- setting a mapping to false will disable it 62 ["w!!"] = { "w !sudo tee > /dev/null %", desc = "Write as sudo" }, 63 }, 64 }, 65 }, 66}