Add telescope and trouble bindings
This commit is contained in:
parent
fafcee66b1
commit
e6896269f8
|
@ -1,7 +1,10 @@
|
||||||
|
let g:mapleader = ","
|
||||||
|
|
||||||
lua require('plugins')
|
lua require('plugins')
|
||||||
lua require('lsp')
|
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-j> :wincmd j<CR>
|
||||||
nmap <silent> <c-h> :wincmd h<CR>
|
nmap <silent> <c-h> :wincmd h<CR>
|
||||||
nmap <silent> <c-l> :wincmd l<CR>
|
nmap <silent> <c-l> :wincmd l<CR>
|
||||||
|
@ -25,25 +28,8 @@ autocmd BufLeave term://* stopinsert
|
||||||
nnoremap <silent> <C-A-t> <Cmd>Terminal<CR>
|
nnoremap <silent> <C-A-t> <Cmd>Terminal<CR>
|
||||||
|
|
||||||
" Move to previous/next
|
" Move to previous/next
|
||||||
nnoremap <silent> <A-,> <Cmd>BufferPrevious<CR>
|
nnoremap <silent> <A-,> <Cmd>bprevious<CR>
|
||||||
nnoremap <silent> <A-.> <Cmd>BufferNext<CR>
|
nnoremap <silent> <A-.> <Cmd>bnext<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>
|
|
||||||
" Wipeout buffer
|
" Wipeout buffer
|
||||||
" :BufferWipeout
|
" :BufferWipeout
|
||||||
" Close commands
|
" Close commands
|
||||||
|
@ -104,3 +90,22 @@ let g:neovide_floating_blur_amount_y = 2.0
|
||||||
let g:neovide_floating_opacity = 60
|
let g:neovide_floating_opacity = 60
|
||||||
|
|
||||||
set guifont=SFMono\ Nerd\ Font
|
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>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
local opts = { noremap = true, silent = true }
|
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_prev, opts)
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, 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")
|
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', 'K', vim.lsp.buf.hover, bufopts)
|
||||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, 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', '<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', '<leader>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', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||||
vim.keymap.set('n', '<space>wl', function()
|
vim.keymap.set('n', '<leader>wl', function()
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
end, bufopts)
|
end, bufopts)
|
||||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, 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', '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 })
|
vim.lsp.buf.format({ async = true })
|
||||||
end, bufopts)
|
end, bufopts)
|
||||||
|
|
||||||
if client.server_capabilities.documentSymbolProvider then
|
if client.server_capabilities.documentSymbolProvider then
|
||||||
navic.attach(client, bufnr)
|
navic.attach(client, bufnr)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
local lsp_flags = {
|
local lsp_flags = {
|
||||||
|
@ -101,6 +110,9 @@ cmp.setup.cmdline(':', {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
require "neodev".setup {
|
||||||
|
}
|
||||||
|
|
||||||
mason.setup()
|
mason.setup()
|
||||||
mason_lspconfig.setup()
|
mason_lspconfig.setup()
|
||||||
|
|
||||||
|
@ -121,8 +133,3 @@ mason_lspconfig.setup_handlers {
|
||||||
lspconfig[server_name].setup {}
|
lspconfig[server_name].setup {}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--for _, server in ipairs(lsp_installer.get_installed_servers()) do
|
|
||||||
-- lspconfig[server.name].setup {}
|
|
||||||
--end
|
|
||||||
|
|
|
@ -7,10 +7,9 @@ require('packer').startup(function(use)
|
||||||
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
|
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
|
||||||
|
|
||||||
use { "ellisonleao/gruvbox.nvim" }
|
use { "ellisonleao/gruvbox.nvim" }
|
||||||
|
|
||||||
use 'neovim/nvim-lspconfig' -- Configurations for Nvim LSP
|
use 'neovim/nvim-lspconfig' -- Configurations for Nvim LSP
|
||||||
|
|
||||||
use{
|
use {
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
"williamboman/mason-lspconfig.nvim",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
}
|
}
|
||||||
|
@ -60,58 +59,64 @@ require('packer').startup(function(use)
|
||||||
--use 'vim-airline/vim-airline-themes'
|
--use 'vim-airline/vim-airline-themes'
|
||||||
|
|
||||||
use 'lervag/vimtex'
|
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)
|
end)
|
||||||
|
|
||||||
require("gruvbox").setup({
|
require("gruvbox").setup({
|
||||||
undercurl = true,
|
undercurl = true,
|
||||||
underline = true,
|
underline = true,
|
||||||
bold = true,
|
bold = true,
|
||||||
italic = {
|
italic = {
|
||||||
strings = true,
|
strings = true,
|
||||||
comments = true,
|
comments = true,
|
||||||
},
|
},
|
||||||
strikethrough = true,
|
strikethrough = true,
|
||||||
invert_selection = false,
|
invert_selection = false,
|
||||||
invert_signs = false,
|
invert_signs = false,
|
||||||
invert_tabline = false,
|
invert_tabline = false,
|
||||||
invert_intend_guides = false,
|
invert_intend_guides = false,
|
||||||
inverse = true, -- invert background for search, diffs, statuslines and errors
|
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||||
contrast = "soft", -- can be "hard", "soft" or empty string
|
contrast = "soft", -- can be "hard", "soft" or empty string
|
||||||
overrides = {},
|
overrides = {},
|
||||||
})
|
})
|
||||||
|
|
||||||
require'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
-- A list of parser names, or "all"
|
-- A list of parser names, or "all"
|
||||||
ensure_installed = "all",
|
ensure_installed = "all",
|
||||||
|
|
||||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
|
|
||||||
-- Automatically install missing parsers when entering buffer
|
-- Automatically install missing parsers when entering buffer
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
|
|
||||||
-- List of parsers to ignore installing (for "all")
|
-- List of parsers to ignore installing (for "all")
|
||||||
ignore_install = { "phpdoc" },
|
ignore_install = { "phpdoc" },
|
||||||
|
|
||||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
---- 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")!
|
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||||
|
|
||||||
highlight = {
|
highlight = {
|
||||||
-- `false` will disable the whole extension
|
-- `false` will disable the whole extension
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|
||||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
-- 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
|
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||||
-- the name of the parser)
|
-- the name of the parser)
|
||||||
-- list of language that will be disabled
|
-- list of language that will be disabled
|
||||||
disable = { },
|
disable = {},
|
||||||
|
|
||||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
-- 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).
|
-- 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.
|
-- 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
|
-- Instead of true it can also be a list of languages
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,10 +143,12 @@ require('lualine').setup {
|
||||||
options = {
|
options = {
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
theme = 'gruvbox',
|
theme = 'gruvbox',
|
||||||
component_separators = { left = '', right = ''},
|
component_separators = { left = '', right = '' },
|
||||||
section_separators = { left = '', right = ''},
|
section_separators = { left = '', right = '' },
|
||||||
disabled_filetypes = {
|
disabled_filetypes = {
|
||||||
statusline = {},
|
statusline = {
|
||||||
|
"neo-tree",
|
||||||
|
},
|
||||||
winbar = {
|
winbar = {
|
||||||
"help",
|
"help",
|
||||||
"startify",
|
"startify",
|
||||||
|
@ -149,6 +156,7 @@ require('lualine').setup {
|
||||||
"packer",
|
"packer",
|
||||||
"neogitstatus",
|
"neogitstatus",
|
||||||
"NvimTree",
|
"NvimTree",
|
||||||
|
"neo-tree",
|
||||||
"Trouble",
|
"Trouble",
|
||||||
"alpha",
|
"alpha",
|
||||||
"lir",
|
"lir",
|
||||||
|
@ -167,18 +175,18 @@ require('lualine').setup {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
lualine_a = {'mode'},
|
lualine_a = { 'mode' },
|
||||||
lualine_b = {'diff', 'diagnostics'},
|
lualine_b = { 'diff', 'diagnostics' },
|
||||||
lualine_c = {'filename'},
|
lualine_c = { 'filename' },
|
||||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
||||||
lualine_y = {'progress'},
|
lualine_y = { 'progress' },
|
||||||
lualine_z = {'location'}
|
lualine_z = { 'location' }
|
||||||
},
|
},
|
||||||
inactive_sections = {
|
inactive_sections = {
|
||||||
lualine_a = {},
|
lualine_a = {},
|
||||||
lualine_b = {},
|
lualine_b = {},
|
||||||
lualine_c = {'filename'},
|
lualine_c = { 'filename' },
|
||||||
lualine_x = {'location'},
|
lualine_x = { 'location' },
|
||||||
lualine_y = {},
|
lualine_y = {},
|
||||||
lualine_z = {},
|
lualine_z = {},
|
||||||
},
|
},
|
||||||
|
@ -192,13 +200,13 @@ require('lualine').setup {
|
||||||
lualine_b = {
|
lualine_b = {
|
||||||
"branch"
|
"branch"
|
||||||
},
|
},
|
||||||
lualine_c = {'hostname'},
|
lualine_c = { 'hostname' },
|
||||||
lualine_x = {},
|
lualine_x = {},
|
||||||
lualine_y = {},
|
lualine_y = {},
|
||||||
lualine_z = {'tabs', 'datetime'},
|
lualine_z = { 'tabs', 'datetime' },
|
||||||
},
|
},
|
||||||
winbar = {
|
winbar = {
|
||||||
lualine_a = {'searchcount'},
|
lualine_a = { 'searchcount' },
|
||||||
lualine_b = {},
|
lualine_b = {},
|
||||||
lualine_c = {
|
lualine_c = {
|
||||||
"filename",
|
"filename",
|
||||||
|
@ -221,35 +229,38 @@ require('lualine').setup {
|
||||||
},
|
},
|
||||||
extensions = {}
|
extensions = {}
|
||||||
}
|
}
|
||||||
require'nvim-navic'.setup {
|
require 'nvim-navic'.setup {
|
||||||
icons = {
|
icons = {
|
||||||
File = ' ',
|
File = ' ',
|
||||||
Module = ' ',
|
Module = ' ',
|
||||||
Namespace = ' ',
|
Namespace = ' ',
|
||||||
Package = ' ',
|
Package = ' ',
|
||||||
Class = ' ',
|
Class = ' ',
|
||||||
Method = ' ',
|
Method = ' ',
|
||||||
Property = ' ',
|
Property = ' ',
|
||||||
Field = ' ',
|
Field = ' ',
|
||||||
Constructor = ' ',
|
Constructor = ' ',
|
||||||
Enum = ' ',
|
Enum = ' ',
|
||||||
Interface = ' ',
|
Interface = ' ',
|
||||||
Function = ' ',
|
Function = ' ',
|
||||||
Variable = ' ',
|
Variable = ' ',
|
||||||
Constant = ' ',
|
Constant = ' ',
|
||||||
String = ' ',
|
String = ' ',
|
||||||
Number = ' ',
|
Number = ' ',
|
||||||
Boolean = ' ',
|
Boolean = ' ',
|
||||||
Array = ' ',
|
Array = ' ',
|
||||||
Object = ' ',
|
Object = ' ',
|
||||||
Key = ' ',
|
Key = ' ',
|
||||||
Null = ' ',
|
Null = ' ',
|
||||||
EnumMember = ' ',
|
EnumMember = ' ',
|
||||||
Struct = ' ',
|
Struct = ' ',
|
||||||
Event = ' ',
|
Event = ' ',
|
||||||
Operator = ' ',
|
Operator = ' ',
|
||||||
TypeParameter = ' ',
|
TypeParameter = ' ',
|
||||||
},
|
},
|
||||||
separator = ' ',
|
separator = ' ',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require 'nvim-lightbulb'.setup {
|
||||||
|
autocmd = { enabled = true }
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue