none-ls, codelens maps, telescope subdir maps

This commit is contained in:
Amanda Graven 2023-10-18 18:23:43 +02:00
parent a1fe12252f
commit f5b5d5d0ae

View file

@ -180,7 +180,8 @@ au('User', {
vim.keymap.set('', 'n', 'gj', {silent = true, buffer = true}) vim.keymap.set('', 'n', 'gj', {silent = true, buffer = true})
vim.keymap.set('', 'e', 'gk', {silent = true, buffer = true}) vim.keymap.set('', 'e', 'gk', {silent = true, buffer = true})
end end
end end,
desc = 'Override Startify mappings',
}) })
au('BufWritePost', { au('BufWritePost', {
pattern = '*/.config/nvim/init.lua', pattern = '*/.config/nvim/init.lua',
@ -322,7 +323,7 @@ require'packer'.startup(function(use)
use 'mfussenegger/nvim-jdtls' use 'mfussenegger/nvim-jdtls'
use 'simrat39/rust-tools.nvim' use 'simrat39/rust-tools.nvim'
use 'pmizio/typescript-tools.nvim' use 'pmizio/typescript-tools.nvim'
use {'jose-elias-alvarez/null-ls.nvim', requires = {'nvim-lua/plenary.nvim'}, config = function () use {'nvimtools/none-ls.nvim', requires = {'nvim-lua/plenary.nvim'}, config = function ()
local null_ls = require'null-ls' local null_ls = require'null-ls'
null_ls.setup { null_ls.setup {
sources = { sources = {
@ -434,7 +435,9 @@ require'packer'.startup(function(use)
} }
end} end}
use {'theHamsta/nvim-dap-virtual-text', config = function() use {'theHamsta/nvim-dap-virtual-text', config = function()
require'nvim-dap-virtual-text'.setup{} require'nvim-dap-virtual-text'.setup {
clear_on_continue = true,
}
end} end}
use {'mxsdev/nvim-dap-vscode-js', requires = {'mfussenegger/nvim-dap'}, config = function() use {'mxsdev/nvim-dap-vscode-js', requires = {'mfussenegger/nvim-dap'}, config = function()
require'dap-vscode-js'.setup { require'dap-vscode-js'.setup {
@ -541,6 +544,10 @@ require'packer'.startup(function(use)
integrations = { integrations = {
diffview = true, diffview = true,
}, },
signs = {
item = {"", ""},
section = {"", ""},
},
} }
end} end}
use {'rcarriga/nvim-notify', after = 'telescope.nvim', config = function () use {'rcarriga/nvim-notify', after = 'telescope.nvim', config = function ()
@ -555,7 +562,11 @@ require'packer'.startup(function(use)
end} end}
use 'mhinz/vim-startify' use 'mhinz/vim-startify'
use {'nvim-telescope/telescope.nvim', after = 'which-key.nvim', config = function() use {'nvim-telescope/telescope.nvim', after = 'which-key.nvim', config = function()
require'telescope'.setup { local ok, telescope = pcall(require, 'telescope')
if not ok then return end
telescope.builtin = require'telescope.builtin'
telescope.themes = require'telescope.themes'
telescope.setup {
defaults = { defaults = {
sorting_strategy = 'ascending', sorting_strategy = 'ascending',
mappings = { mappings = {
@ -581,8 +592,10 @@ require'packer'.startup(function(use)
-- TODO; check if this is right -- TODO; check if this is right
full_path = true, full_path = true,
}, },
['ui-select'] = { ['ui-select'] = telescope.themes.get_cursor {
require'telescope.themes'.get_cursor() layout_config = {
height = 15,
},
}, },
}, },
} }
@ -592,9 +605,19 @@ require'packer'.startup(function(use)
["<Space>"] = {'<Cmd>Telescope<CR>', 'List pickers'}, ["<Space>"] = {'<Cmd>Telescope<CR>', 'List pickers'},
f = {'<Cmd>Telescope find_files<CR>', 'Files'}, f = {'<Cmd>Telescope find_files<CR>', 'Files'},
F = {'<Cmd>Telescope file_browser<CR>', 'File browser'}, F = {'<Cmd>Telescope file_browser<CR>', 'File browser'},
['<C-f>'] = {function ()
vim.ui.input({ completion = 'dir' }, function (input)
telescope.builtin.find_files { search_dirs = {input} }
end)
end, 'Files in subdirectory'},
d = {'<Cmd>Telescope find_files find_command=fd,--type,d,-I<CR>', 'Directories'}, d = {'<Cmd>Telescope find_files find_command=fd,--type,d,-I<CR>', 'Directories'},
r = {'<Cmd>Telescope oldfiles<CR>', 'Recent files'}, r = {'<Cmd>Telescope oldfiles<CR>', 'Recent files'},
g = {'<Cmd>Telescope live_grep<CR>', 'Grep'}, g = {'<Cmd>Telescope live_grep<CR>', 'Grep'},
G = {function ()
vim.ui.input({ completion = 'dir' }, function(input)
telescope.builtin.live_grep { search_dirs = {input} }
end)
end, 'Grep in subdirectory'},
b = {'<Cmd>Telescope buffers<CR>', 'Buffers'}, b = {'<Cmd>Telescope buffers<CR>', 'Buffers'},
e = {'<Cmd>Telescope diagnostics<CR>', 'Diagnostics'}, e = {'<Cmd>Telescope diagnostics<CR>', 'Diagnostics'},
h = {'<Cmd>Telescope help_tags<CR>', 'Help page'}, h = {'<Cmd>Telescope help_tags<CR>', 'Help page'},
@ -887,6 +910,8 @@ local function on_attach(client, bufnr)
i = {'<Cmd>Telescope lsp_implementations<CR>', 'Implementation'}, i = {'<Cmd>Telescope lsp_implementations<CR>', 'Implementation'},
a = {vim.lsp.buf.code_action, 'Code action'}, a = {vim.lsp.buf.code_action, 'Code action'},
r = {vim.lsp.buf.rename, 'Rename'}, r = {vim.lsp.buf.rename, 'Rename'},
l = {vim.lsp.codelens.refresh, 'Show codelenses'},
L = {vim.lsp.codelens.run, 'Run codelens'},
t = {'<Cmd>Telescope lsp_type_definitions<CR>', 'Type definition'}, t = {'<Cmd>Telescope lsp_type_definitions<CR>', 'Type definition'},
u = {'<Cmd>Telescope lsp_references<CR>', 'Usages/references'} u = {'<Cmd>Telescope lsp_references<CR>', 'Usages/references'}
}, },