From f5b5d5d0ae2bcaff391313ba6df07d696b88591a Mon Sep 17 00:00:00 2001 From: Amanda Graven Date: Wed, 18 Oct 2023 18:23:43 +0200 Subject: [PATCH] none-ls, codelens maps, telescope subdir maps --- init.lua | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index e1d9ecd..1c27a43 100644 --- a/init.lua +++ b/init.lua @@ -180,7 +180,8 @@ au('User', { vim.keymap.set('', 'n', 'gj', {silent = true, buffer = true}) vim.keymap.set('', 'e', 'gk', {silent = true, buffer = true}) end - end + end, + desc = 'Override Startify mappings', }) au('BufWritePost', { pattern = '*/.config/nvim/init.lua', @@ -322,7 +323,7 @@ require'packer'.startup(function(use) use 'mfussenegger/nvim-jdtls' use 'simrat39/rust-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' null_ls.setup { sources = { @@ -434,7 +435,9 @@ require'packer'.startup(function(use) } end} 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} use {'mxsdev/nvim-dap-vscode-js', requires = {'mfussenegger/nvim-dap'}, config = function() require'dap-vscode-js'.setup { @@ -541,6 +544,10 @@ require'packer'.startup(function(use) integrations = { diffview = true, }, + signs = { + item = {"", ""}, + section = {"", ""}, + }, } end} use {'rcarriga/nvim-notify', after = 'telescope.nvim', config = function () @@ -555,7 +562,11 @@ require'packer'.startup(function(use) end} use 'mhinz/vim-startify' 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 = { sorting_strategy = 'ascending', mappings = { @@ -581,8 +592,10 @@ require'packer'.startup(function(use) -- TODO; check if this is right full_path = true, }, - ['ui-select'] = { - require'telescope.themes'.get_cursor() + ['ui-select'] = telescope.themes.get_cursor { + layout_config = { + height = 15, + }, }, }, } @@ -592,9 +605,19 @@ require'packer'.startup(function(use) [""] = {'Telescope', 'List pickers'}, f = {'Telescope find_files', 'Files'}, F = {'Telescope file_browser', 'File browser'}, + [''] = {function () + vim.ui.input({ completion = 'dir' }, function (input) + telescope.builtin.find_files { search_dirs = {input} } + end) + end, 'Files in subdirectory'}, d = {'Telescope find_files find_command=fd,--type,d,-I', 'Directories'}, r = {'Telescope oldfiles', 'Recent files'}, g = {'Telescope live_grep', 'Grep'}, + G = {function () + vim.ui.input({ completion = 'dir' }, function(input) + telescope.builtin.live_grep { search_dirs = {input} } + end) + end, 'Grep in subdirectory'}, b = {'Telescope buffers', 'Buffers'}, e = {'Telescope diagnostics', 'Diagnostics'}, h = {'Telescope help_tags', 'Help page'}, @@ -887,6 +910,8 @@ local function on_attach(client, bufnr) i = {'Telescope lsp_implementations', 'Implementation'}, a = {vim.lsp.buf.code_action, 'Code action'}, r = {vim.lsp.buf.rename, 'Rename'}, + l = {vim.lsp.codelens.refresh, 'Show codelenses'}, + L = {vim.lsp.codelens.run, 'Run codelens'}, t = {'Telescope lsp_type_definitions', 'Type definition'}, u = {'Telescope lsp_references', 'Usages/references'} },