vim-floaterm icon indicating copy to clipboard operation
vim-floaterm copied to clipboard

toggle floaterm in current file directory instead of working directory?

Open shaeinst opened this issue 2 years ago • 4 comments

gone through the docs and reamdme but didn't find what i am looking for. So, is there any way to toggle floaterm in current file directory (directory of current buffer) instead of working directory?

shaeinst avatar Apr 04 '22 16:04 shaeinst

This can be achieved in command mode by:

:FloatermNew --cwd %:h

where, %:h refers to full path to current file without filename itself. Check link here to know how files/directories are named in vim.

QiangZiBro avatar Sep 16 '22 04:09 QiangZiBro

A shortcut for this feature is also nice, I use <leader>7

noremap <silent><leader>7   :FloatermNew --cwd %:h<CR>

QiangZiBro avatar Sep 16 '22 05:09 QiangZiBro

i use penvim to detect and change working directory to project root directory. :FloatermNew --cwd %:h<CR> don't work. it just opens the floaterm to root directory instead of current file directory

shaeinst avatar Sep 16 '22 05:09 shaeinst

Just checked, only :FloatermNew --cwd=<buffer> works, and :FloatermNew --cwd <buffer> still open in <root>

QiangZiBro avatar Sep 16 '22 05:09 QiangZiBro