-
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?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()] | ||
|
||
# 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 commentThe reason will be displayed to describe this comment to others. Learn more. 2 leading spaces also here. I replaced |
||
for x in vim.eval('custom_commands').split('\n') | ||
if x.strip()] | ||
# remove header | ||
|
@@ -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 commentThe 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. |
||
if g:ctrlp_cmdpalette_execute == 1 | ||
call feedkeys("\<CR>", 'n') | ||
endif | ||
|
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.