Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

n-p-e/autocmd-lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Archived because the lua_autocmd is merged. Update to latest Neovim nightly to use it.

autocmd-lua: Define Neovim autocommands without pain

Install

use 'jakelinnzy/autocmd-lua'

Example

require('autocmd-lua').augroup {
  group = 'test_group',
  autocmds = {
    { event = 'FileType', pattern = 'lua', cmd = function() vim.opt.sw = 2 end },
    -- the keys above are optional
    { 'BufReadPost', '*', 'echom "hello"'},
  },
}
-- OR
require('autocmd-lua').augroup {
  -- the keys `group` and `autocmds` are also optional
  'filetype_commands',
  {{
    'FileType', {
      lua = function() do_something end,
      markdown = 'set sw=2',
      -- these keys are passed as the pattern
      ['help,man'] = 'nmap q :q<CR>',
    }
  }}
}

Features

  • Pass a lua function or a vimL string (which is passed to vim.cmd)
  • Does au! for you so no duplicate commands
  • Alternative syntax to define multiple commands for an event
  • No dependencies

Planned

  • Support <amatch> in callback

About

Define Neovim autocommands without pain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published