ptzz / lf.vim Goto Github PK
View Code? Open in Web Editor NEWThis project forked from francoiscabrol/ranger.vim
Lf integration in vim and neovim
This project forked from francoiscabrol/ranger.vim
Lf integration in vim and neovim
I added this code to my lfrc
in order to open text files with nvim and other files, like images, with xdg-open.
# Open with $EDITOR or xdg-open based on type of file
cmd open ${{
case $(file --mime-type "$f" -bL) in
text/*|application/json) $EDITOR "$f";;
*) xdg-open "$f" ;;
esac
}}
This works fine if I open lf
from the terminal. However, it does not work with lf
's vim plugin.
Steps to reproduce: open a file whose name contains spaces, then press the default <leader>f
mapping, and the vim-floaterm Lf window closes immediately after opening
Hi, I've been using this for a while so thank you!
With the latest build of lf, the configuration let g:lf_command_override = 'lf -command "set hidden"'
is not respected, while it used to.
If I try several times (\f q \f q \f q) it shows hidden files like 40% of the time; which is weird
What I think happens is set hidden
is actualy on, because even when .files do not show, using my mapping for set hidden!
in the lf buffer does nothing on the first press, and then shows hidden files on the second press, which means it was set in the first place. Indeed, on reload
it shows hidden files.
Edit: I tried running lf -command "set hidden"
outside of vim and I have the same issue, so I guess this is related to lf. I will try debugging it and open an issue over there in case
See this PR which was just merged; it looks like g:floaterm_open_command
was replaced with g:floaterm_opener
, and it works somewhat differently. I tried removing the g:floaterm_open_command
argument from this line altogether, as seen on the upstream wrapper, but it did not work. Documentation for g:floaterm_opener
should be here.
The error I get is:
Error detected while processing function <SNR>97_on_floaterm_close[26]..LfCallback[21]..floaterm#util#open:
line 2:
E730: using List as a String
I am on Windows 10 PowerShell and using Neovim.
lfrc is cmd open $nvim %f%
Lf spawned from neovim does not allow me to open file using l or right arrow key, however lf spawned from powershell works fine. Am I missing something ?
Hello,
If i start the lf plug in, when i try to exit the file explorer i don't immediately get back where i started but i get a blank page first with the text
[Process exited 0]
and on the status line
term://.//31215:lf -selection-path=/tmp/chosenfile "some/path"
I then have to press q again to properly exit.
For *Existing* the new buffer is opened even if the file is already open.
For *NewTab* opens in a new buffer instead of a tab
VIM 9.1 from arch linux repo
GVim 90
Windows 22H2
When I run :Lf
it is going to go to the location for the previous buffer in the first try, I have to hit q
and run :Lf
again for it to go to the current buffer's directory. Any idea what is happening here? My vim's current directory works fine when I run something like :!pwd
. It is only on Lf that it behaves like this.
And thank you for this awesome extension.
Error detected while processing function 109_on_floaterm_close[27]..LfCallback:
line 26:
lf returned non-zero exit code 127
I just noticed a strange bug after using lf for some time. Here is how to reproduce it:
Open nvim with several files as arguments:
nvim a.txt b.txt c.txt
The file a.txt
will be displayed on start. Open and quit the lf plugin. File c.txt
gets displayed. I think that the correct behavior is to display the buffer from which you launched lf.
I am using https://github.com/itchyny/lightline.vim as my neovim status line, after opening a file from lf
status line disappears.
Have attached two snaps
I am guessing it's a redraw issue
Using the keys 'l' or '' it opens the file fine, however, pressing 'e' opens up a nested neovim instance. 'e' would be the more intuitive way for me to open files.
NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5
Using let g:lf_replace_netrw = 1
is not working after the switch to floating windows: nvim DIRECTORY
opens an an empty buffer where the directory is open and visible in a floating terminal, but the focus is on the buffer.
Floaterm window closes immediately after running :Lf
I have lf.vim loading before vim-floaterm in init.vim, so I'm not sure what's going on.
I want to combine this plugin with Telescope on a command. For example I want to switch to a directory and do a live grep in it using Telescope. The issue is that right now without this option I have to manually use vim internal cd
command to do it. I see a Lfcd and Lflcd in commands related to Lf but can't find any documentation about them and not sure how to use it. Is there a way to use Lf to change directory without changing the current buffer?
Sorry for asking this here as I know it is more of a question rather than a bug but there is no discussion tab.
Thanks
Hello, I recently updated to the most recent version of this plugin, and I keep getting the "Failed to open a floating terminal. Make sure
voldikss/vim-floaterm is installed."
error when trying to open using :Lf
Is there no way of using this plugin now without using Floatterm?
I'm also in Neovim so there's no need for the floatterm plugin as that's builtin to nvim
Thanks!
Hi I would like to specify a folder when I activate Lfcd
like in :Lfcd my/custom/path
.
Lf normally gets opened in the current directory, I have a special commands where I only look for projects, and all my projects are in a workspace dir, which I would like here to popup.
Sadly the custom -command
options doesn't help here in overwriting the directory.
I looked through it but very much suck in vim script, if you could add that I would really appreciate it :)
First of all thank you for this plugin. This issue is probably not related to it but I want to know the reason behind.
I'm using fzf.vim and its History
command a lot. The issue is that this command does not list recent files opened via lf. This also should not be related to fzf.vim because I have the same situation with another plugin called 'Startify'. It must be a VIM behavior that must be set via a config but I don't know what it is, if there is a such a config of course.
Maybe each of these and other similar plugins maintain their own MRU lists and I hope it's not true.
Thanks in advance.
I open LF inside the Floaterm as usual, but when I try to open file from the LF - I got this error:
Error detected while processing function <SNR>157_on_floaterm_close[26]..LfCallback:
line 21:
E108: No such variable: "s:edit_cmd"
And instead of opening file in the separate buffer and tab, NeoVIM opens it in the vertical split.
I tried two NeoVIM versions:
:version
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wex
tra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-com
mon -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build
/neovim/src/neovim-0.4.4/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
And Neovim nighty:
:version
NVIM v0.5.0-dev+1085-g52397aaa0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconvers
ion -Wmissing-prototypes -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DN
VIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/in
clude -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az205-835
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/share/nvim"
Run :checkhealth for more info
Both are the same.
My init.vim
:
call plug#begin('~/.local/share/nvim/plugged')
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/vim-hug-neovim-rpc'
endif
Plug 'NLKNguyen/papercolor-theme'
Plug 'ncm2/ncm2' " autocompletion
Plug 'roxma/nvim-yarp' " autocompletion
Plug 'neovimhaskell/haskell-vim'
Plug 'tpope/vim-surround'
Plug 'Yggdroot/indentLine'
Plug 'vim-syntastic/syntastic'
Plug 'vim-airline/vim-airline-themes'
Plug 'bling/vim-airline'
Plug 'mhinz/vim-signify'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-commentary'
" Plug 'easymotion/vim-easymotion'
Plug 'mattn/Stupid-EasyMotion'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' }
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'vimwiki/vimwiki'
" { integration with lf
Plug 'rbgrouleff/bclose.vim'
Plug 'ptzz/lf.vim'
"wrapper for floating window
Plug 'voldikss/vim-floaterm'
" }
Plug 'dhruvasagar/vim-table-mode'
Plug 'junegunn/goyo.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'liuchengxu/vim-which-key'
"Cheat sheet
Plug 'RishabhRD/popfix'
Plug 'RishabhRD/nvim-cheat.sh'
" Syntax highlighting
Plug 'sheerun/vim-polyglot'
call plug#end()
...
" LF
command! LF FloatermNew lf
let g:lf_replace_netrw = 1
let g:lf_map_keys = 0
nmap <leader>o :LF<CR>
...
When opening a new window with <leader> f
it seems that lf's default keybindings cause issues.
When pressing <Esc>
with the lf floaterm window open, it tries to open the file in the buffer that I had open when initializing the window. Further keypresses of <Esc>
cause the file to enter -- INSERT --
mode, and inserts newlines of exit
, and if i long-press <Esc>
, random text will be inserted in newlines depending on how long the key is held.
I can't exit the insert mode either, unless I use my custom keybind for <Esc>
. Upon exiting, it enters a read-only view of lf of the file, allowing the normal q
keybind to be used to go back to original lf view.
Sorry about the inconvenience caused by the change of wrapper API in vim-floaterm. I promise there won't be another changes in a long time...
Please update the lf.vim according to the patch. Once lf.vim is updated, I'll merge voldikss/vim-floaterm#261
diff --git a/autoload/floaterm/wrapper/lf.vim b/autoload/floaterm/wrapper/lf.vim
index 30b2956..dd7ba65 100644
--- a/autoload/floaterm/wrapper/lf.vim
+++ b/autoload/floaterm/wrapper/lf.vim
@@ -1,4 +1,4 @@
-function! floaterm#wrapper#lf#(cmd) abort
+function! floaterm#wrapper#lf#(cmd, jobopts, ...) abort
let lf_tmpfile = tempname()
let lastdir_tmpfile = tempname()
let original_dir = getcwd()
@@ -14,5 +14,6 @@ function! floaterm#wrapper#lf#(cmd) abort
exe "lcd " . original_dir
let cmd = [&shell, &shellcmdflag, cmd]
- return [cmd, {'on_exit': funcref('LfCallback', [lf_tmpfile, lastdir_tmpfile])}, v:false]
+ let a:jobopts.on_exit = funcref('LfCallback', [lf_tmpfile, lastdir_tmpfile])
+ return [v:false, cmd]
endfunction
Personnally, I think this project is great. I am a vim and lf user for my daily work so this plugin was a real life saver.
It's a shame that this project can't be found in Vim Awesome.
I don't know if you know about this site, but it's like a store for vim plugins were everyone can look for plugins to install.
The link is here
Of course, there is no need to add your project here. I just think it could be cool if more people know about your work.
Kind regards
Hi,
Is there a way to set dynamic values for width / height?
ie: If I opens up the terminal in full screen or in smaller size, it'd have the proper values set according to the terminal size.
I tried different things for g:lf_width
/ g:lf_height
variables without success, and if I just leave the default values, the ones from LF itself, it doesn't seem to work properly for me.
I ended up doing a small hack in those floaterm values, here:
Line 36 in eab8f04
But I was wondering if we can accomplish this without messing with the plugin files. Maybe those two variables could have dynamic values?
Let me show you what I mean:
Thanks.
I can't seem to find the option or documentation to enable opening files using LF in vertical split by default, is there any way to do that, instead of defaulting to horizontal split when opening files? Thanks
Could you disable the line numbers in the buffer that gets created when lf is launched? They are not adding anything and hence are distracting. It is also confusing that the one at the bottom of the buffer gets highlighted.
Hey ptzz,
Appreciate your work on this plugin. I am trying to set it up and have followed installation steps and installed dependencies of floaterm as well.
While calling any of the Lf commands, I am getting error -
Error detected while processing function <SNR>92_on_floaterm_close[27]..LfCallback:
line 26:
lf returned non-zero exit code 127
I checked scriptnames and 92nd Script is: vim-floaterm/autoload/floaterm/terminal.vim
. Here
I just ensured all plugins are at the latest version.
Is there anything that I am missing?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.