You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 24, 2023. It is now read-only.
Replacing contents in visual block selection mode is not working as expected when returning contents from a function decorated with @snake.visual_key_map.
Example, .vimrc.py
import snake
def _try_int(text):
try:
val = int(text)
return val
except ValueError:
return 0
def format_numbers(numbers):
max_number = max(numbers)
no_of_digits_in_max_no = len(str(max_number))
format_string = '%{}d'.format(no_of_digits_in_max_no)
return [format_string % no for no in numbers]
@snake.visual_key_map("<leader>fmt")
def align_numbers(selected_snippet):
selected_numbers = selected_snippet.split('\n')
numbers = [_try_int(no) for no in selected_numbers]
return '\n'.join(format_numbers(numbers))
Replacing contents in visual block selection mode is not working as expected when returning contents from a function decorated with
@snake.visual_key_map
.Example,
.vimrc.py
Given file:
After selecting the number block and pressing
<leader>fmt
Result:
Expected:
Gif for demonstration:
Result:
Expected:
The text was updated successfully, but these errors were encountered: