Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khadegd/vim-lf
https://github.com/khadegd/vim-lf
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/khadegd/vim-lf
- Owner: khadegd
- License: other
- Created: 2020-04-09T03:06:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-25T14:13:58.000Z (over 4 years ago)
- Last Synced: 2024-07-16T18:13:07.018Z (2 months ago)
- Language: Vim script
- Size: 121 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lf.vim
Fast and featureful file manager in vim/neovim powered by lf.
colorscheme yin### Requirements
1. lf (minimum version 2.2)
2. Neovim or Vim 8.1 with terminal support### Install
You must install lf itself. Instructions
[here](https://github.com/jarun/lf#installation).Then install using your favorite plugin manager:
```vim
" using vim-plug
Plug 'mcchrish/lf.vim'
```### Usage
To open lf as a file picker in vim/neovim, use the command `:NnnPicker` or
`:Np` or the key-binding `n`. You can pass a directory to `:NnnPicker`
command and opens lf from there e.g. `:NnnPicker path/to/somewhere`.Once you [select](https://github.com/jarun/lf#selection) one or more files and
press enter, vim quits the lf window and opens the first selected
file and add the remaining files to the arg list/buffer list.Pressing enter on a file in lf will pick any earlier selection, pick
the file and exit lf.Note that pressing l or Right on a file would open it
instead of picking.To discard selection and exit, press ^G.
Please visit the complete documentation by running `:help lf`.
### Configurations
#### Custom mappings
```vim
" Disable default mappings
let g:lf#set_default_mappings = 0" Then set your own
nnoremap nn :NnnPicker" Or override
" Start lf in the current file's directory
nnoremap n :NnnPicker '%:p:h'
```#### Layout
```vim
" Opens the lf window in a split
let g:lf#layout = 'new' " or vnew, tabnew etc." Or pass a dictionary with window size
let g:lf#layout = { 'left': '~20%' } " or right, up, down" Floating window (neovim latest and vim with patch 8.2.191)
let g:lf#layout = { 'window': { 'width': 0.9, 'height': 0.6, 'highlight': 'Debug' } }
```#### Action
You can set extra key-bindings for opening files in different ways. Nothing is
set by default to not override lf's own key-bindings.```vim
let g:lf#action = {
\ '': 'tab split',
\ '': 'split',
\ '': 'vsplit' }
```For example, when inside an lf window, pressing ctrl-t will open the
selected file in a tab, instead of the current window. ctrl-x will
open in a split an so on. Meanwhile for multi selected files will be loaded in
the buffer list.#### Command override
When you want to override the default lf command and add some extra flags.
Example you want to start lf in detail mode.```vim
let g:lf#command = 'lf -d'" or pass some env variables
let g:lf#command = 'NNN_TRASH=1 lf -d'
```#### `lf#pick()`
The `lf#pick([][,])` function can be called with custom directory
and additional options such as opening file in splits or tabs. Basically a more
configurable version of `:NnnPicker` command.```vim
call lf#pick('~/some-files', { 'edit': 'vertical split' })
" Then you can do all kinds of mappings if you want
````opts` can be:
- `edit` - type of window the select file will be open.
- `layout` - same as `g:lf#layout` and overrides it if specified.#### Environment variables
You can define env variables in `vimrc` and lf will detect it.
```vim
let $NNN_TRASH=1
```### Credits
Main lf program: https://github.com/jarun/lf