jessekelighine / vindent.vim

Navigate and select text by indentations in Vim.
41 stars 1 forks source link

`vii` and related selections behave confusingly? #11

Open JulianoLagana opened 2 weeks ago

JulianoLagana commented 2 weeks ago

The motions all work correctly ([+, [=, etc) for me, but the selections behave confusingly. One such example is vii. For the following code:

def get_dependencies(country: str, granularity: str, market_type: str) -> list[str]:
    dataset_name = get_dataset_name(country, granularity)
    return [
        f"data/datasets/{country}_BTR/{dataset_name}/dataframes_{market_type}/",
        "src/catella/btr/listing_data_aggregation/aggregate.py",
        "src/catella/btr/listing_data_aggregation/aggregation_utils.py",
        "src/catella/btr/listing_data_aggregation/config/config.yaml",
        f"src/catella/btr/listing_data_aggregation/config/dataset/{dataset_name.lower()}.yaml",
    ]

def get_outs(country: str, granularity: str, market_type: str) -> list[str]:
    if country == "DE" and granularity == "postcode":
        return [
            f"data/datasets/aggregated_{property_type}_{market_type}.parquet"
            for property_type in ["all", "new_constructions", "old_constructions"]
        ]
    elif country == "FR" and granularity == "commune":
        return [
            f"data/datasets/FR_BTR/aggregated_data/aggregated_all_{market_type}.parquet"
        ]
    else:
        raise ValueError(f"Country {country}, granularity {granularity} not supported")

If the cursor is in line 4 (f"data/datasets...), and I type vii, the cursor moves to line 13 (if country == "DE"...) and highlights the part country=="DE" and granularity == "postcode":. I was expecting the lines 4-8 to be highlighted instead.


My setup (neovim):

I use lazy, so I installed it with

lua/plugins/vindent.lua:

return {
  'jessekelighine/vindent.vim',
  init = function()
    -- Keybindings for vindent.vim
    vim.g.vindent_motion_OO_prev   = '[=' -- jump to prev block of same indent.
    vim.g.vindent_motion_OO_next   = ']=' -- jump to next block of same indent.
    vim.g.vindent_motion_more_prev = '[+' -- jump to prev line with more indent.
    vim.g.vindent_motion_more_next = ']+' -- jump to next line with more indent.
    vim.g.vindent_motion_less_prev = '[-' -- jump to prev line with less indent.
    vim.g.vindent_motion_less_next = ']-' -- jump to next line with less indent.
    vim.g.vindent_motion_diff_prev = '[;' -- jump to prev line with different indent.
    vim.g.vindent_motion_diff_next = '];' -- jump to next line with different indent.
    vim.g.vindent_motion_XX_ss     = '[p' -- jump to start of the current block scope.
    vim.g.vindent_motion_XX_se     = ']p' -- jump to end of the current block scope.
    vim.g.vindent_object_XX_ii     = 'ii' -- select current block.
    vim.g.vindent_object_XX_ai     = 'ai' -- select current block + one extra line at beginning.
    vim.g.vindent_object_XX_aI     = 'aI' -- select current block + two extra lines at beginning and end.
    vim.g.vindent_jumps            = 1    -- make vindent motion count as a |jump-motion|.
  end,
  config = function()
    -- Additional config if needed
  end
}

init.lua:

...
require('lazy').setup("plugins")
...
jessekelighine commented 1 week ago

Hi, I couldn't replicate behavior. I tried your setup in lazy.nvim and it did highlight lines 4-8. Do you have any other information about the problem?