nvim-config

Log | Files | Refs | README

c.lua (1032B)


      1 vim.opt_local.expandtab = true
      2 vim.opt_local.textwidth = 100
      3 vim.opt_local.foldmethod = "expr"
      4 -- vim.opt_local.foldexpr = "nvim_treesitter#foldexpr()"
      5 vim.opt_local.foldlevel = 0
      6 vim.opt_local.comments:prepend(":///")
      7 vim.opt_local.commentstring = "//%s"
      8 
      9 -- if !empty(findfile('src/uncrustify.cfg', ';')) && executable("uncrustify")
     10 --   setlocal formatprg=uncrustify\ -q\ -l\ C\ -c\ src/uncrustify.cfg\ --no-backup
     11 -- endif
     12 
     13 vim.keymap.set("n", "<Leader><Leader>", function()
     14   local bufnr = vim.api.nvim_get_current_buf()
     15   local clangd_client = vim.lsp.get_active_clients { bufnr = bufnr, name = 'clangd' }[1]
     16   local params = { uri = vim.uri_from_bufnr(bufnr) }
     17   if clangd_client then
     18     clangd_client.request('textDocument/switchSourceHeader', params, function(err, result)
     19       if err then
     20         return
     21       end
     22       if not result then
     23         print 'Corresponding file cannot be determined'
     24         return
     25       end
     26       vim.cmd.edit(vim.uri_to_fname(result))
     27     end, bufnr)
     28   end
     29 end,
     30   {
     31     buffer = true,
     32   })