Advertisement
Wurfkreuz

Untitled

May 4th, 2023
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.68 KB | None | 0 0
  1. "
  2. local is_available = utils.is_available
  3. local ui = require "astronvim.utils.ui"
  4.  
  5. local maps = { i = {}, n = {}, v = {}, t = {} }
  6.  
  7. local sections = {
  8. f = { desc = "󰍉 Find" },
  9. p = { desc = "󰏖 Packages" },
  10. l = { desc = " LSP" },
  11. u = { desc = " UI" },
  12. b = { desc = "󰓩 Buffers" },
  13. bs = { desc = "󰒺 Sort Buffers" },
  14. d = { desc = " Debugger" },
  15. g = { desc = "󰊢 Git" },
  16. S = { desc = "󱂬 Session" },
  17. t = { desc = " Terminal" },
  18. }
  19. if not vim.g.icons_enabled then vim.tbl_map(function(opts) opts.desc = opts.desc:gsub("^.* ", "") end, sections) end
  20.  
  21. -- Normal --
  22. -- Standard Operations
  23. maps.n["j"] = { "v:count == 0 ? 'gj' : 'j'", expr = true, desc = "Move cursor down" }
  24. maps.n["k"] = { "v:count == 0 ? 'gk' : 'k'", expr = true, desc = "Move cursor up" }
  25. maps.n["<leader>w"] = { "<cmd>w<cr>", desc = "Save" }
  26. maps.n["<leader>q"] = { "<cmd>confirm q<cr>", desc = "Quit" }
  27. maps.n["<leader>n"] = { "<cmd>enew<cr>", desc = "New File" }
  28. maps.n["gx"] = { utils.system_open, desc = "Open the file under cursor with system app" }
  29. maps.n["<C-s>"] = { "<cmd>w!<cr>", desc = "Force write" }
  30. maps.n["<C-q>"] = { "<cmd>q!<cr>", desc = "Force quit" }
  31. maps.n["|"] = { "<cmd>vsplit<cr>", desc = "Vertical Split" }
  32. maps.n["\\"] = { "<cmd>split<cr>", desc = "Horizontal Split" }
  33.  
  34. -- Plugin Manager
  35. maps.n["<leader>p"] = sections.p
  36. maps.n["<leader>pi"] = { function() require("lazy").install() end, desc = "Plugins Install" }
  37. maps.n["<leader>ps"] = { function() require("lazy").home() end, desc = "Plugins Status" }
  38. maps.n["<leader>pS"] = { function() require("lazy").sync() end, desc = "Plugins Sync" }
  39. maps.n["<leader>pu"] = { function() require("lazy").check() end, desc = "Plugins Check Updates" }
  40. maps.n["<leader>pU"] = { function() require("lazy").update() end, desc = "Plugins Update" }
  41.  
  42. -- AstroNvim
  43. maps.n["<leader>pa"] = { "<cmd>AstroUpdatePackages<cr>", desc = "Update Plugins and Mason" }
  44. maps.n["<leader>pA"] = { "<cmd>AstroUpdate<cr>", desc = "AstroNvim Update" }
  45. maps.n["<leader>pv"] = { "<cmd>AstroVersion<cr>", desc = "AstroNvim Version" }
  46. maps.n["<leader>pl"] = { "<cmd>AstroChangelog<cr>", desc = "AstroNvim Changelog" }
  47.  
  48. -- Manage Buffers
  49. maps.n["<leader>c"] = { function() require("astronvim.utils.buffer").close() end, desc = "Close buffer" }
  50. maps.n["<leader>C"] = { function() require("astronvim.utils.buffer").close(0, true) end, desc = "Force close buffer" }
  51. maps.n["]b"] =
  52. { function() require("astronvim.utils.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end, desc = "Next buffer" }
  53. maps.n["[b"] = {
  54. function() require("astronvim.utils.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end,
  55. desc = "Previous buffer",
  56. }
  57. maps.n[">b"] = {
  58. function() require("astronvim.utils.buffer").move(vim.v.count > 0 and vim.v.count or 1) end,
  59. desc = "Move buffer tab right",
  60. }
  61. maps.n["<b"] = {
  62. function() require("astronvim.utils.buffer").move(-(vim.v.count > 0 and vim.v.count or 1)) end,
  63. desc = "Move buffer tab left",
  64. }
  65.  
  66. maps.n["<leader>b"] = sections.b
  67. maps.n["<leader>bc"] =
  68. { function() require("astronvim.utils.buffer").close_all(true) end, desc = "Close all buffers except current" }
  69. maps.n["<leader>bC"] = { function() require("astronvim.utils.buffer").close_all() end, desc = "Close all buffers" }
  70. maps.n["<leader>bb"] = {
  71. function()
  72. require("astronvim.utils.status").heirline.buffer_picker(function(bufnr) vim.api.nvim_win_set_buf(0, bufnr) end)
  73. end,
  74. desc = "Select buffer from tabline",
  75. }
  76. maps.n["<leader>bd"] = {
  77. function()
  78. require("astronvim.utils.status").heirline.buffer_picker(
  79. function(bufnr) require("astronvim.utils.buffer").close(bufnr) end
  80. )
  81. end,
  82. desc = "Delete buffer from tabline",
  83. }
  84. maps.n["<leader>bl"] =
  85. { function() require("astronvim.utils.buffer").close_left() end, desc = "Close all buffers to the left" }
  86. maps.n["<leader>br"] =
  87. { function() require("astronvim.utils.buffer").close_right() end, desc = "Close all buffers to the right" }
  88. maps.n["<leader>bs"] = sections.bs
  89. maps.n["<leader>bse"] =
  90. { function() require("astronvim.utils.buffer").sort "extension" end, desc = "Sort by extension (buffers)" }
  91. maps.n["<leader>bsr"] =
  92. { function() require("astronvim.utils.buffer").sort "unique_path" end, desc = "Sort by relative path (buffers)" }
  93. maps.n["<leader>bsp"] =
  94. { function() require("astronvim.utils.buffer").sort "full_path" end, desc = "Sort by full path (buffers)" }
  95. maps.n["<leader>bsi"] =
  96. { function() require("astronvim.utils.buffer").sort "bufnr" end, desc = "Sort by buffer number (buffers)" }
  97. maps.n["<leader>bsm"] =
  98. { function() require("astronvim.utils.buffer").sort "modified" end, desc = "Sort by modification (buffers)" }
  99. maps.n["<leader>b\\"] = {
  100. function()
  101. require("astronvim.utils.status").heirline.buffer_picker(function(bufnr)
  102. vim.cmd.split()
  103. vim.api.nvim_win_set_buf(0, bufnr)
  104. end)
  105. end,
  106. desc = "Horizontal split buffer from tabline",
  107. }
  108. maps.n["<leader>b|"] = {
  109. function()
  110. require("astronvim.utils.status").heirline.buffer_picker(function(bufnr)
  111. vim.cmd.vsplit()
  112. vim.api.nvim_win_set_buf(0, bufnr)
  113. end)
  114. end,
  115. desc = "Vertical split buffer from tabline",
  116. }
  117.  
  118. -- Navigate tabs
  119. maps.n["]t"] = { function() vim.cmd.tabnext() end, desc = "Next tab" }
  120. maps.n["[t"] = { function() vim.cmd.tabprevious() end, desc = "Previous tab" }
  121.  
  122. -- Alpha
  123. if is_available "alpha-nvim" then
  124. maps.n["<leader>h"] = {
  125. function()
  126. local wins = vim.api.nvim_tabpage_list_wins(0)
  127. if #wins > 1 and vim.api.nvim_get_option_value("filetype", { win = wins[1] }) == "neo-tree" then
  128. vim.fn.win_gotoid(wins[2]) -- go to non-neo-tree window to toggle alpha
  129. end
  130. require("alpha").start(false, require("alpha").default_config)
  131. end,
  132. desc = "Home Screen",
  133. }
  134. end
  135.  
  136. -- Comment
  137. if is_available "Comment.nvim" then
  138. maps.n["<leader>/"] = {
  139. function() require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1) end,
  140. desc = "Comment line",
  141. }
  142. maps.v["<leader>/"] =
  143. { "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", desc = "Toggle comment line" }
  144. end
  145.  
  146. -- GitSigns
  147. if is_available "gitsigns.nvim" then
  148. maps.n["<leader>g"] = sections.g
  149. maps.n["]g"] = { function() require("gitsigns").next_hunk() end, desc = "Next Git hunk" }
  150. maps.n["[g"] = { function() require("gitsigns").prev_hunk() end, desc = "Previous Git hunk" }
  151. maps.n["<leader>gl"] = { function() require("gitsigns").blame_line() end, desc = "View Git blame" }
  152. maps.n["<leader>gL"] = { function() require("gitsigns").blame_line { full = true } end, desc = "View full Git blame" }
  153. maps.n["<leader>gp"] = { function() require("gitsigns").preview_hunk() end, desc = "Preview Git hunk" }
  154. maps.n["<leader>gh"] = { function() require("gitsigns").reset_hunk() end, desc = "Reset Git hunk" }
  155. maps.n["<leader>gr"] = { function() require("gitsigns").reset_buffer() end, desc = "Reset Git buffer" }
  156. maps.n["<leader>gs"] = { function() require("gitsigns").stage_hunk() end, desc = "Stage Git hunk" }
  157. maps.n["<leader>gS"] = { function() require("gitsigns").stage_buffer() end, desc = "Stage Git buffer" }
  158. maps.n["<leader>gu"] = { function() require("gitsigns").undo_stage_hunk() end, desc = "Unstage Git hunk" }
  159. maps.n["<leader>gd"] = { function() require("gitsigns").diffthis() end, desc = "View Git diff" }
  160. end
  161.  
  162. -- NeoTree
  163. if is_available "neo-tree.nvim" then
  164. maps.n["<leader>e"] = { "<cmd>Neotree toggle<cr>", desc = "Toggle Explorer" }
  165. maps.n["<leader>o"] = {
  166. function()
  167. if vim.bo.filetype == "neo-tree" then
  168. vim.cmd.wincmd "p"
  169. else
  170. vim.cmd.Neotree "focus"
  171. end
  172. end,
  173. desc = "Toggle Explorer Focus",
  174. }
  175. end
  176.  
  177. -- Session Manager
  178. if is_available "neovim-session-manager" then
  179. maps.n["<leader>S"] = sections.S
  180. maps.n["<leader>Sl"] = { "<cmd>SessionManager! load_last_session<cr>", desc = "Load last session" }
  181. maps.n["<leader>Ss"] = { "<cmd>SessionManager! save_current_session<cr>", desc = "Save this session" }
  182. maps.n["<leader>Sd"] = { "<cmd>SessionManager! delete_session<cr>", desc = "Delete session" }
  183. maps.n["<leader>Sf"] = { "<cmd>SessionManager! load_session<cr>", desc = "Search sessions" }
  184. maps.n["<leader>S."] =
  185. { "<cmd>SessionManager! load_current_dir_session<cr>", desc = "Load current directory session" }
  186. end
  187. if is_available "resession.nvim" then
  188. maps.n["<leader>S"] = sections.S
  189. maps.n["<leader>Sl"] = { function() require("resession").load "Last Session" end, desc = "Load last session" }
  190. maps.n["<leader>Ss"] = { function() require("resession").save() end, desc = "Save this session" }
  191. maps.n["<leader>St"] = { function() require("resession").save_tab() end, desc = "Save this tab's session" }
  192. maps.n["<leader>Sd"] = { function() require("resession").delete() end, desc = "Delete a session" }
  193. maps.n["<leader>Sf"] = { function() require("resession").load() end, desc = "Load a session" }
  194. maps.n["<leader>S."] = {
  195. function() require("resession").load(vim.fn.getcwd(), { dir = "dirsession" }) end,
  196. desc = "Load current directory session",
  197. }
  198. end
  199.  
  200. -- Package Manager
  201. if is_available "mason.nvim" then
  202. maps.n["<leader>pm"] = { "<cmd>Mason<cr>", desc = "Mason Installer" }
  203. maps.n["<leader>pM"] = { "<cmd>MasonUpdateAll<cr>", desc = "Mason Update" }
  204. end
  205.  
  206. -- Smart Splits
  207. if is_available "smart-splits.nvim" then
  208. maps.n["<C-h>"] = { function() require("smart-splits").move_cursor_left() end, desc = "Move to left split" }
  209. maps.n["<C-j>"] = { function() require("smart-splits").move_cursor_down() end, desc = "Move to below split" }
  210. maps.n["<C-k>"] = { function() require("smart-splits").move_cursor_up() end, desc = "Move to above split" }
  211. maps.n["<C-l>"] = { function() require("smart-splits").move_cursor_right() end, desc = "Move to right split" }
  212. maps.n["<C-Up>"] = { function() require("smart-splits").resize_up() end, desc = "Resize split up" }
  213. maps.n["<C-Down>"] = { function() require("smart-splits").resize_down() end, desc = "Resize split down" }
  214. maps.n["<C-Left>"] = { function() require("smart-splits").resize_left() end, desc = "Resize split left" }
  215. maps.n["<C-Right>"] = { function() require("smart-splits").resize_right() end, desc = "Resize split right" }
  216. else
  217. maps.n["<C-h>"] = { "<C-w>h", desc = "Move to left split" }
  218. maps.n["<C-j>"] = { "<C-w>j", desc = "Move to below split" }
  219. maps.n["<C-k>"] = { "<C-w>k", desc = "Move to above split" }
  220. maps.n["<C-l>"] = { "<C-w>l", desc = "Move to right split" }
  221. maps.n["<C-Up>"] = { "<cmd>resize -2<CR>", desc = "Resize split up" }
  222. maps.n["<C-Down>"] = { "<cmd>resize +2<CR>", desc = "Resize split down" }
  223. maps.n["<C-Left>"] = { "<cmd>vertical resize -2<CR>", desc = "Resize split left" }
  224. maps.n["<C-Right>"] = { "<cmd>vertical resize +2<CR>", desc = "Resize split right" }
  225. end
  226.  
  227. -- SymbolsOutline
  228. if is_available "aerial.nvim" then
  229. maps.n["<leader>l"] = sections.l
  230. maps.n["<leader>lS"] = { function() require("aerial").toggle() end, desc = "Symbols outline" }
  231. end
  232.  
  233. -- Telescope
  234. if is_available "telescope.nvim" then
  235. maps.n["<leader>f"] = sections.f
  236. maps.n["<leader>g"] = sections.g
  237. maps.n["<leader>gb"] = { function() require("telescope.builtin").git_branches() end, desc = "Git branches" }
  238. maps.n["<leader>gc"] = { function() require("telescope.builtin").git_commits() end, desc = "Git commits" }
  239. maps.n["<leader>gt"] = { function() require("telescope.builtin").git_status() end, desc = "Git status" }
  240. maps.n["<leader>f<CR>"] = { function() require("telescope.builtin").resume() end, desc = "Resume previous search" }
  241. maps.n["<leader>f'"] = { function() require("telescope.builtin").marks() end, desc = "Find marks" }
  242. maps.n["<leader>fa"] = {
  243. function()
  244. local cwd = vim.fn.stdpath "config" .. "/.."
  245. local search_dirs = {}
  246. for _, dir in ipairs(astronvim.supported_configs) do -- search all supported config locations
  247. if dir == astronvim.install.home then dir = dir .. "/lua/user" end -- don't search the astronvim core files
  248. if vim.fn.isdirectory(dir) == 1 then table.insert(search_dirs, dir) end -- add directory to search if exists
  249. end
  250. if vim.tbl_isempty(search_dirs) then -- if no config folders found, show warning
  251. utils.notify("No user configuration files found", vim.log.levels.WARN)
  252. else
  253. if #search_dirs == 1 then cwd = search_dirs[1] end -- if only one directory, focus cwd
  254. require("telescope.builtin").find_files {
  255. prompt_title = "Config Files",
  256. search_dirs = search_dirs,
  257. cwd = cwd,
  258. } -- call telescope
  259. end
  260. end,
  261. desc = "Find AstroNvim config files",
  262. }
  263. maps.n["<leader>fb"] = { function() require("telescope.builtin").buffers() end, desc = "Find buffers" }
  264. maps.n["<leader>fc"] =
  265. { function() require("telescope.builtin").grep_string() end, desc = "Find for word under cursor" }
  266. maps.n["<leader>fC"] = { function() require("telescope.builtin").commands() end, desc = "Find commands" }
  267. maps.n["<leader>ff"] = { function() require("telescope.builtin").find_files() end, desc = "Find files" }
  268. maps.n["<leader>fF"] = {
  269. function() require("telescope.builtin").find_files { hidden = true, no_ignore = true } end,
  270. desc = "Find all files",
  271. }
  272. maps.n["<leader>fh"] = { function() require("telescope.builtin").help_tags() end, desc = "Find help" }
  273. maps.n["<leader>fk"] = { function() require("telescope.builtin").keymaps() end, desc = "Find keymaps" }
  274. maps.n["<leader>fm"] = { function() require("telescope.builtin").man_pages() end, desc = "Find man" }
  275. if is_available "nvim-notify" then
  276. maps.n["<leader>fn"] =
  277. { function() require("telescope").extensions.notify.notify() end, desc = "Find notifications" }
  278. end
  279. maps.n["<leader>fo"] = { function() require("telescope.builtin").oldfiles() end, desc = "Find history" }
  280. maps.n["<leader>fr"] = { function() require("telescope.builtin").registers() end, desc = "Find registers" }
  281. maps.n["<leader>ft"] =
  282. { function() require("telescope.builtin").colorscheme { enable_preview = true } end, desc = "Find themes" }
  283. maps.n["<leader>fw"] = { function() require("telescope.builtin").live_grep() end, desc = "Find words" }
  284. maps.n["<leader>fW"] = {
  285. function()
  286. require("telescope.builtin").live_grep {
  287. additional_args = function(args) return vim.list_extend(args, { "--hidden", "--no-ignore" }) end,
  288. }
  289. end,
  290. desc = "Find words in all files",
  291. }
  292. maps.n["<leader>l"] = sections.l
  293. maps.n["<leader>lD"] = { function() require("telescope.builtin").diagnostics() end, desc = "Search diagnostics" }
  294. maps.n["<leader>ls"] = {
  295. function()
  296. local aerial_avail, _ = pcall(require, "aerial")
  297. if aerial_avail then
  298. require("telescope").extensions.aerial.aerial()
  299. else
  300. require("telescope.builtin").lsp_document_symbols()
  301. end
  302. end,
  303. desc = "Search symbols",
  304. }
  305. end
  306.  
  307. -- Terminal
  308. if is_available "toggleterm.nvim" then
  309. maps.n["<leader>t"] = sections.t
  310. if vim.fn.executable "lazygit" == 1 then
  311. maps.n["<leader>g"] = sections.g
  312. maps.n["<leader>gg"] = { function() utils.toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" }
  313. maps.n["<leader>tl"] = { function() utils.toggle_term_cmd "lazygit" end, desc = "ToggleTerm lazygit" }
  314. end
  315. if vim.fn.executable "node" == 1 then
  316. maps.n["<leader>tn"] = { function() utils.toggle_term_cmd "node" end, desc = "ToggleTerm node" }
  317. end
  318. if vim.fn.executable "gdu" == 1 then
  319. maps.n["<leader>tu"] = { function() utils.toggle_term_cmd "gdu" end, desc = "ToggleTerm gdu" }
  320. end
  321. if vim.fn.executable "btm" == 1 then
  322. maps.n["<leader>tt"] = { function() utils.toggle_term_cmd "btm" end, desc = "ToggleTerm btm" }
  323. end
  324. local python = vim.fn.executable "python" == 1 and "python" or vim.fn.executable "python3" == 1 and "python3"
  325. if python then maps.n["<leader>tp"] = { function() utils.toggle_term_cmd(python) end, desc = "ToggleTerm python" } end
  326. maps.n["<leader>tf"] = { "<cmd>ToggleTerm direction=float<cr>", desc = "ToggleTerm float" }
  327. maps.n["<leader>th"] = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", desc = "ToggleTerm horizontal split" }
  328. maps.n["<leader>tv"] = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", desc = "ToggleTerm vertical split" }
  329. maps.n["<F7>"] = { "<cmd>ToggleTerm<cr>", desc = "Toggle terminal" }
  330. maps.t["<F7>"] = maps.n["<F7>"]
  331. maps.n["<C-'>"] = maps.n["<F7>"]
  332. maps.t["<C-'>"] = maps.n["<F7>"]
  333. end
  334.  
  335. if is_available "nvim-dap" then
  336. maps.n["<leader>d"] = sections.d
  337. -- modified function keys found with `showkey -a` in the terminal to get key code
  338. -- run `nvim -V3log +quit` and search through the "Terminal info" in the `log` file for the correct keyname
  339. maps.n["<F5>"] = { function() require("dap").continue() end, desc = "Debugger: Start" }
  340. maps.n["<F17>"] = { function() require("dap").terminate() end, desc = "Debugger: Stop" } -- Shift+F5
  341. maps.n["<F29>"] = { function() require("dap").restart_frame() end, desc = "Debugger: Restart" } -- Control+F5
  342. maps.n["<F6>"] = { function() require("dap").pause() end, desc = "Debugger: Pause" }
  343. maps.n["<F9>"] = { function() require("dap").toggle_breakpoint() end, desc = "Debugger: Toggle Breakpoint" }
  344. maps.n["<F10>"] = { function() require("dap").step_over() end, desc = "Debugger: Step Over" }
  345. maps.n["<F11>"] = { function() require("dap").step_into() end, desc = "Debugger: Step Into" }
  346. maps.n["<F23>"] = { function() require("dap").step_out() end, desc = "Debugger: Step Out" } -- Shift+F11
  347. maps.n["<leader>db"] = { function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint (F9)" }
  348. maps.n["<leader>dB"] = { function() require("dap").clear_breakpoints() end, desc = "Clear Breakpoints" }
  349. maps.n["<leader>dc"] = { function() require("dap").continue() end, desc = "Start/Continue (F5)" }
  350. maps.n["<leader>di"] = { function() require("dap").step_into() end, desc = "Step Into (F11)" }
  351. maps.n["<leader>do"] = { function() require("dap").step_over() end, desc = "Step Over (F10)" }
  352. maps.n["<leader>dO"] = { function() require("dap").step_out() end, desc = "Step Out (S-F11)" }
  353. maps.n["<leader>dq"] = { function() require("dap").close() end, desc = "Close Session" }
  354. maps.n["<leader>dQ"] = { function() require("dap").terminate() end, desc = "Terminate Session (S-F5)" }
  355. maps.n["<leader>dp"] = { function() require("dap").pause() end, desc = "Pause (F6)" }
  356. maps.n["<leader>dr"] = { function() require("dap").restart_frame() end, desc = "Restart (C-F5)" }
  357. maps.n["<leader>dR"] = { function() require("dap").repl.toggle() end, desc = "Toggle REPL" }
  358. if is_available "nvim-dap-ui" then
  359. maps.n["<leader>du"] = { function() require("dapui").toggle() end, desc = "Toggle Debugger UI" }
  360. maps.n["<leader>dh"] = { function() require("dap.ui.widgets").hover() end, desc = "Debugger Hover" }
  361. end
  362. end
  363.  
  364. -- Improved Code Folding
  365. if is_available "nvim-ufo" then
  366. maps.n["zR"] = { function() require("ufo").openAllFolds() end, desc = "Open all folds" }
  367. maps.n["zM"] = { function() require("ufo").closeAllFolds() end, desc = "Close all folds" }
  368. maps.n["zr"] = { function() require("ufo").openFoldsExceptKinds() end, desc = "Fold less" }
  369. maps.n["zm"] = { function() require("ufo").closeFoldsWith() end, desc = "Fold more" }
  370. maps.n["zp"] = { function() require("ufo").peekFoldedLinesUnderCursor() end, desc = "Peek fold" }
  371. end
  372.  
  373. -- Stay in indent mode
  374. maps.v["<S-Tab>"] = { "<gv", desc = "unindent line" }
  375. maps.v["<Tab>"] = { ">gv", desc = "indent line" }
  376.  
  377. -- Improved Terminal Navigation
  378. maps.t["<C-h>"] = { "<cmd>wincmd h<cr>", desc = "Terminal left window navigation" }
  379. maps.t["<C-j>"] = { "<cmd>wincmd j<cr>", desc = "Terminal down window navigation" }
  380. maps.t["<C-k>"] = { "<cmd>wincmd k<cr>", desc = "Terminal up window navigation" }
  381. maps.t["<C-l>"] = { "<cmd>wincmd l<cr>", desc = "Terminal right window navigation" }
  382.  
  383. maps.n["<leader>u"] = sections.u
  384. -- Custom menu for modification of the user experience
  385. if is_available "nvim-autopairs" then maps.n["<leader>ua"] = { ui.toggle_autopairs, desc = "Toggle autopairs" } end
  386. maps.n["<leader>ub"] = { ui.toggle_background, desc = "Toggle background" }
  387. if is_available "nvim-cmp" then maps.n["<leader>uc"] = { ui.toggle_cmp, desc = "Toggle autocompletion" } end
  388. if is_available "nvim-colorizer.lua" then
  389. maps.n["<leader>uC"] = { "<cmd>ColorizerToggle<cr>", desc = "Toggle color highlight" }
  390. end
  391. maps.n["<leader>ud"] = { ui.toggle_diagnostics, desc = "Toggle diagnostics" }
  392. maps.n["<leader>ug"] = { ui.toggle_signcolumn, desc = "Toggle signcolumn" }
  393. maps.n["<leader>ui"] = { ui.set_indent, desc = "Change indent setting" }
  394. maps.n["<leader>ul"] = { ui.toggle_statusline, desc = "Toggle statusline" }
  395. maps.n["<leader>uL"] = { ui.toggle_codelens, desc = "Toggle CodeLens" }
  396. maps.n["<leader>un"] = { ui.change_number, desc = "Change line numbering" }
  397. maps.n["<leader>uN"] = { ui.toggle_ui_notifications, desc = "Toggle UI notifications" }
  398. maps.n["<leader>up"] = { ui.toggle_paste, desc = "Toggle paste mode" }
  399. maps.n["<leader>us"] = { ui.toggle_spell, desc = "Toggle spellcheck" }
  400. maps.n["<leader>uS"] = { ui.toggle_conceal, desc = "Toggle conceal" }
  401. maps.n["<leader>ut"] = { ui.toggle_tabline, desc = "Toggle tabline" }
  402. maps.n["<leader>uu"] = { ui.toggle_url_match, desc = "Toggle URL highlight" }
  403. maps.n["<leader>uw"] = { ui.toggle_wrap, desc = "Toggle wrap" }
  404. maps.n["<leader>uy"] = { ui.toggle_syntax, desc = "Toggle syntax highlight" }
  405. maps.n["<leader>uh"] = { ui.toggle_foldcolumn, desc = "Toggle foldcolumn" }
  406.  
  407. utils.set_mappings(astronvim.user_opts("mappings", maps))
  408.  
  409. return {
  410. n = {
  411. -- Your other normal mode mappings here
  412. ["<leader>pd"] = {":echo expand('%:p:h')<CR>", "Print parent directory"},
  413. },
  414. -- other mode mappings
  415. }
  416.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement