dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

mappings.lua (1155B)


      1 local map = function(keys, func, desc, mode)
      2   mode = mode or 'n'
      3   vim.keymap.set(mode, keys, func, { desc = desc })
      4 end
      5 local diag = vim.diagnostic
      6 
      7 -- Diagnostic keymaps
      8 map('[d', function() diag.jump({ count = -1, float = true }) end, 'Previous diagnostic')
      9 map(']d', function() diag.jump({ count = 1, float = true }) end, 'Next diagnostic')
     10 map('[e', function()
     11   diag.jump({ count = -1, float = true, severity = diag.severity.ERROR })
     12 end, 'Previous error')
     13 map(']e', function()
     14   diag.jump({ count = 1, float = true, severity = diag.severity.ERROR })
     15 end, 'Next error')
     16 map('[e', function()
     17   diag.jump({ count = -1, float = true, severity = diag.severity.WARN })
     18 end, 'Previous warning')
     19 map(']e', function()
     20   diag.jump({ count = 1, float = true, severity = diag.severity.WARN })
     21 end, 'Next warning')
     22 
     23 map('<leader>e', diag.open_float, 'Show errors')
     24 map('<leader>q', function() diag.setloclist({ severity = diag.severity.ERROR }) end, 'Errors to quickfix')
     25 
     26 -- 'i' that indents correctly on empty lines
     27 vim.keymap.set('n', 'i', function()
     28   if #vim.fn.getline(".") == 0 then
     29     return [["_cc]]
     30   else
     31     return "i"
     32   end
     33 end, { expr = true })