Giter Site home page Giter Site logo

obaland / vfiler.vim Goto Github PK

View Code? Open in Web Editor NEW
126.0 126.0 6.0 929 KB

:file_folder: File explorer plugin for Neovim/Vim

License: MIT License

Lua 97.52% Makefile 0.17% Vim Script 2.31%
file-explorer file-manager filer lua neovim neovim-plugin nvim vim vim-plugin

vfiler.vim's People

Contributors

amedama41 avatar cibinmathew avatar obaland avatar ptrkrlsrd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vfiler.vim's Issues

an error when a opening files

here's the error:

E5108: Error executing lua /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/buffer.lua:93: assertion failed!
stack traceback:
        [C]: in function 'assert'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/buffer.lua:93: in function 'set_option'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/view.lua:404: in function 'finally'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/libs/core.lua:42: in function 'try'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/view.lua:397: in function 'redraw'
        .../.cache/nvim/vfiler.vim/lua/vfiler/actions/utilities.lua:125: in function 'open_file'
        .../.cache/nvim/vfiler.vim/lua/vfiler/actions/utilities.lua:140: in function 'choose_file'
        .../.cache/nvim/vfiler.vim/lua/vfiler/actions/utilities.lua:148: in function 'edit_file'
        .../.cache/nvim/vfiler.vim/lua/vfiler/actions/utilities.lua:206: in function 'open_file'
        .../mjhd/.cache/nvim/vfiler.vim/lua/vfiler/actions/open.lua:7: in function 'action'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:215: in function 'do_action'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:196: in function '_do_action'
        [string ":lua"]:1: in main chunk

my config:

	local action = require('vfiler/action')
	local config = require('vfiler/config')

	config.around = {
		options = {
			auto_resize = true,
			header = true,
			name = 'around',
			blend = 20,
			layout = 'floating',
			border = 'none',
			columns = 'indent,devicons,name',
			keep = true,
		},
		mappings = {
			['<esc>'] = action.quit,
			['<C-s>'] = action.open_by_split,
			['s'] = action.toggle_sort,
		},
	}

	config.filer = {
		options = {
			header = true,
			name = 'filer',
			layout = 'tab',
			columns = 'indent,devicons,name,mode,size,time',
			['git.ignored'] = false,
			['git.untracked'] = false,
		},
		mappings = {
			['h'] = action.switch_to_filer,
			['l'] = action.switch_to_filer,
			['<left>'] = action.switch_to_filer,
			['<right>'] = action.switch_to_filer,
		},
	}

my environment:

  • ubuntu 22.04 (wsl2)

  • neovim 0.9.1

  • rev: 2447621

  • macOS 13.5.2

  • neovim 0.9.4

  • rev: 2447621

Can't open UNC path

When I try to open a UNC path, following error is thrown.

ex1. require("vfiler").start("//COMPUTERNAME/FOLDERNAME")
ex2. require("vfiler").start("\\COMPUTERNAME\FOLDERNAME")

E5108: Error executing lua ...ocal/nvim-data/lazy/vfiler.vim/lua/vfiler/items/item.lua:72: attempt to index local 'stat' (a nil value)
stack traceback:
	...ocal/nvim-data/lazy/vfiler.vim/lua/vfiler/items/item.lua:72: in function 'new'
	...Local/nvim-data/lazy/vfiler.vim/lua/vfiler/libs/core.lua:22: in function 'inherit'
	...nvim-data/lazy/vfiler.vim/lua/vfiler/items/directory.lua:33: in function 'new'
	...a/Local/nvim-data/lazy/vfiler.vim/lua/vfiler/context.lua:297: in function 'switch'
	...ta/Local/nvim-data/lazy/vfiler.vim/lua/vfiler/vfiler.lua:275: in function 'start'
	...1/AppData/Local/nvim-data/lazy/vfiler.vim/lua/vfiler.lua:32: in function 'start'
	[string ":lua"]:1: in main chunk

OS: Windows10
NVIM: v0.9.5
vfiler.vim: ed2c4a7

How to keep structure folder previously after quit.

When I quit, the struct folder expands reset.

I want to like this(defx.nvim)
Peek 2022-06-08 19-38

Instead(Vfiler)
Peek 2022-06-08 19-39

File module_vfiler.lua
NVIM v0.8.0-dev

local action = require('vfiler/action')

require'vfiler/config'.setup {
  options = {
    auto_cd = false,
    auto_resize = false,
    columns = 'indent,icon,name',
    header = true,
    keep = true,
    listed = true,
    name = '',
    session = none,
    show_hidden_files = true,
    sort = 'name',
    layout = 'left',
    width = 35,
    new = false,
    quit = true,
    row = 0,
    col = 0,
    blend = 0,
    border = 'rounded',
    zindex = 200,
    git = {
      enabled = false,
      ignored = false,
      untracked = false,
    },
    preview = {
      layout = 'floating',
      width = 0,
      height = 0,
    },
  },
  mappings = {
    ['.'] = action.toggle_show_hidden,
    ['<BS>'] = action.change_to_parent,
    ['<C-l>'] = action.reload,
    ['<C-p>'] = action.toggle_auto_preview,
    ['<C-r>'] = action.sync_with_current_filer,
    ['<C-s>'] = action.toggle_sort,
    ['<CR>'] = action.open,
    ['<Space>'] = function(vfiler, context, view)
      action.toggle_select(vfiler, context, view)
    end,
    ['*'] = action.toggle_select_all,
    ['cc'] = action.copy_to_filer,
    ['dd'] = action.delete,
    ['gg'] = action.move_cursor_top,
    ['b'] = action.list_bookmark,
    ['h'] = action.close_tree_or_cd,
    ['j'] = action.loop_cursor_down,
    ['k'] = action.loop_cursor_up,
    ['l'] = action.open_tree,
    ['mm'] = action.move_to_filer,
    ['p'] = action.toggle_preview,
    ['r'] = action.rename,
    ['s'] = action.open_by_split,
    ['t'] = action.open_by_tabpage,
    ['v'] = action.open_by_vsplit,
    ['x'] = action.execute_file,
    ['yy'] = action.yank_path,
    ['B'] = action.add_bookmark,
    ['C'] = action.copy,
    ['D'] = action.delete,
    ['G'] = action.move_cursor_bottom,
    ['~'] = action.jump_to_home,
    ['J'] = action.jump_to_directory,
    ['K'] = action.new_directory,
    ['L'] = action.switch_to_drive,
    ['M'] = action.move,
    ['N'] = action.new_file,
    ['P'] = action.paste,
    ['q'] = action.quit,
    ['S'] = action.change_sort,
    ['U'] = action.clear_selected_all,
    ['YY'] = action.yank_name,
  },
}

Add toggle_show_linenumber, but got E21

Overview

I had forked and trying add action named toggle_show_linenumber.
But I had got error messsage E21: Cannot make changes, 'modifiable' is off.

Question

I think this is the one of way. It be toggle modifiable at before and after toggle_show_linenumber. Is this better? Or?

-- set buffer lines
local saved_view = vim.fn.winsaveview()
core.try({
function()
buffer:set_option('modifiable', true)
buffer:set_option('readonly', false)
buffer:set_lines(lines)
end,
finally = function()
buffer:set_option('modifiable', false)
buffer:set_option('readonly', true)
vim.fn.winrestview(saved_view)
end,
})

Code

https://github.com/ShortArrow/vfiler.vim/blob/20243fe163271cb62b21f369be8f6cf012d742ca/lua/vfiler/view.lua#L158-L168

Error

Attach toggle_show_linenumber to i key.
And type i then get error message, as a bellow.

E21: Cannot make changes, 'modifiable' is off

[Question] toggle_show_hidden is effects for only top directory

Question

Is this one of specifications? Or bug?

Expect Behavior

action.toggle_show_hidden has effects for all directory under the displayed directory.

Actual Behavior

action.toggle_show_hidden can't show diplayed_top_directory/**/\..*, like nvim/.gitignore.

Tried

action.reload was no effects.

My Config

