nvim-lua / kickstart.nvim

A launch point for your personal nvim configuration
MIT License
16.69k stars 16.61k forks source link

How to set symbol_width for lsp_document_symbol in init.lua #993

Closed sayo9394 closed 1 week ago

sayo9394 commented 1 week ago

When displaying the document symbols, the first column, the symbols names, is truncated and one can barely see the names of the functions as can be seen in image below. image

I was able to fix this by the following command: :lua require('telescope.builtin').lsp_document_symbols({fname_width = 0.5,symbol_width=0.75}) image

how can i change init.lua to make the above setting be the default behaviour.

I added the above line in the init file with no effect... I'm quite new at neovim, and still trying to get my head around the kickstart project.

cheers, Simon

sayo9394 commented 1 week ago

I've manage to get this done by creating a new map function that takes in arguments as such;

-- Define the map function with support for arguments
local map_lsp_document = function(keys, func, desc, args)
  vim.keymap.set('n', keys, function()
    func(args)
  end, { buffer = event.buf, desc = 'LSP: ' .. desc })
end

map_lsp_document('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols', { fname_width = 0.5, symbol_width = 0.75 })