feat: media preview and tweak keybindings

This commit is contained in:
Klesh Wong 2022-07-09 22:29:52 +08:00
parent a9cf808c60
commit 7c67d707e7
3 changed files with 17 additions and 1 deletions

View File

@ -13,6 +13,9 @@ keymap(NORMAL, '<leader>ss', ':source ~/.config/nvim/init.lua<cr>', { noremap =
keymap(NORMAL, '<leader>sc', ':source %<cr>', { noremap = true }) keymap(NORMAL, '<leader>sc', ':source %<cr>', { noremap = true })
keymap(NORMAL, '<leader>w', ':w<cr>', { noremap = true }) keymap(NORMAL, '<leader>w', ':w<cr>', { noremap = true })
keymap(VISUAL, '<leader>y', '"+y<cr>', { noremap = true }) keymap(VISUAL, '<leader>y', '"+y<cr>', { noremap = true })
keymap(NORMAL, '<leader>yp', ':let @+=expand("%:p")<cr>', { noremap = true })
keymap(NORMAL, '<leader>yn', ':let @+=expand("%:t")<cr>', { noremap = true })
keymap(NORMAL, '<leader>yl', ':let @+=expand("%") . ":" . line(".")<cr>', { noremap = true })
keymap(VISUAL, '<leader>p', '"0p<cr>', { noremap = true }) keymap(VISUAL, '<leader>p', '"0p<cr>', { noremap = true })
keymap(NORMAL, '<leader>q', ':bd<cr>', { noremap = true }) keymap(NORMAL, '<leader>q', ':bd<cr>', { noremap = true })
keymap(NORMAL, '<leader>qq', ':qall<cr>', { noremap = true }) keymap(NORMAL, '<leader>qq', ':qall<cr>', { noremap = true })
@ -30,7 +33,8 @@ keymap(NORMAL, '<leader>t', ':NvimTreeToggle<cr>', { noremap = true })
keymap(NORMAL, '<leader>tf', ':NvimTreeFindFile<cr>', { noremap = true }) keymap(NORMAL, '<leader>tf', ':NvimTreeFindFile<cr>', { noremap = true })
keymap(NORMAL, '<leader>ts', ':Telescope live_grep<cr>', { noremap = true }) keymap(NORMAL, '<leader>ts', ':Telescope live_grep<cr>', { noremap = true })
keymap(NORMAL, '<leader>tt', ':Telescope file_browser path=%:p:h<cr>', { noremap = true }) keymap(NORMAL, '<leader>tt', ':Telescope file_browser path=%:p:h<cr>', { noremap = true })
keymap(NORMAL, '<leader>tb', ':Telescope buffers', { noremap = true }) keymap(NORMAL, '<leader>tb', ':Telescope buffers<cr>', { noremap = true })
keymap(NORMAL, '<leader>tm', ':Telescope media_files<cr>', { noremap = true })
keymap(NORMAL, '<leader>gc', ':Telescope git_branches<cr>', { noremap = true }) keymap(NORMAL, '<leader>gc', ':Telescope git_branches<cr>', { noremap = true })
keymap(NORMAL, '<leader>gr', ':Telescope lsp_references<cr>', { noremap = true }) keymap(NORMAL, '<leader>gr', ':Telescope lsp_references<cr>', { noremap = true })
keymap(NORMAL, '<leader>gds', ':Telescope lsp_document_symbols<cr>', { noremap = true }) keymap(NORMAL, '<leader>gds', ':Telescope lsp_document_symbols<cr>', { noremap = true })
@ -42,6 +46,7 @@ keymap(NORMAL, '<leader>gl', ':Git log<cr>', { noremap = true })
keymap(NORMAL, '<leader>gpr', ':!gpr<cr>', { noremap = true }) keymap(NORMAL, '<leader>gpr', ':!gpr<cr>', { noremap = true })
keymap(NORMAL, '<leader>cn', ':cnext<cr>', { noremap = true }) keymap(NORMAL, '<leader>cn', ':cnext<cr>', { noremap = true })
keymap(NORMAL, '<leader>cp', ':cprev<cr>', { noremap = true }) keymap(NORMAL, '<leader>cp', ':cprev<cr>', { noremap = true })
keymap(NORMAL, '<leader>bo', ':%bd | e#<cr>', { noremap = true })
-- command mode -- command mode
@ -52,3 +57,11 @@ keymap(COMMAND, '<C-b>', '<Left>', { noremap = true })
keymap(COMMAND, '<C-d>', '<Delete>', { noremap = true }) keymap(COMMAND, '<C-d>', '<Delete>', { noremap = true })
keymap(COMMAND, '<C-n>', '<Down>', { noremap = true }) keymap(COMMAND, '<C-n>', '<Down>', { noremap = true })
keymap(COMMAND, '<C-p>', '<Up>', { noremap = true }) keymap(COMMAND, '<C-p>', '<Up>', { noremap = true })
-- keymap(INSERT, '<C-a>', '<Home>', { noremap = true })
-- keymap(INSERT, '<C-e>', '<End>', { noremap = true })
-- keymap(INSERT, '<C-f>', '<Right>', { noremap = true })
-- keymap(INSERT, '<C-b>', '<Left>', { noremap = true })
-- keymap(INSERT, '<C-d>', '<Delete>', { noremap = true })
-- keymap(INSERT, '<C-n>', '<Down>', { noremap = true })
-- keymap(INSERT, '<C-p>', '<Up>', { noremap = true })

View File

@ -20,6 +20,7 @@ require("packer").startup(function(use)
requires = { {"nvim-lua/plenary.nvim"} }, requires = { {"nvim-lua/plenary.nvim"} },
} }
-- use "nvim-telescope/telescope-file-browser.nvim" -- use "nvim-telescope/telescope-file-browser.nvim"
use "nvim-telescope/telescope-media-files.nvim"
-- bufferline -- bufferline
use { use {

View File

@ -4,8 +4,10 @@ if not telescope_ok then
end end
-- telescope.load_extension "file_browser" -- telescope.load_extension "file_browser"
telescope.load_extension('media_files')
telescope.setup({ telescope.setup({
extensions = { extensions = {
-- file_browser = {} -- file_browser = {}
media_files = {}
} }
}) })