Skip to content

Commit ca56ba7

Browse files
author
Anish Moorthy
committed
More LSP stuff
1 parent 67d2928 commit ca56ba7

1 file changed

Lines changed: 13 additions & 23 deletions

File tree

init.lua

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ Kickstart Guide:
2525
2626
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
2727
28-
If you don't know what this means, type the following:
29-
- <escape key>
30-
- :
31-
- Tutor
32-
- <enter key>
33-
34-
(If you already know the Neovim basics, you can skip this step.)
35-
3628
Once you've completed that, you can continue working through **AND READING** the rest
3729
of the kickstart init.lua.
3830
@@ -80,7 +72,7 @@ vim.g.have_nerd_font = false
8072
vim.o.number = true
8173
-- You can also add relative line numbers, to help with jumping.
8274
-- Experiment for yourself to see if you like it!
83-
-- vim.o.relativenumber = true
75+
vim.o.relativenumber = true
8476

8577
-- Enable mouse mode, can be useful for resizing splits for example!
8678
-- TODO: I may want to re-enable this later once clipboard sharing is set up
@@ -183,7 +175,7 @@ vim.keymap.set('n', '<leader>fs', '<cmd>:w<CR>', { desc = '[F]ile [S]ave' })
183175
-- clangd is set up differently than all of the other LSPs due to
184176
-- https://github.com/mason-org/mason.nvim/issues/1578?
185177
vim.lsp.config('clangd', {
186-
cmd = { 'clangd' },
178+
cmd = { 'clangd', '--background-index', '--limit-references=1000', '--limit-results=1000' },
187179
root_markers = { '.clangd', 'compile_commands.json' },
188180
filetypes = { 'c', 'cpp', 'cc' },
189181
})
@@ -441,7 +433,9 @@ require('lazy').setup({
441433
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
442434
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
443435
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
444-
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
436+
vim.keymap.set('n', '<leader>pf', builtin.git_files, { desc = '[P]earch [F]iles' })
437+
vim.keymap.set('n', '<leader>bi', builtin.buffers, { desc = '[P]earch [F]iles' })
438+
vim.keymap.set('n', '<leader>*', builtin.live_grep, { desc = '[S]earch by [G]rep' })
445439

446440
-- Slightly advanced example of overriding default behavior and theme
447441
vim.keymap.set('n', '<leader>/', function()
@@ -526,24 +520,20 @@ require('lazy').setup({
526520

527521
-- Execute a code action, usually your cursor needs to be on top of an error
528522
-- or a suggestion from your LSP for this to activate.
529-
map('<localleader>ga', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
530-
map('<localleader>gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
531-
map('<localleader>gi', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
523+
map('<localleader>a', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
524+
map('<localleader>r', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
525+
map('<localleader>i', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
532526
-- Jump to the definition of the word under your cursor.
533527
-- This is where a variable was first declared, or where a function is defined, etc.
534528
-- To jump back, press <C-t>.
535-
map('<localleader>gg', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
536-
map('<localleader>gd', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
537-
-- Fuzzy find all the symbols in your current document.
538-
-- Symbols are things like variables, functions, types, etc.
539-
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
540-
-- Fuzzy find all the symbols in your current workspace.
541-
-- Similar to document symbols, except searches over your entire project.
542-
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
529+
map('<localleader>d', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
530+
map('<localleader>D', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
531+
map('<localleader>s', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[S]ymbols')
532+
map('<localleader>S', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
543533
-- Jump to the type of the word under your cursor.
544534
-- Useful when you're not sure what type a variable is and you want to see
545535
-- the definition of its *type*, not where it was *defined*.
546-
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
536+
map('<localleader>t', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
547537

548538
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
549539
---@param client vim.lsp.Client

0 commit comments

Comments
 (0)