1

I am using NVChad and have configured my plugins correctly, everything works as expected.

When I write JS code, I can hit <leader>fm to format using my LSP, and I made a custom binding to organize imports on <leader>fl :

local M = {}

M.disabled = {
  ...
}

M.custom = {
  n = {
    ...,
    ['<leader>fl'] = { '<C-c>:OrganizeImports<CR>', 'Organize imports' },
  },
  i = {
    ...
  },
}

return M

What I would like to achieve, is to hit a mapping that run both commands one after the other (organize, then format). I want to be clear on that point, the first command has to wait for the other one to finish before executing.

How should I proceed ? And also, where should I write this code ? My structure is as follows :

lua
    custom
    │ configs
    │ │ │ lspconfig.lua
    │ │ │ null-ls.lua
    │ │ chadrc.lua
    │ │ init.lua
    │ │ mappings.lua
    │ │ plugins.lua
MGX
  • 2,534
  • 2
  • 14

0 Answers0