justinmk / vim-gtfo

Go to Terminal or File manager :point_right:
321 stars 17 forks source link

'got' causes alacritty to hang #50

Open nghialm269 opened 5 years ago

nghialm269 commented 5 years ago

I configured gtfo to launch alacritty like this: let g:gtfo#terminals = { 'unix': 'alacritty --working-directory' }

When I type got, my neovim (alacritty) hangs and another alacritty instance shows up at the current file's directory. When I close this alacritty instance, the one with neovim start to work again.

Is there anyway to make got spawns terminal in the background so that neovim doesn't hang?

I tried:

levriero commented 4 years ago

Hey, apologies for resurrecting a year old issue but I landed in here after running into the same issue.

This is caused because alacritty expects a value to be passed when using the --working-directory flag, this error is likely swallowed and not presented in the buffer.

To get this to work set the unix value as so:

let g:gtfo#terminals = { 'unix': 'alacritty --working-directory $(pwd -P) &' }

Hope it helps!

nghialm269 commented 4 years ago

Hey, apologies for resurrecting a year old issue but I landed in here after running into the same issue.

This is caused because alacritty expects a value to be passed when using the --working-directory flag, this error is likely swallowed and not presented in the buffer.

To get this to work set the unix value as so:

let g:gtfo#terminals = { 'unix': 'alacritty --working-directory $(pwd -P) &' }

Hope it helps!

Hi, thanks for leaving a comment here, I just try your suggestion, it indeed doesn't block the neovim instance anymore, but it opens alacritty in the working directory (the one where I launched neovim), not the current file's containing directory.

Is there anyway to get the current file's directory and pass it to alacritty instead of $(pwd -P)?

nghialm269 commented 4 years ago

@gbonfant thanks, I managed to make it work now:

nnoremap <silent> got :call <SID>gtfo_terminal()<CR>

function! s:gtfo_terminal()
  let g:gtfo#terminals = { 'unix': 'alacritty --working-directory ' . expand("%:p:h") . ' &' }
  call gtfo#open#term("%:p:h", "")
endfunction

I don't know viml so maybe there is a better way to do this.

justinmk commented 4 years ago
  let g:gtfo#terminals = { 'unix': 'alacritty --working-directory ' . expand("%:p:h") . ' &' }

should probably add this and other terminal variants to the readme. Though g:gtfo#terminals needs to be reworked in general...

WANDEX commented 3 years ago

Hi, sorry for necro bump, but i guess following could help someone like me. LINUX ONLY SOLUTION works with both (got & goT) mappings Using linux utility from util-linux package setsid -f - Always create a new process.

let g:gtfo#terminals = { 'unix': 'setsid -f alacritty --working-directory ' } " works both (got & goT)