Skip to content

Commit

Permalink
Automatically run FzfLua if no command args provided
Browse files Browse the repository at this point in the history
  • Loading branch information
semanser committed Jan 18, 2024
1 parent 23fa77a commit 855e349
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion nvim/.config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ vim.g.mapleader = " "
-- Key mappings
vim.api.nvim_set_keymap("n", "<esc>", ":noh<CR><esc>", { noremap = true })
vim.api.nvim_set_keymap("n", "<Leader>a", ":FzfLua live_grep_native<CR>", { noremap = true })
vim.api.nvim_set_keymap("n", "<Leader>ev", ":tabnew ~/dotfiles/.vimrc<cr>", { noremap = true })
vim.api.nvim_set_keymap("n", "<Leader><tab>", ":FzfLua files<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<Leader>gs", ":LazyGit<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<Leader>gd", ":tab Git diff<CR>", { noremap = true, silent = true })
Expand Down Expand Up @@ -71,3 +70,9 @@ vim.opt.rtp:prepend(lazypath)
require("lazy").setup("plugins")

require("lsp")

-- Check if any files were provided as command line arguments
if vim.fn.argc() == 0 then
-- If no files are provided, run the FzfLua command
vim.cmd("autocmd VimEnter * FzfLua live_grep_native | wincmd p")
end
1 change: 0 additions & 1 deletion nvim/.config/nvim/lua/plugins/etc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ return {
},
{
"ibhagwan/fzf-lua",
event = "VeryLazy",
opts = {
winopts = {
height = 0.95,
Expand Down

0 comments on commit 855e349

Please sign in to comment.