neovim

Personal neovim configuration files
git clone git://gtms.dev:neovim
Log | Files | Refs

init.lua (1659B)


      1 local utils = require 'actions.utils'
      2 local my_utils = require('tms.p.actions.predicates')
      3 local M = {}
      4 
      5 local actions = {}
      6 local mappings = {['n <leader>dr'] = 'run', ['n <leader>dt'] = 'test', ['n <leader>db'] = 'build'}
      7 
      8 -- general actions
      9 local function make(_) vim.cmd [[make]] end
     10 
     11 -- helpers
     12 local add = function(action) table.insert(actions, action) end
     13 
     14 -- make_language_predicated
     15 local add_lang = function(lang, a) add {predicate = utils.make_language_predicate(lang), actions = a} end
     16 
     17 -- make_git_predicate
     18 local add_git = function(project, escape, a)
     19   if type(escape) == 'table' then
     20     a = escape
     21     escape = false
     22   end
     23   add {predicate = my_utils.make_git_predicate(project, escape), actions = a}
     24 end
     25 
     26 M.setup = function()
     27   add_lang('dart', {
     28     run = make,
     29     build = function(_) -- analyze
     30       require('tms.ft.dart.analyze').qf2103()
     31     end,
     32   })
     33   add_lang('lua', {run = make})
     34   add_lang('go', {
     35     run = function(_)
     36       vim.cmd [[set makeprg=go\ run\ %]]
     37       vim.cmd [[make]]
     38       vim.cmd [[comp go]]
     39     end,
     40     test = function(_)
     41       vim.cmd [[set makeprg=go\ test]]
     42       vim.cmd [[make]]
     43       vim.cmd [[comp go]]
     44     end,
     45     build = make,
     46   })
     47   add_lang('zsh', {
     48     run = function(_)
     49       vim.cmd [[set makeprg=./%]]
     50       vim.cmd [[set efm=%f:%.%#:%l:\ %m,%f:%l:\ %m,%-G%.%#]]
     51       vim.cmd [[make]]
     52       vim.cmd [[comp zsh]]
     53     end,
     54     build = make,
     55   })
     56   add_lang('gdscript',
     57            {run = function(_) vim.cmd [[GodotRun]] end, build = function(_) vim.api.nvim_input(':GodotRun ') end})
     58   add_lang('sh', {run = make})
     59 
     60   actions.mappings = mappings
     61   require('actions'):setup(actions)
     62 end
     63 
     64 return M