Skip to content

Conversation

@mg979
Copy link

@mg979 mg979 commented Feb 13, 2018

I edited mostly the text file, so that it looks like a 3-columns table in vim. First tab is still there, so fuzzy search works as before. It needed 3 small changes in the plugin too.

path_to_commands = path_to_script.replace('cmdpalette.vim', 'internal_commands.txt')
with open(path_to_commands) as commands_file:
internal_commands = [l.strip() for l in commands_file.readlines()]
internal_commands = [l.rstrip() for l in commands_file.readlines()]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left 2 leading spaces, because ctrlp adds 2, so 4 make a tab. It made it easier(if not possible) to align the rest of the table.


# convert to list, remove empties, discard 4 first columns and take first word
custom_commands = [x[4:].split()[0] + '\t(custom command)'
custom_commands = [' ' + x[4:].split()[0] + ' *'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 leading spaces also here. I replaced (custom command) with an asterisk, because that string cannot be aligned, and it makes the table less readable.

redraw
call feedkeys(':', 'n')
call feedkeys(split(a:str, '\t')[0], 'n')
call feedkeys(strpart(split(a:str, '\t')[0], 2), 'n')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The leading spaces are removed here, before the command is inserted in the command line.

@fisadev
Copy link
Owner

fisadev commented Mar 13, 2018

Nice! I'll test it and merge it today :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants