From 3de96d686d7b85ff22246663932c708bc6357e51 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Sun, 18 Sep 2022 11:36:47 +0530 Subject: nvim telescope --- .config/nvim/lua/justsaumit/keymaps.lua | 2 + .config/nvim/lua/justsaumit/plugins.lua | 4 +- .config/nvim/lua/justsaumit/telescope-config.lua | 50 ++++++++++++++++++++++++ .config/nvim/lua/justsaumit/which-key-config.lua | 4 +- 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 .config/nvim/lua/justsaumit/telescope-config.lua (limited to '.config/nvim/lua/justsaumit') diff --git a/.config/nvim/lua/justsaumit/keymaps.lua b/.config/nvim/lua/justsaumit/keymaps.lua index 2a29f46..5b06bdc 100644 --- a/.config/nvim/lua/justsaumit/keymaps.lua +++ b/.config/nvim/lua/justsaumit/keymaps.lua @@ -20,6 +20,8 @@ vim.g.maplocalleader = " " keymap("n", "", ":w", opts) --Toggle nvim-tree keymap("n", "", ":NvimTreeToggle", opts) +--Disable C-e +keymap("n", "", ":", opts) -- Better window navigation for split keymap("n", "", "h", opts) diff --git a/.config/nvim/lua/justsaumit/plugins.lua b/.config/nvim/lua/justsaumit/plugins.lua index 8c075ec..9d2b36e 100644 --- a/.config/nvim/lua/justsaumit/plugins.lua +++ b/.config/nvim/lua/justsaumit/plugins.lua @@ -61,9 +61,11 @@ return packer.startup(function(use) --Nvim-tree File explorer for nvim use {'kyazdani42/nvim-tree.lua', requires = { 'kyazdani42/nvim-web-devicons'}} --Whick-key - displays a popup with possible key bindings - use {'folke/which-key.nvim'} + use 'folke/which-key.nvim' --HTML use 'windwp/nvim-ts-autotag' +--Telescope +use {'nvim-telescope/telescope.nvim', tag = '0.1.0', requires = { {'nvim-lua/plenary.nvim'} }} --cmp -- use 'neovim/nvim-lspconfig' -- use 'hrsh7th/cmp-nvim-lsp' diff --git a/.config/nvim/lua/justsaumit/telescope-config.lua b/.config/nvim/lua/justsaumit/telescope-config.lua new file mode 100644 index 0000000..c1bb44d --- /dev/null +++ b/.config/nvim/lua/justsaumit/telescope-config.lua @@ -0,0 +1,50 @@ +local actions = require('telescope.actions') +require('telescope').setup { + defaults = { + layout_config = { + width = 0.75, + prompt_position = "top", + preview_cutoff = 120, + horizontal = {mirror = false}, + vertical = {mirror = false} + }, + find_command = { + 'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' + }, + prompt_prefix = " ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "descending", + layout_strategy = "horizontal", + file_sorter = require'telescope.sorters'.get_fuzzy_file, + file_ignore_patterns = {}, + generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, + path_display = {}, + winblend = 0, + border = {}, + borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'}, + color_devicons = true, + use_less = true, + set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil, + file_previewer = require'telescope.previewers'.vim_buffer_cat.new, + grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, + qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, + buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker, + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.smart_send_to_qflist + actions.open_qflist, + [""] = actions.close, + [""] = actions.select_default + actions.center + }, + n = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.smart_send_to_qflist + actions.open_qflist + } + } + } +} diff --git a/.config/nvim/lua/justsaumit/which-key-config.lua b/.config/nvim/lua/justsaumit/which-key-config.lua index 11bb49c..b438f7e 100644 --- a/.config/nvim/lua/justsaumit/which-key-config.lua +++ b/.config/nvim/lua/justsaumit/which-key-config.lua @@ -3,7 +3,9 @@ local mappings = { q = {":q", "Quit"}, Z = {":wq", "Save and Quit"}, w = {":w", "Save"}, - x ={":bdelete", "Close"} + x ={":bdelete", "Close"}, + f = { ":Telescope find_files", "Telescope Find Files" }, + g = { ":Telescope live_grep", "Telescope Live Grep" } } local opts = {prefix = ''} wk.register(mappings, opts) -- cgit v1.2.3