local M = {}                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                              
M.setup = function()                                                                                                                                                                                                                          
  local _vfiler = require('vfiler')                                                                                                                                                                                                           
  local _vfiler_action = require('vfiler/action')                                                                                                                                                                                             
  local _vfiler_config = require('vfiler/config')                                                                                                                                                                                             
  _vfiler_config.setup {                                                                                                                                                                                                                      
    options = {                                                                                                                                                                                                                               
      name = 'myfiler',                                                                                                                                                                                                                       
      auto_cd = true,                                                                                                                                                                                                                         
      auto_resize = true,                                                                                                                                                                                                                     
      keep = true,                                                                                                                                                                                                                            
      layout = 'left',                                                                                                                                                                                                                        
      width = 30,                                                                                                                                                                                                                             
      columns = 'indent,devicons,name,git',                                                                                                                                                                                                   
      preview = {                                                                                                                                                                                                                             
        layout = 'right',                                                                                                                                                                                                                     
      },                                                                                                                                                                                                                                      
    },                                                                                                                                                                                                                                        
    mappings = {},                                                                                                                                                                                                                            
  }                                                                                                                                                                                                                                           
  _vfiler_action.setup {                                                                                                                                                                                                                      
    hook = {},                                                                                                                                                                                                                                
  }                                                                                                                                                                                                                                           
  _vfiler.start('./')                                                                                                                                                                                                                         
end                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                              
require('vfiler/columns/indent').setup {                                                                                                                                                                                                      
  icon = ''                                                                                                                                                                                                                                  
}                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                              
return M 

[feature request] Text file preview

Is it possible to preview text file in a new vertical split window? It will be convenient to select file.

My expect output is like this:

image

Or is it possible to draw two list in same window like the telescope?

image

can not display the git status in column?

Hello! Thank you for this great plugin!

I use lazy.nvim as the plugins manager and I have the following configs:

return {
	"obaland/vfiler.vim",
	keys = {
		{ "<leader>t", "<cmd>VFiler<cr>", desc = "Open vfiler" },
	},
    cmd = {"VFiler"},
    dependencies = {"obaland/vfiler-column-devicons"},
	config = function(_, opts)
		local action = require("vfiler/action")
		-- following options are the default
        require'vfiler/config'.clear_mappings()
		require("vfiler/config").setup({
			options = {
				auto_cd = true,
				auto_resize = true,
				columns = "indent,devicons,name,git,time,mode,size",
				find_file = true,
				header = true,
				keep = true,
				listed = true,
				name = "",
				session = "buffer",
				show_hidden_files = true,
				sort = "name",
				layout = "left",
				width = 80,
				height = 20,
				new = false,
				quit = true,
				row = 0,
				col = 0,
				blend = 0,
				border = "rounded",
				zindex = 200,
				git = {
					enabled = true,
					ignored = true,
					untracked = true,
				},
				preview = {
					layout = "floating",
					width = 0,
					height = 0,
				},
			},
			mappings = {
				["."] = action.toggle_show_hidden,
				["<BS>"] = action.change_to_parent,
				["<C-l>"] = action.reload,
				["<C-p>"] = action.toggle_auto_preview,
				["<C-r>"] = action.sync_with_current_filer,
				["<C-s>"] = action.toggle_sort,
				["<CR>"] = action.open,
				["K"] = function(vfiler, context, view)
					action.toggle_select(vfiler, context, view)
					action.move_cursor_up(vfiler, context, view)
				end,
				["J"] = function(vfiler, context, view)
					action.toggle_select(vfiler, context, view)
					action.move_cursor_down(vfiler, context, view)
				end,
				["<Tab>"] = action.switch_to_filer,
				["~"] = action.jump_to_home,
				["*"] = action.toggle_select_all,
				["\\"] = action.jump_to_root,
				["cc"] = action.copy_to_filer,
				["dd"] = action.delete,
				["gg"] = action.move_cursor_top,
				["b"] = action.list_bookmark,
				["h"] = action.close_tree_or_cd,
				["j"] = action.loop_cursor_down,
				["k"] = action.loop_cursor_up,
				["l"] = action.open_tree,
				["M"] = action.move_to_filer,
				["P"] = action.toggle_preview,
				["q"] = action.quit,
				["r"] = action.rename,
				["s"] = action.open_by_split,
				["t"] = action.open_by_tabpage,
				["v"] = action.open_by_vsplit,
				["e"] = action.execute_file,
				["yp"] = action.yank_path,
				["B"] = action.add_bookmark,
				["yy"] = action.copy,
				["D"] = action.delete,
				["G"] = action.move_cursor_bottom,
				-- ["J"] = action.jump_to_directory,
				["A"] = action.new_directory,
				["L"] = action.switch_to_drive,
				["x"] = action.move,
				["a"] = action.new_file,
				["p"] = action.paste,
				["S"] = action.change_sort,
				["U"] = action.clear_selected_all,
				["yn"] = action.yank_name,
			},
		})
	end,
}

but I can not have the git status displaying in the column:
image

The expected result should be:
image

`a nil value` error when closing floating window

I'm using floating filer by following config:

	config.around = {
		options = {
			auto_resize = true,
			header = true,
			name = 'around',
			blend = 20,
			layout = 'floating',
			border = 'none',
			columns = 'indent,devicons,name',
			keep = true,
		},
		mappings = {
			['<esc>'] = action.quit,
			['<C-s>'] = action.open_by_split,
			['s'] = action.toggle_sort,
		},
	}

When I close the floating window, following error is thrown:

E5108: Error executing lua ...d/.cache/nvim/vfiler.vim/lua/vfiler/windows/floating.lua:10: BufLeave Autocommands
 for "<buffer=7>": Vim(lua):E5108: Error executing lua /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:358: attempt to call field '_unregister_events' (a nil value)
stack traceback:
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:358: in function '_unregister_events'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:329: in function 'wipeout'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/config.lua:108: in function 'action'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:215: in function 'do_action'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:348: in function 'callback'
        .../mjhd/.cache/nvim/vfiler.vim/lua/vfiler/events/event.lua:30: in function '_handle'
        [string ":lua"]:1: in main chunk
        [C]: in function 'nvim_win_close'
        ...d/.cache/nvim/vfiler.vim/lua/vfiler/windows/floating.lua:10: in function 'close'
        ...d/.cache/nvim/vfiler.vim/lua/vfiler/windows/floating.lua:93: in function 'close'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/view.lua:196: in function 'close'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:260: in function 'quit'
        ...jhd/.cache/nvim/vfiler.vim/lua/vfiler/actions/buffer.lua:16: in function 'action'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:215: in function 'do_action'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:196: in function '_do_action'
        [string ":lua"]:1: in main chunk
stack traceback:
        [C]: in function 'nvim_win_close'
        ...d/.cache/nvim/vfiler.vim/lua/vfiler/windows/floating.lua:10: in function 'close'
        ...d/.cache/nvim/vfiler.vim/lua/vfiler/windows/floating.lua:93: in function 'close'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/view.lua:196: in function 'close'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:260: in function 'quit'
        ...jhd/.cache/nvim/vfiler.vim/lua/vfiler/actions/buffer.lua:16: in function 'action'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:215: in function 'do_action'
        /home/mjhd/.cache/nvim/vfiler.vim/lua/vfiler/vfiler.lua:196: in function '_do_action'
        [string ":lua"]:1: in main chunk

OS: Ubuntu 22.04 on WSL2
Neovim:NVIM v0.9.1
vfiler.vim: 0edad19

feature request: a method that can tell if current item is a directory

Hello, I have a new idea I can somehow use the l key to open tree and open file without changing current directory. Then there is no need to move my finger from l to <CR> to open the file...

so in the "mapping" configuration, I may need something like below:

{
mapping = {
["l"] = function(vfiler, context, view)
if action.is_directory(vfiler, context, view) then
return action.open_tree(vfiler, context, view)
else
return action.open_file(vfiler, context, view)`
end
}
}

Yes, I need this action.is_directory(vfiler, context, view) API...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.