mirror of
https://github.com/harivansh-afk/nvim.git
synced 2026-04-15 12:03:52 +00:00
fzf oil and ui
This commit is contained in:
parent
dd59a54b92
commit
f93bb4ffe8
6 changed files with 143 additions and 159 deletions
55
lua/plugins/fzf.lua
Normal file
55
lua/plugins/fzf.lua
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
return {
|
||||
"ibhagwan/fzf-lua",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
cmd = "FzfLua",
|
||||
keys = {
|
||||
-- Main keybinds
|
||||
{
|
||||
"<C-f>",
|
||||
function()
|
||||
local fzf = require("fzf-lua")
|
||||
local git_dir = vim.fn.system("git rev-parse --git-dir 2>/dev/null"):gsub("\n", "")
|
||||
if vim.v.shell_error == 0 and git_dir ~= "" then
|
||||
fzf.git_files()
|
||||
else
|
||||
fzf.files()
|
||||
end
|
||||
end,
|
||||
desc = "Find files",
|
||||
},
|
||||
{ "<C-g>", function() require("fzf-lua").live_grep() end, desc = "Live grep" },
|
||||
|
||||
-- Leader keybinds
|
||||
{ "<leader>ff", function() require("fzf-lua").files() end, desc = "Files" },
|
||||
{ "<leader>fg", function() require("fzf-lua").live_grep() end, desc = "Live grep" },
|
||||
{ "<leader>fb", function() require("fzf-lua").buffers() end, desc = "Buffers" },
|
||||
{ "<leader>fh", function() require("fzf-lua").help_tags() end, desc = "Help tags" },
|
||||
{ "<leader>fr", function() require("fzf-lua").resume() end, desc = "Resume last search" },
|
||||
{ "<leader>fo", function() require("fzf-lua").oldfiles() end, desc = "Recent files" },
|
||||
{ "<leader>fc", function() require("fzf-lua").commands() end, desc = "Commands" },
|
||||
{ "<leader>fk", function() require("fzf-lua").keymaps() end, desc = "Keymaps" },
|
||||
{ "<leader>f/", function() require("fzf-lua").search_history() end, desc = "Search history" },
|
||||
{ "<leader>f:", function() require("fzf-lua").command_history() end, desc = "Command history" },
|
||||
{ "<leader>fe", function() require("fzf-lua").files({ cwd = "~/.config" }) end, desc = "Config files" },
|
||||
-- Quickfix/loclist
|
||||
{ "gq", function() require("fzf-lua").quickfix() end, desc = "Quickfix" },
|
||||
{ "gl", function() require("fzf-lua").loclist() end, desc = "Loclist" },
|
||||
-- Git
|
||||
{ "<leader>GB", function() require("fzf-lua").git_branches() end, desc = "Git branches" },
|
||||
{ "<leader>Gc", function() require("fzf-lua").git_commits() end, desc = "Git commits" },
|
||||
{ "<leader>Gs", function() require("fzf-lua").git_status() end, desc = "Git status" },
|
||||
},
|
||||
opts = {
|
||||
"default-title",
|
||||
winopts = {
|
||||
border = "single",
|
||||
preview = {
|
||||
layout = "vertical",
|
||||
vertical = "down:50%",
|
||||
},
|
||||
},
|
||||
fzf_opts = {
|
||||
["--layout"] = "reverse",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
return {
|
||||
-- Telescope fuzzy finder
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.5",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
},
|
||||
},
|
||||
cmd = "Telescope",
|
||||
keys = {
|
||||
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find files" },
|
||||
{
|
||||
"<leader>fs",
|
||||
function()
|
||||
require("telescope.builtin").find_files({
|
||||
find_command = {
|
||||
"fd",
|
||||
"--type", "f",
|
||||
"--max-depth", "3",
|
||||
"--strip-cwd-prefix",
|
||||
"--hidden",
|
||||
"--exclude", ".git",
|
||||
"--exclude", "node_modules",
|
||||
"--exclude", ".next",
|
||||
},
|
||||
})
|
||||
end,
|
||||
desc = "Shallow find files",
|
||||
},
|
||||
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live grep" },
|
||||
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Buffers" },
|
||||
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help tags" },
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
file_ignore_patterns = {
|
||||
"node_modules",
|
||||
".next",
|
||||
".git",
|
||||
"dist",
|
||||
"build",
|
||||
"%.lock",
|
||||
},
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
"--hidden",
|
||||
"--glob=!.git/",
|
||||
"--glob=!node_modules/",
|
||||
"--glob=!.next/",
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-j>"] = "move_selection_next",
|
||||
["<C-k>"] = "move_selection_previous",
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
find_command = {
|
||||
"fd",
|
||||
"--type", "f",
|
||||
"--strip-cwd-prefix",
|
||||
"--hidden",
|
||||
"--exclude", ".git",
|
||||
"--exclude", "node_modules",
|
||||
"--exclude", ".next",
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case",
|
||||
},
|
||||
},
|
||||
})
|
||||
telescope.load_extension("fzf")
|
||||
end,
|
||||
},
|
||||
|
||||
-- Oil file explorer
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ "-", "<cmd>Oil<cr>", desc = "Open parent directory" },
|
||||
},
|
||||
opts = {
|
||||
default_file_explorer = true,
|
||||
columns = {
|
||||
"icon",
|
||||
},
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
},
|
||||
keymaps = {
|
||||
["g?"] = "actions.show_help",
|
||||
["<CR>"] = "actions.select",
|
||||
["<C-v>"] = "actions.select_vsplit",
|
||||
["<C-s>"] = "actions.select_split",
|
||||
["<C-t>"] = "actions.select_tab",
|
||||
["<C-p>"] = "actions.preview",
|
||||
["<C-c>"] = "actions.close",
|
||||
["<C-r>"] = "actions.refresh",
|
||||
["-"] = "actions.parent",
|
||||
["_"] = "actions.open_cwd",
|
||||
["`"] = "actions.cd",
|
||||
["~"] = "actions.tcd",
|
||||
["gs"] = "actions.change_sort",
|
||||
["gx"] = "actions.open_external",
|
||||
["g."] = "actions.toggle_hidden",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Arrow for quick file bookmarks
|
||||
{
|
||||
"otavioschwanck/arrow.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
show_icons = true,
|
||||
leader_key = ";",
|
||||
},
|
||||
},
|
||||
}
|
||||
25
lua/plugins/oil.lua
Normal file
25
lua/plugins/oil.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
return {
|
||||
"stevearc/oil.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ "-", "<cmd>Oil<cr>", desc = "Open parent directory" },
|
||||
},
|
||||
opts = {
|
||||
default_file_explorer = true, -- nvim . opens oil
|
||||
columns = { "icon" },
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
},
|
||||
keymaps = {
|
||||
["g?"] = "actions.show_help",
|
||||
["<CR>"] = "actions.select",
|
||||
["<C-v>"] = "actions.select_vsplit",
|
||||
["<C-x>"] = "actions.select_split",
|
||||
["<C-p>"] = "actions.preview",
|
||||
["<C-c>"] = "actions.close",
|
||||
["-"] = "actions.parent",
|
||||
["g."] = "actions.toggle_hidden",
|
||||
},
|
||||
},
|
||||
}
|
||||
47
lua/plugins/tree.lua
Normal file
47
lua/plugins/tree.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
cmd = "Neotree",
|
||||
keys = {
|
||||
{ "<C-e>", "<cmd>Neotree toggle<cr>", desc = "Toggle file explorer" },
|
||||
{ "<leader>e", "<cmd>Neotree toggle<cr>", desc = "Toggle file explorer" },
|
||||
{ "<BS>", "<cmd>Neotree toggle<cr>", desc = "Toggle file explorer" },
|
||||
},
|
||||
config = function()
|
||||
require("neo-tree").setup({
|
||||
close_if_last_window = true,
|
||||
window = {
|
||||
width = 30,
|
||||
mappings = {
|
||||
["<space>"] = "none",
|
||||
},
|
||||
},
|
||||
-- Source selector at top (just Files, no Git tab)
|
||||
source_selector = {
|
||||
winbar = true,
|
||||
content_layout = "center",
|
||||
tabs_layout = "equal",
|
||||
sources = {
|
||||
{ source = "filesystem", display_name = " Files" },
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
leave_dirs_open = false,
|
||||
},
|
||||
filtered_items = {
|
||||
visible = true,
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = false,
|
||||
hide_hidden = false,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
-- Gruvbox Material colorscheme
|
||||
{
|
||||
"sainnhe/gruvbox-material",
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
|
|
@ -12,7 +12,7 @@ return {
|
|||
vim.g.gruvbox_material_better_performance = true
|
||||
vim.g.gruvbox_material_diagnostic_text_highlight = true
|
||||
vim.g.gruvbox_material_diagnostic_virtual_text = "colored"
|
||||
vim.cmd.colorscheme("gruvbox-material")
|
||||
vim.cmd.colorscheme("gruvbox")
|
||||
end,
|
||||
},
|
||||
|
||||
|
|
@ -58,31 +58,31 @@ return {
|
|||
icon = " ",
|
||||
desc = "Find File ",
|
||||
key = "f",
|
||||
action = "Telescope find_files",
|
||||
action = function() require("fzf-lua").files() end,
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Recent Files ",
|
||||
key = "r",
|
||||
action = "Telescope oldfiles",
|
||||
action = function() require("fzf-lua").oldfiles() end,
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Find Text ",
|
||||
key = "g",
|
||||
action = "Telescope live_grep",
|
||||
action = function() require("fzf-lua").live_grep() end,
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "File Explorer ",
|
||||
key = "e",
|
||||
action = "Oil",
|
||||
action = function() vim.cmd("Neotree toggle") end,
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Quit ",
|
||||
key = "q",
|
||||
action = "quit",
|
||||
action = function() vim.cmd("quit") end,
|
||||
},
|
||||
},
|
||||
footer = {},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue