PJdan's blog

By PJdan, 3 months ago, In English

I use competitive companion and the Competitive Programming Helper to import problems directly to VSCode. The problem is that submitting is slow via the cph-submit plugin. Plus, Firefox has to be opened for that plugin to work.

Here is the solution:

  • Install cf-tool
  • Add this snippet to keybindings.json in VSCode:

 "key": "alt+f",
 "command": "workbench.action.terminal.sendSequence",
 "args": { "text": "cf submit -f ${fileBasename} ${fileBasenameNoExtension}\u000D"}

\u000D is Unicode for new line.

Of course, you can adjust the alt+f keyboard combination to your liking.

N.B: I've set CPH to create short ID for the generated files.

For Sublime Text users, make sure that the cf-tool is installed of course, and then follow these steps:

  • Install Terminus
  • Install SendCode
  • In the SendCode settings, set the target terminal to Terminus
  • In the key bindings of SendCode paste this code:

 "keys": ["super+enter"], "command": "send_code",
 "args": {"cmd": "cf submit -f $file_name $file_base_name\u000D"},
 "context": [
  { "key": "selector", "operator": "equal", "operand": "source" }

Of course, you can adjust the super+enter keyboard combination to your liking, just make sure that it's unique.

  • Open a Terminus pane (you could set a shortcut for this in the Terminus key bindings)
  • Use the shortcut super+enter

N.B: You have to make sure that the name of the file is the same as the Codeforces ID of the problem.

Read more »

  • Vote: I like it
  • +11
  • Vote: I do not like it