From 21284ab10d41f3064dcce3a0568acf531172d161 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Wed, 24 Aug 2022 00:38:10 +0300 Subject: [PATCH] Refine some more keybinds to new format and rework Telescope config --- home/.config/nvim/init.lua | 1 - home/.config/nvim/lua/autocmd.lua | 7 ------- home/.config/nvim/lua/keybinds.lua | 21 ++++++++------------- home/.config/nvim/lua/plugins/telescope.lua | 12 +++++++++++- 4 files changed, 19 insertions(+), 22 deletions(-) delete mode 100644 home/.config/nvim/lua/autocmd.lua diff --git a/home/.config/nvim/init.lua b/home/.config/nvim/init.lua index d72504f..71af250 100644 --- a/home/.config/nvim/init.lua +++ b/home/.config/nvim/init.lua @@ -1,4 +1,3 @@ -require 'autocmd' require 'keybinds' require 'settings' require 'plugins/init' diff --git a/home/.config/nvim/lua/autocmd.lua b/home/.config/nvim/lua/autocmd.lua deleted file mode 100644 index 00a0940..0000000 --- a/home/.config/nvim/lua/autocmd.lua +++ /dev/null @@ -1,7 +0,0 @@ -local cmd = vim.cmd - --- Remap exit terminal mode to esc -cmd('au TermOpen * tnoremap ') - --- Fix YAML indentation -cmd('au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab') diff --git a/home/.config/nvim/lua/keybinds.lua b/home/.config/nvim/lua/keybinds.lua index 4433233..db8f906 100644 --- a/home/.config/nvim/lua/keybinds.lua +++ b/home/.config/nvim/lua/keybinds.lua @@ -1,20 +1,12 @@ local map = vim.keymap.set --- Open/close tree browser -map('n', '', 'NvimTreeToggle') - -- Telescope -map('n', '', 'Telescope find_files find_command=fd,-Ht,f') -map('n', '', 'Telescope live_grep') - --- Completion --- Navigate completions with tab and shift tab -map('i', '', 'pumvisible() ? "\\" : "\\"', {expr = true}) -map('i', '', 'pumvisible() ? "\\" : "\\"', {expr = true}) +--map('n', '', 'Telescope find_files find_command=fd,-Ht,f') +--map('n', '', 'Telescope live_grep') -- Navigate between buffers -map('n', '', ':bn', {silent = true}) -map('n', '', ':bp', {silent = true}) +map('n', '', vim.cmd.bn, {silent = true}) +map('n', '', vim.cmd.bp, {silent = true}) -- Navigate between splits map('n', '', '') @@ -23,4 +15,7 @@ map('n', '', '') map('n', '', '') -- Run Neoformat -map('n', '', 'Neoformat') +map('n', '', vim.cmd.Neoformat) + +-- Exit terminal insert mode with esc +map('t', '', '') diff --git a/home/.config/nvim/lua/plugins/telescope.lua b/home/.config/nvim/lua/plugins/telescope.lua index 3d889de..8eb39a1 100644 --- a/home/.config/nvim/lua/plugins/telescope.lua +++ b/home/.config/nvim/lua/plugins/telescope.lua @@ -1,6 +1,16 @@ return function() local telescope = require('telescope') - telescope.setup {} + local builtin = require('telescope.builtin') + + telescope.setup { + pickers = {find_files = {find_command = {"fd", "-Ht", "f"}}} + } + telescope.load_extension('fzf') telescope.load_extension('ui-select') + + -- Keybinds + vim.keymap.set('n', '', vim.cmd.Telescope) + vim.keymap.set('n', '', builtin.find_files) + vim.keymap.set('n', '', builtin.live_grep) end