neovim

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

json.lua (660B)


      1 vim.keymap.set('n', 'gO', '<cmd>Json<cr>')
      2 
      3 if vim.fn.exists '+winbar' then
      4   vim.opt_local.winbar = '%{luaeval(\'require\"tms.p.jsonpath\".get()\')} %=%f'
      5 end
      6 
      7 vim.keymap.set('n', 'y<c-p>', function()
      8   vim.fn.setreg('+', require 'tms.p.jsonpath'.get())
      9 end, { buffer = true, desc = 'Yank Json Path' })
     10 
     11 local schemas
     12 if pcall(require, 'schemastore') then
     13   schemas = require 'schemastore'.json.schemas()
     14 end
     15 
     16 vim.lsp.start {
     17   name = 'jsonls',
     18   cmd = { 'vscode-json-language-server', '--stdio' },
     19   capabilities = require 'tms.lsp'.capabilities(),
     20   root_dir = vim.fn.getcwd(),
     21   settings = { json = { schemas = schemas, validate = { enable = true } } },
     22 }