Git Product home page Git Product logo

lf.vim's Introduction

lf.vim

lf integration in vim and neovim

lf.vim

Installation

Install it with your favorite plugin manager. Example with vim-plug:

    Plug 'ptzz/lf.vim'

Then, add the vim-floaterm dependency:

    Plug 'voldikss/vim-floaterm'

Note: lf.vim should be loaded before vim-floaterm to override vim-floaterm's lf wrapper.

How to use it

The default shortcut for opening lf is <leader>f (\f by default). To disable the default key mapping, add this line in your .vimrc or init.vim: let g:lf_map_keys = 0. Then you can add a new mapping with this line: map <leader>f :Lf<CR>.

To set the floating window width and height, set g:lf_width and g:lf_height accordingly. If not found, it will default to g:floaterm_width and g:floaterm_height.

The command for opening lf in the current file's directory is :Lf. When opening (default 'l' and '<right>') a file from the lf window, vim will open the selected file in the current window. To open the selected file in a new tab instead use :LfNewTab.

(Note that the lf open command is required to return to the originating vim session. E.g. the edit command opens a new process of $EDITOR.)

For opening lf in the current workspace, run :LfWorkingDirectory. Vim will open the selected file in the current window. :LfWorkingDirectoryNewTab will open the selected file in a new tab instead.

For changing the current directory via lf, run :Lfcdor run :Lflcd for the current window.

List of commands:

" Change directory with lf via cd or lcd
Lfcd
Lflcd

Lf " Open current file by default
LfCurrentFile " Default Lf behaviour
LfCurrentDirectory
LfWorkingDirectory

" Always open in new tabs
LfNewTab
LfCurrentFileNewTab
LfCurrentDirectoryNewTab
LfWorkingDirectoryNewTab

" Open tab if it exists or in new tab if it does not
LfCurrentFileExistingOrNewTab
LfCurrentDirectoryExistingOrNewTab
LfWorkingDirectoryExistingOrNewTab

The old way to make vim open the selected file in a new tab was to add let g:lf_open_new_tab = 1 in your .vimrc or init.vim. That way is still supported but deprecated.

Opening lf instead of netrw when you open a directory

If you want to see vim opening lf when you open a directory (ex: nvim ./dir or :edit ./dir), please add this in your .(n)vimrc.

let g:NERDTreeHijackNetrw = 0 " Add this line if you use NERDTree
let g:lf_replace_netrw = 1 " Open lf when vim opens a directory

Setting a custom lf command

By default lf is opened with the command lf but you can set an other custom command by setting the g:lf_command_override variable in your .(n)vimrc.

For instance if you want to display the hidden files by default you can write:

let g:lf_command_override = 'lf -command "set hidden"'

lf.vim's People

Contributors

alaskra avatar apenpfkkhm avatar augustfengd avatar divramod avatar enthudave avatar francoiscabrol avatar gauteh avatar hlidotbe avatar lmburns avatar mar04 avatar michelesr avatar mroavi avatar nitsas avatar ptzz avatar sitiom avatar theethernaut avatar tillbaks avatar wikimatze avatar zahyur avatar

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.