-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table-like formatting #11
base: master
Are you sure you want to change the base?
Conversation
@@ -55,15 +55,15 @@ import json | |||
path_to_script = vim.eval('expand("<sfile>")') | |||
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()] |
There was a problem hiding this comment.
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.
autoload/ctrlp/cmdpalette.vim
Outdated
|
||
# obtain the custom commands | ||
vim.command('redir => custom_commands') | ||
vim.command('silent command') | ||
vim.command('redir END') | ||
|
||
# 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] + ' *' |
There was a problem hiding this comment.
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.
@@ -99,7 +99,7 @@ func! ctrlp#cmdpalette#accept(mode, str) | |||
call ctrlp#exit() | |||
redraw | |||
call feedkeys(':', 'n') | |||
call feedkeys(split(a:str, '\t')[0], 'n') | |||
call feedkeys(strpart(split(a:str, '\t')[0], 2), 'n') |
There was a problem hiding this comment.
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.
Nice! I'll test it and merge it today :) |
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.