From 90d4dc5ba5af854c7cd92da1546b1273e096da14 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Sun, 19 Nov 2023 11:42:53 +0100 Subject: [PATCH] feat(zsh): Add quick commands for vim --- .config/nvim/init.lua | 2 +- .config/nvim/lua/custom-args.lua | 15 +++++++++++++++ .zshrc | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .config/nvim/lua/custom-args.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 5893d8f..1daedb3 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -185,7 +185,6 @@ require("bufferline").setup({ color_icons = true, show_close_icon = false, show_buffer_close_icons = false, - show_buffer_default_icon = false, show_duplicate_prefix = false, hover = { enabled = false @@ -222,3 +221,4 @@ require("telescope-config") require("telescope-mappings") require("keybindings") +require("custom-args") diff --git a/.config/nvim/lua/custom-args.lua b/.config/nvim/lua/custom-args.lua new file mode 100644 index 0000000..220b846 --- /dev/null +++ b/.config/nvim/lua/custom-args.lua @@ -0,0 +1,15 @@ +vim.api.nvim_create_autocmd("VimEnter", { + callback = function() + if vim.fn.argv(0) == 'p' then + require("telescope-config").project_files() + end + end, +}) + +vim.api.nvim_create_autocmd("VimEnter", { + callback = function() + if vim.fn.argv(0) == 'f' then + require("telescope.builtin").live_grep() + end + end, +}) diff --git a/.zshrc b/.zshrc index a7c5dee..1a8c9c5 100644 --- a/.zshrc +++ b/.zshrc @@ -95,6 +95,12 @@ bindkey "^?" backward-delete-char # Enable backward incremental search bindkey '^R' history-incremental-search-backward +# Open Vim in file selection on ctrl+p +bindkey -s '^P' 'vim p^M' + +# Open Vim in string research on ctrl+f +bindkey -s '^f' 'vim f^M' + # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh