Refine some more keybinds to new format and rework Telescope config

This commit is contained in:
Marko Korhonen 2022-08-24 00:38:10 +03:00
parent 4d94052d70
commit 21284ab10d
4 changed files with 19 additions and 22 deletions

View file

@ -1,4 +1,3 @@
require 'autocmd'
require 'keybinds'
require 'settings'
require 'plugins/init'

View file

@ -1,7 +0,0 @@
local cmd = vim.cmd
-- Remap exit terminal mode to esc
cmd('au TermOpen * tnoremap <buffer> <Esc> <c-\\><c-n>')
-- Fix YAML indentation
cmd('au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab')

View file

@ -1,20 +1,12 @@
local map = vim.keymap.set
-- Open/close tree browser
map('n', '<C-T>', '<cmd>NvimTreeToggle<CR>')
-- Telescope
map('n', '<C-f>', '<cmd>Telescope find_files find_command=fd,-Ht,f<CR>')
map('n', '<C-g>', '<cmd>Telescope live_grep<CR>')
-- Completion
-- Navigate completions with tab and shift tab
map('i', '<S-Tab>', 'pumvisible() ? "\\<C-p>" : "\\<Tab>"', {expr = true})
map('i', '<Tab>', 'pumvisible() ? "\\<C-n>" : "\\<Tab>"', {expr = true})
--map('n', '<C-f>', '<cmd>Telescope find_files find_command=fd,-Ht,f<CR>')
--map('n', '<C-g>', '<cmd>Telescope live_grep<CR>')
-- Navigate between buffers
map('n', '<C-N>', ':bn<CR>', {silent = true})
map('n', '<C-B>', ':bp<CR>', {silent = true})
map('n', '<C-N>', vim.cmd.bn, {silent = true})
map('n', '<C-B>', vim.cmd.bp, {silent = true})
-- Navigate between splits
map('n', '<C-H>', '<C-W><C-H>')
@ -23,4 +15,7 @@ map('n', '<C-K>', '<C-W><C-K>')
map('n', '<C-L>', '<C-W><C-L>')
-- Run Neoformat
map('n', '<M-f>', '<cmd>Neoformat<CR>')
map('n', '<M-f>', vim.cmd.Neoformat)
-- Exit terminal insert mode with esc
map('t', '<Esc>', '<C-\\><C-n>')

View file

@ -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', '<C-t>', vim.cmd.Telescope)
vim.keymap.set('n', '<C-f>', builtin.find_files)
vim.keymap.set('n', '<C-g>', builtin.live_grep)
end