Rename options and variable names for more clarity

The option is now `hide_dotfiles` because it makes sense to show them
by default.
The keybind `toggle_hidden` is now similarly renamed to `toggle_dotfiles`.
The variable `show_hidden` is renamed to `show_dotfiles` to also be
consistent with `show_ignored`.
This commit is contained in:
kosayoda 2020-08-03 11:07:40 +08:00
parent 160913193c
commit 160258d8ec
7 changed files with 45 additions and 45 deletions

View File

@ -31,7 +31,7 @@ let g:lua_tree_auto_open = 1 "0 by default, opens the tree when typing `vim $DIR
let g:lua_tree_auto_close = 1 "0 by default, closes the tree when it's the last window
let g:lua_tree_follow = 1 "0 by default, this option allows the cursor to be updated when entering a buffer
let g:lua_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open
let g:lua_tree_show_hidden = 0 "1 by default, this option shows files and folders starting with a dot `.`
let g:lua_tree_hide_dotfiles = 1 "0 by default, this option hides files and folders starting with a dot `.`
let g:lua_tree_show_icons = {
\ 'git': 1,
\ 'folders': 0,
@ -45,22 +45,22 @@ let g:lua_tree_show_icons = {
" You don't have to define all keys.
" NOTE: the 'edit' key will wrap/unwrap a folder and open a file
let g:lua_tree_bindings = {
\ 'edit': '<CR>',
\ 'edit_vsplit': '<C-v>',
\ 'edit_split': '<C-x>',
\ 'edit_tab': '<C-t>',
\ 'toggle_ignored': 'I',
\ 'toggle_hidden': 'H',
\ 'preview': '<Tab>',
\ 'cd': '<C-]>',
\ 'create': 'a',
\ 'remove': 'd',
\ 'rename': 'r',
\ 'cut': 'x',
\ 'copy': 'c',
\ 'paste': 'p',
\ 'prev_git_item': '[c',
\ 'next_git_item': ']c',
\ 'edit': '<CR>',
\ 'edit_vsplit': '<C-v>',
\ 'edit_split': '<C-x>',
\ 'edit_tab': '<C-t>',
\ 'toggle_ignored': 'I',
\ 'toggle_dotfiles': 'H',
\ 'preview': '<Tab>',
\ 'cd': '<C-]>',
\ 'create': 'a',
\ 'remove': 'd',
\ 'rename': 'r',
\ 'cut': 'x',
\ 'copy': 'c',
\ 'paste': 'p',
\ 'prev_git_item': '[c',
\ 'next_git_item': ']c',
}
" Disable default mappings by plugin

View File

@ -130,11 +130,11 @@ Default is 0
Can be `0` or `1`. When `1`, will display indent markers when folders are open
Default is 0
|g:lua_tree_show_hidden| *g:lua_tree_show_hidden*
|g:lua_tree_hide_dotfiles| *g:lua_tree_hide_dotfiles*
Can be `0` or `1`. When `1`, will show hidden files or folders, which
start with the `.` character.
Default is 1
Can be `0` or `1`. When `1`, will hide dotfiles, files or folders which start
with the `.` character.
Default is 0
==============================================================================
INFORMATIONS *nvim-tree-info*

View File

@ -13,7 +13,7 @@ g:lua_tree_icons nvim-tree-lua.txt /*g:lua_tree_icons*
g:lua_tree_ignore nvim-tree-lua.txt /*g:lua_tree_ignore*
g:lua_tree_indent_markers nvim-tree-lua.txt /*g:lua_tree_indent_markers*
g:lua_tree_show_icons nvim-tree-lua.txt /*g:lua_tree_show_icons*
g:lua_tree_show_hidden nvim-tree-lua.txt /*g:lua_tree_show_hidden*
g:lua_tree_hide_dotfiles nvim-tree-lua.txt /*g:lua_tree_hide_dotfiles*
g:lua_tree_side nvim-tree-lua.txt /*g:lua_tree_side*
g:lua_tree_size nvim-tree-lua.txt /*g:lua_tree_size*
lua_tree_highlight nvim-tree-lua.txt /*lua_tree_highlight*

View File

@ -45,22 +45,22 @@ end
function M.get_bindings()
local keybindings = vim.g.lua_tree_bindings or {}
return {
edit = keybindings.edit or '<CR>',
edit_vsplit = keybindings.edit_vsplit or '<C-v>',
edit_split = keybindings.edit_split or '<C-x>',
edit_tab = keybindings.edit_tab or '<C-t>',
preview = keybindings.preview or '<Tab>',
toggle_ignored = keybindings.toggle_ignored or 'I',
toggle_hidden = keybindings.toggle_hidden or 'H',
cd = keybindings.cd or '<C-]>',
create = keybindings.create or 'a',
remove = keybindings.remove or 'd',
rename = keybindings.rename or 'r',
cut = keybindings.cut or 'x',
copy = keybindings.copy or 'c',
paste = keybindings.paste or 'p',
prev_git_item = keybindings.prev_git_item or '[c',
next_git_item = keybindings.next_git_item or ']c',
edit = keybindings.edit or '<CR>',
edit_vsplit = keybindings.edit_vsplit or '<C-v>',
edit_split = keybindings.edit_split or '<C-x>',
edit_tab = keybindings.edit_tab or '<C-t>',
preview = keybindings.preview or '<Tab>',
toggle_ignored = keybindings.toggle_ignored or 'I',
toggle_dotfiles = keybindings.toggle_dotfiles or 'H',
cd = keybindings.cd or '<C-]>',
create = keybindings.create or 'a',
remove = keybindings.remove or 'd',
rename = keybindings.rename or 'r',
cut = keybindings.cut or 'x',
copy = keybindings.copy or 'c',
paste = keybindings.paste or 'p',
prev_git_item = keybindings.prev_git_item or '[c',
next_git_item = keybindings.next_git_item or ']c',
}
end

View File

@ -212,7 +212,7 @@ local function set_mappings()
[bindings.edit_split] = 'on_keypress("split")';
[bindings.edit_tab] = 'on_keypress("tabnew")';
[bindings.toggle_ignored] = 'on_keypress("toggle_ignored")';
[bindings.toggle_hidden] = 'on_keypress("toggle_hidden")';
[bindings.toggle_dotfiles] = 'on_keypress("toggle_dotfiles")';
[bindings.create] = 'on_keypress("create")';
[bindings.remove] = 'on_keypress("remove")';
[bindings.rename] = 'on_keypress("rename")';
@ -297,8 +297,8 @@ function M.toggle_ignored()
return M.refresh_tree()
end
function M.toggle_hidden()
pops.show_hidden = not pops.show_hidden
function M.toggle_dotfiles()
pops.show_dotfiles = not pops.show_dotfiles
return M.refresh_tree()
end

View File

@ -7,7 +7,7 @@ local luv = vim.loop
local M = {
show_ignored = false,
show_hidden = vim.g.lua_tree_show_hidden == 1,
show_dotfiles = vim.g.lua_tree_hide_dotfiles ~= 1,
}
local path_to_matching_str = require'lib.utils'.path_to_matching_str
@ -67,8 +67,8 @@ local function gen_ignore_check()
return function(path)
local ignore_path = not M.show_ignored and ignore_list[path] == true
local ignore_hidden = not M.show_hidden and path:sub(1, 1) == '.'
return ignore_path or ignore_hidden
local ignore_dotfiles = not M.show_dotfiles and path:sub(1, 1) == '.'
return ignore_path or ignore_dotfiles
end
end

View File

@ -46,7 +46,7 @@ local keypress_funcs = {
cut = fs.cut,
paste = fs.paste,
toggle_ignored = lib.toggle_ignored,
toggle_hidden = lib.toggle_hidden,
toggle_dotfiles = lib.toggle_dotfiles,
prev_git_item = gen_go_to('prev_git_item'),
next_git_item = gen_go_to('next_git_item'),
preview = function(node)