Closed Toraja closed 1 year ago
install plugin
(While this installs all the plugin, this is convenient as it checks the version of nnn and installs compatible ones)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs)"
fish
set --local preview_tui_key p
# start with preview
alias nnn="nnn -P$preview_tui_key"
# `a`: preview-tui requires fifo
# `e`: nnn does not open file without this
# `H`: display hidden files by default
set --export NNN_OPTS aeH
set --export NNN_PLUG "$preview_tui_key:preview-tui"
# preview-tui
set --export NNN_BATTHEME 'Monokai Extended' # seems not working
nvim
use {
"luukvbaal/nnn.nvim",
cond = function() return vim.fn.executable('nnn') end,
config = function()
local builtin = require("nnn").builtin
require("nnn").setup({
picker = {
-- should not use tmux here as it will be nested tmux and fail to preview
cmd = "nnn -Pp",
style = {
width = 0.95, -- percentage relative to terminal size when < 1, absolute otherwise
height = 0.9,
}
},
mappings = {
{ "<C-t>", builtin.open_in_tab }, -- open file(s) in tab
{ "<C-s>", builtin.open_in_split }, -- open file(s) in split
{ "<C-v>", builtin.open_in_vsplit }, -- open file(s) in vertical split
{ "<C-p>", builtin.open_in_preview }, -- open file in preview split keeping nnn focused
{ "<C-y>", builtin.copy_to_clipboard }, -- copy file(s) to clipboard
{ "<C-w>", builtin.cd_to_path }, -- cd to file directory
{ "<C-e>", builtin.populate_cmdline }, -- populate cmdline (:) with file(s)
}
})
vim.keymap.set('n', '<Leader>e', "<Cmd>NnnPicker<CR>", { desc = "nnn" })
end,
}
nnn
Ranger