Skip to content

FylerOrg/fyler.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

648 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fyler.nvim

A file manager for Neovim
License
Image

Introduction

Fyler.nvim is oil.nvim inspired file manager plugin for neovim which can manipulate file system like a neovim buffer and provide a proper file-tree representation of items.

Requirements

  • Neovim >= 0.11

Installation

{ 'FylerOrg/fyler.nvim', opts = {} }
require('mini.deps').add('FylerOrg/fyler.nvim')
vim.pack.add({ 'https://github.com/FylerOrg/fyler.nvim' })

Setup

local fyler = require('fyler')

fyler.setup({
  -- Whether to skip confirmation for "simple" mutations.
  -- A simple mutation has at most:
  -- - 1 copy operation
  -- - 1 delete operation
  -- - 1 move operation
  -- - 5 create operations
  auto_confirm_simple_mutation = false,
  -- Restricts cursor from moving outside editable region
  bound_cursor = true,
  -- Buffer-local options applied to the finder buffer (see: nvim_set_option_value)
  buf_opts = {},
  -- Follow current file
  follow_current_file = true,
  -- List of extensions to enable (e.g., 'git', 'trash')
  extensions = {},
  -- Event hooks for custom behavior (on_highlight, on_delete, on_rename)
  hooks = {},
  -- External integrations (e.g., icon provider)
  integrations = {},
  -- Window-local options applied to the finder window (see: nvim_set_option_value)
  win_opts = {},
  -- Buffer kind to use globally.
  kind = 'replace',
  -- Per-kind preset overrides. Each preset can contain mappings, buf_opts,
  -- win_opts, and any window layout fields (width, height, border, etc.).
  kind_presets = {
    floating = {
      -- Border style (see: :h winborder)
      border = 'single',
      -- Size of buffer:
      -- - string with '%' for relative (e.g. '70%')
      -- - number for absolute
      height = '80%',
      mappings = { n = { ['<CR>'] = { action = 'select', args = { close = true } } } },
      width = '60%',
      -- Horizontal alignment: 'start' | 'center' | 'end'
      col = 'center',
      -- Vertical alignment: 'start' | 'center' | 'end'
      row = 'center',
    },
    replace = {
      mappings = { n = { ['<CR>'] = { action = 'select', args = { close = true } } } },
    },
    split_above = { height = '50%' },
    split_above_all = { height = '50%' },
    split_below = { height = '50%' },
    split_below_all = { height = '50%' },
    split_left = { width = '25%' },
    split_left_most = { width = '25%' },
    split_right = { width = '25%' },
    split_right_most = { width = '25%' },
  },
  -- Key mappings organized by mode (see: fyler.Mapping)
  mappings = {
    n = {
      ['-'] = { action = 'visit', args = { parent = true } },
      ['.'] = { action = 'visit', args = { cursor = true } },
      ['<BS>'] = { action = 'shrink', args = { parent = true } },
      ['<C-R>'] = { action = 'refresh' },
      ['<C-S>'] = { action = 'select', args = { split = true } },
      ['<C-T>'] = { action = 'select', args = { tabedit = true } },
      ['<C-V>'] = { action = 'select', args = { vsplit = true } },
      ['<CR>'] = { action = 'select' },
      ['='] = { action = 'visit' },
      ['g.'] = { action = 'toggle_ui', args = { 'hidden_items' } },
      ['gi'] = { action = 'toggle_ui', args = { 'indent_guides' } },
      ['q'] = { action = 'close' },
    },
  },
  -- UI configuration
  ui = {
    hidden_items = {
      -- Toggleable pre-defined switches (e.g. 'dotfiles' to hide files starting with a dot).
      switches = { 'dotfiles' },
      -- Toggleable patterns (Lua patterns matched against the full path).
      patterns = {},
      -- Always visible items matching these patterns, even if they would normally be hidden.
      always_visible = {},
      -- Always hide items matching these patterns, even if they would normally be visible.
      always_hidden = {},
    },
    -- Whether to draw indent guides at each depth level.
    indent_guides = false,
  },
})

Usage

Open Fyler using the :Fyler command:

:Fyler                    " Open the finder
:Fyler root_path=<path>   " Use a different directory path
:Fyler kind=<buffer_kind> " Open specified kind directly

Open Fyler from Lua:

local fyler = require('fyler')

-- open using defaults
fyler.open()

-- open as a left most split
fyler.open({ kind = "split_left_most" })

-- open with different directory
fyler.open({ root_path = "~" })

-- You can map this to a key
vim.keymap.set("n", "<leader>e", fyler.open, { desc = "Fyler.nvim - Open" })

-- Wrap in a function to pass additional arguments
vim.keymap.set(
    "n",
    "<leader>e",
    function() fyler.open({ kind = "split_left_most" }) end,
    { desc = "Fyler.nvim - Open" }
)

License

Apache 2.0. See LICENSE.

Note

Run :help fyler.nvim OR visit wiki pages for more detailed explanation and live showcase.

Credits


Built with ❤️ for the Neovim community

contributors

About

A neovim file manager which can edit file system like a buffer with tree view

Topics

Resources

License

Stars

Watchers

Forks

Contributors