SuperBo / fugit2.nvim

Neovim git GUI powered by libgit2
MIT License
333 stars 7 forks source link

feature: add filetype to views #78

Closed sudo-tee closed 2 weeks ago

sudo-tee commented 2 weeks ago

Did you check the docs?

Is your feature request related to a problem? Please describe.

I would like to be able to add my own autocommands / keymaps based on filetype

eg: when checking the filetype of fugitive :=vim.bo.filetype I get fugitive.

this allows me to to add ftplugins or autocommands to different window.

vim.api.nvim_create_autocmd('FileType', {
  group = augroup('close_with_q'),
  desc = 'Close with <q>',
  pattern = {
    'fugitive',
    'fugitiveblame',
    'lspinfo',
    'help',
    'man',
    'qf',
    'query',
    'scratch',
    'spectre_panel',
    'neo-tree',
    'lazy',
    'checkhealth',
    'neotest-summary',
    'neotest-output',
    'neotest-output-panel',
  },
  callback = function(args)
    vim.keymap.set('n', 'q', '<cmd>quit<cr>', { buffer = args.buf })
    vim.keymap.set({ 'n' }, '<ESC>', '<cmd>close<CR>', { silent = true, buffer = true })
  end,
})

Describe the solution you'd like

simply by adding a filetype to different views eg:

'fugit2-log' 'fugit2-log-diff' 'fugit2-blame' 'fugit2-graph' 'fugit2-graph-branches' etc.

Describe alternatives you've considered

none.

Additional context

I think that by adding filetype will add more flexibility.

Thanks for your amazing plugin. It is really nice to see the plugin taking shape :)

SuperBo commented 2 weeks ago

@sudo-tee, hi, it's nice suggestion, I didn't think about this when I first developed this plugin. Will update it tomorrow.

SuperBo commented 2 weeks ago

hi @sudo-tee, filetype already added via https://github.com/SuperBo/fugit2.nvim/pull/80.

Added filetypes: