Add telescope and trouble bindings

This commit is contained in:
Citlali del Rey 2023-09-18 16:45:48 -07:00
parent fafcee66b1
commit e6896269f8
Signed by: nullobsi
GPG Key ID: 933A1F44222C2634
3 changed files with 143 additions and 120 deletions

View File

@ -1,7 +1,10 @@
let g:mapleader = ","
lua require('plugins')
lua require('lsp')
nmap <silent> <c-k> :wincmd k<CR>
map <silent> <c-k> :wincmd k<CR>
nmap <silent> <c-j> :wincmd j<CR>
nmap <silent> <c-h> :wincmd h<CR>
nmap <silent> <c-l> :wincmd l<CR>
@ -25,25 +28,8 @@ autocmd BufLeave term://* stopinsert
nnoremap <silent> <C-A-t> <Cmd>Terminal<CR>
" Move to previous/next
nnoremap <silent> <A-,> <Cmd>BufferPrevious<CR>
nnoremap <silent> <A-.> <Cmd>BufferNext<CR>
" Re-order to previous/next
nnoremap <silent> <A-<> <Cmd>BufferMovePrevious<CR>
nnoremap <silent> <A->> <Cmd>BufferMoveNext<CR>
nnoremap <silent> <A-1> <Cmd>BufferGoto 1<CR>
nnoremap <silent> <A-2> <Cmd>BufferGoto 2<CR>
nnoremap <silent> <A-3> <Cmd>BufferGoto 3<CR>
nnoremap <silent> <A-4> <Cmd>BufferGoto 4<CR>
nnoremap <silent> <A-5> <Cmd>BufferGoto 5<CR>
nnoremap <silent> <A-6> <Cmd>BufferGoto 6<CR>
nnoremap <silent> <A-7> <Cmd>BufferGoto 7<CR>
nnoremap <silent> <A-8> <Cmd>BufferGoto 8<CR>
nnoremap <silent> <A-9> <Cmd>BufferGoto 9<CR>
nnoremap <silent> <A-0> <Cmd>BufferLast<CR>
" Pin/unpin buffer
nnoremap <silent> <A-p> <Cmd>BufferPin<CR>
" Close buffer
nnoremap <silent> <A-c> <Cmd>BufferClose<CR>
nnoremap <silent> <A-,> <Cmd>bprevious<CR>
nnoremap <silent> <A-.> <Cmd>bnext<CR>
" Wipeout buffer
" :BufferWipeout
" Close commands
@ -104,3 +90,22 @@ let g:neovide_floating_blur_amount_y = 2.0
let g:neovide_floating_opacity = 60
set guifont=SFMono\ Nerd\ Font
sign define DiagnosticSignError text=texthl=DiagnosticSignError linehl= numhl=DiagnosticSignError
sign define DiagnosticSignWarn text=texthl=DiagnosticSignWarn linehl= numhl=DiagnosticSignWarn
sign define DiagnosticSignInfo text=texthl=DiagnosticSignInfo linehl= numhl=DiagnosticSignInfo
sign define DiagnosticSignHint text=texthl=DiagnosticSignHint linehl= numhl=DiagnosticSignHint
" Trouble
nnoremap <leader>xx <cmd>TroubleToggle<cr>
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<cr>
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
nnoremap gR <cmd>TroubleToggle lsp_references<cr>
" Telescope
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>

View File

@ -1,10 +1,10 @@
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap = true, silent = true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts)
local navic = require("nvim-navic")
@ -22,22 +22,31 @@ local on_attach = function(client, bufnr)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wl', function()
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', function ()
vim.keymap.set('n', '<leader>f', function()
vim.lsp.buf.format({ async = true })
end, bufopts)
if client.server_capabilities.documentSymbolProvider then
navic.attach(client, bufnr)
end
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = {
prefix = "",
spacing = 4,
},
signs = true,
underline = true,
})
end
local lsp_flags = {
@ -101,6 +110,9 @@ cmp.setup.cmdline(':', {
})
})
require "neodev".setup {
}
mason.setup()
mason_lspconfig.setup()
@ -121,8 +133,3 @@ mason_lspconfig.setup_handlers {
lspconfig[server_name].setup {}
end,
}
--for _, server in ipairs(lsp_installer.get_installed_servers()) do
-- lspconfig[server.name].setup {}
--end

View File

@ -7,10 +7,9 @@ require('packer').startup(function(use)
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
use { "ellisonleao/gruvbox.nvim" }
use 'neovim/nvim-lspconfig' -- Configurations for Nvim LSP
use{
use {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
}
@ -60,58 +59,64 @@ require('packer').startup(function(use)
--use 'vim-airline/vim-airline-themes'
use 'lervag/vimtex'
use 'folke/neodev.nvim'
use 'kosayoda/nvim-lightbulb'
use {
'nvim-telescope/telescope.nvim', tag = '0.1.x',
requires = { { 'nvim-lua/plenary.nvim' } }
}
end)
require("gruvbox").setup({
undercurl = true,
underline = true,
bold = true,
italic = {
strings = true,
comments = true,
},
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "soft", -- can be "hard", "soft" or empty string
overrides = {},
undercurl = true,
underline = true,
bold = true,
italic = {
strings = true,
comments = true,
},
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "soft", -- can be "hard", "soft" or empty string
overrides = {},
})
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = "all",
require 'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = "all",
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
auto_install = true,
-- Automatically install missing parsers when entering buffer
auto_install = true,
-- List of parsers to ignore installing (for "all")
ignore_install = { "phpdoc" },
-- List of parsers to ignore installing (for "all")
ignore_install = { "phpdoc" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
-- `false` will disable the whole extension
enable = true,
highlight = {
-- `false` will disable the whole extension
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = { },
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = {},
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}
@ -138,10 +143,12 @@ require('lualine').setup {
options = {
icons_enabled = true,
theme = 'gruvbox',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {},
statusline = {
"neo-tree",
},
winbar = {
"help",
"startify",
@ -149,6 +156,7 @@ require('lualine').setup {
"packer",
"neogitstatus",
"NvimTree",
"neo-tree",
"Trouble",
"alpha",
"lir",
@ -167,18 +175,18 @@ require('lualine').setup {
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
lualine_a = { 'mode' },
lualine_b = { 'diff', 'diagnostics' },
lualine_c = { 'filename' },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {},
},
@ -192,13 +200,13 @@ require('lualine').setup {
lualine_b = {
"branch"
},
lualine_c = {'hostname'},
lualine_c = { 'hostname' },
lualine_x = {},
lualine_y = {},
lualine_z = {'tabs', 'datetime'},
lualine_z = { 'tabs', 'datetime' },
},
winbar = {
lualine_a = {'searchcount'},
lualine_a = { 'searchcount' },
lualine_b = {},
lualine_c = {
"filename",
@ -221,35 +229,38 @@ require('lualine').setup {
},
extensions = {}
}
require'nvim-navic'.setup {
icons = {
File = '',
Module = '',
Namespace = '',
Package = '',
Class = '',
Method = '',
Property = '',
Field = '',
Constructor = '',
Enum = '',
Interface = '',
Function = '',
Variable = '',
Constant = '',
String = '',
Number = '',
Boolean = '',
Array = '',
Object = '',
Key = '',
Null = '',
EnumMember = '',
Struct = '',
Event = '',
Operator = '',
TypeParameter = '',
},
separator = '',
require 'nvim-navic'.setup {
icons = {
File = '',
Module = '',
Namespace = '',
Package = '',
Class = '',
Method = '',
Property = '',
Field = '',
Constructor = '',
Enum = '',
Interface = '',
Function = '',
Variable = '',
Constant = '',
String = '',
Number = '',
Boolean = '',
Array = '',
Object = '',
Key = '',
Null = '',
EnumMember = '',
Struct = '',
Event = '',
Operator = '',
TypeParameter = '',
},
separator = '',
}
require 'nvim-lightbulb'.setup {
autocmd = { enabled = true }
}