laktak / extrakto

extrakto for tmux - quickly select, copy/insert/complete text without a mouse
MIT License
878 stars 45 forks source link

Add options #7

Closed ivanalejandro0 closed 7 years ago

ivanalejandro0 commented 7 years ago

Changes list:

I wanted to have more than the default 6 lines of height on the tmux window and I thought that it may be useful to have extrakto as a sidebar as well on some cases, so I went ahead and added configuration options.

This is how it looks with more height:

set -g @extrakto_window_split_direction 'v'
set -g @extrakto_window_lines "20"

screenshot_20171001_150400

This is how it looks as an horizontal sidebar:

set -g @extrakto_window_split_direction 'h'
set -g @extrakto_window_lines "50"

screenshot_20171001_150238

maximbaz commented 7 years ago

Oh that is a good change, love it!

Would it be too much of an ask to add one more configuration option, for the number of lines outside the visible content in the pane? In other words, parameterize the 32768 part in the line below:

https://github.com/laktak/extrakto/blob/6c17243bd7ae70c907d2ea4bc7b5b3cf3f6f0cb7/tmux-extrakto#L19

It was briefly discussed in #4. It is especially useful in combination with the extrakto_window_lines that you introduce here, e.g. if I expect extrakto pane to hide half of the content, I want to increase the number, but if I make extrakto pane very narrow, I would probably prefer to decrease that number to something around 0.

ivanalejandro0 commented 7 years ago

@maximbaz interesting idea, I like it

I don't mind adding it, but since I think it needs some discussion I'd rather handle this in a different PR/ticket for it.

I think that instead of adding a config option for "how many lines you want to grab" it may be easier to grasp for a user to pick different presets, like: "grab from all the contents" or "grab only from visible area".

Proposed option name: @extrakto_grab_from Options: visible, all Default: I think that all for default makes more sense, since fzf is really fast and I think that trying to grab something from the screen that just got pushed out of sight is a pretty common case.

Grabbing from visible will require to capture with -X being X the vertical lines, or 0 if horizontal.

maximbaz commented 7 years ago

I think @laktak also had presets in mind, and I agree that such concept is easier to grasp for a user. I like seeing it how you describe this, it all makes sense to me: name, options, the default. 👍

ivanalejandro0 commented 7 years ago

I've created https://github.com/laktak/extrakto/issues/8 to handle that option, please take a look to see if I missed something.

laktak commented 7 years ago

I was a bit confused at first beause a vertical split in vim is horizontal in tmux. I'm not a native english speaker so I found this a bit strange to say the least.

Anyways ;) thanks for the PR! Looks good but could you change the option names to

set -g @extrakto_split_direction 'v'
set -g @extrakto_split_size '6'

(because @extrakto_window_lines is not a good match with 'h')?

ivanalejandro0 commented 7 years ago

Yeah, while writing this PR I thought something was wrong because of that vim/tmux difference in naming. I'm not a native speaker either :), I guess it may be because you can refer to "horizontal" as "to split horizontally" or "to arrange horizontally".

I like your names better, shorter and more meaningful. Changes pushed.

laktak commented 7 years ago

Great, thanks!