Coder Social home page Coder Social logo

Comments (4)

mrjones2014 avatar mrjones2014 commented on May 25, 2024

Hm, it sounds interesting but there are some semantics we'd have to nail down.

move_cursor_or_split, how does this work with config.wrap_at_edge = true?

split_longest_side should be relatively easy, basically:

local win = vim.api.nvim_get_current_win()
if vim.api.nvim_win_get_height(win) > vim.api.nvim_win_get_height(win) then
  vim.cmd('sp')
else
  vim.cmd('vsp')
end

Could you expand on how you see the semantics of move_cursor_or_split working, especially with relation to config.wrap_at_edge = true?

Consider also that there may be a mux window past the edge of the current Neovim split that we can move to. What happens if you move_cursor_or_split from a pane that is at the edge of Neovim, but there is a mux window next to it? Do we move to the mux window, or do we split?

from smart-splits.nvim.

IndianBoy42 avatar IndianBoy42 commented on May 25, 2024

wrap_at_edge I think should just not be respected by move_or_split. Maybe have change wrap_at_edge to at_edge="wrap" and have at_edge="split"? That is probably more consistent considering you don't have move_or_wrap. As long as at_edge can be chosen at keybinding time so the user can have all of the behaviors to different keys if they want

The semantics are basically move if possible and if there isn't a place to move, make a split. A mux window counts as a place to move so it should probably move. Wait how do mux windows interact with the wrap_at_edge config? It just goes to the mux window right?

True, split_longest_side does seem simple, any reason not to include it anyway to help users? It could get a bit more complicated to handle running a command after like :SplitLongest edit some_file

from smart-splits.nvim.

mrjones2014 avatar mrjones2014 commented on May 25, 2024

Wait how do mux windows interact with the wrap_at_edge config? It just goes to the mux window right?

Yeah, basically, when you're at a Neovim edge, the exact implementation varies per mux backend (tmux vs. Wezterm vs. Kitty) but it checks in some way if there is a mux window we can move to, and if not, then it wraps to the other side of Neovim.

Maybe have change wrap_at_edge to at_edge="wrap" and have at_edge="split"?

I try to avoid breaking changes if at all possible, but I suppose that's possible. I made a similar change when adding other mux backends, had config auto migrate itself, and printed a deprecation notice, which we could also do for this (wrap_at_edge = true would migrate to at_edge = 'wrap'). We'd need to include at_edge="stop" or something as well, in case you want neither of those behaviors.

from smart-splits.nvim.

IndianBoy42 avatar IndianBoy42 commented on May 25, 2024

Yeah, split, wrap and stop sounds correct.

from smart-splits.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.