numToStr / FTerm.nvim

:fire: No-nonsense floating terminal plugin for neovim :fire:
MIT License
721 stars 24 forks source link

Support more window options #58

Closed jackfranklin closed 2 years ago

jackfranklin commented 2 years ago

This plugin is perfect for my needs but the one issue I had was that I wanted my terminal to be in the bottom right of the screen. I know I could calculate the right x/y to pass in, but in this instance I knew I wanted it anchored to the bottom right, and that I should use the number of cols/rows for the values.

Therefore I've created this PR to add the flexibility to let a user pass in the anchor option, which maps right through to the nvim_open_win property, and also pass col and row into dimensions, which will be used above x and y.

I'm very happy to change the approach or API of these options, if it's something you're willing to land, just let me know. Equally no problem if you don't want to merge this; I'll probably keep my own fork lying around so I can use it myself. Thanks!

numToStr commented 2 years ago

Thanks for the detailed description. I think adding anchor is pretty reasonable and I am in favor of it. But I am not sure about the dimensions.{row,col} as there are already dimensions.{x,y} and it might get confusing to some users. Thoughts??

Also, can you share your config? I would like to try it for myself.

jackfranklin commented 2 years ago

Yeah, totally understand that concern.

My config (with my fork) is :

require('FTerm').setup({
  dimensions = {
    width = 0.4,
    height = 0.8,
    row = vim.o.lines - vim.o.cmdheight - 1,
    col = vim.o.columns,
  },
  anchor = 'SE',
  border = 'double',
})

This has the effect of putting the window in the ~lower right side of the screen.

numToStr commented 2 years ago

Thanks, for sharing your config. I tried it for myself and below are the results

Screenshot_20220311_191038

Screenshot_20220311_191346

As you can see, you don't even need anchor to put the terminal in the bottom right. So, I guess your use case was already covered :)

jackfranklin commented 2 years ago

Oh awesome! What values for X and y did you use?

On Fri, 11 Mar 2022, 13:49 Vikas Raj, @.***> wrote:

Thanks, for sharing your config. I tried it for myself and below are the results

  • this PR

[image: Screenshot_20220311_191038] https://user-images.githubusercontent.com/24727447/157878907-eb824997-e1c4-446f-a164-25a69cb570e5.png

  • master

[image: Screenshot_20220311_191346] https://user-images.githubusercontent.com/24727447/157879387-81ef0d27-3522-41e8-abcc-e21f0e8ef326.png

As you can see, you don't even need anchor to put the terminal in the bottom right. So, I guess your use case was already covered :)

— Reply to this email directly, view it on GitHub https://github.com/numToStr/FTerm.nvim/pull/58#issuecomment-1065130855, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABPFVRT2PPW2JMAQUUHI2LU7NFO7ANCNFSM5QNUAT6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

numToStr commented 2 years ago

Ohh, I used this config

require('FTerm').setup({
    dimensions = {
        width = 0.4,
        height = 0.8,
        x = vim.o.columns,
        y = vim.o.lines,
    },
    border = 'double',
})
jackfranklin commented 2 years ago

Great! Sorry I somehow imagined that it wasn't possible. I'll close this PR. Thanks for your help, and for this plugin!