{"id":19133757,"url":"https://github.com/chazmcgarvey/vimcoder","last_synced_at":"2025-05-06T19:23:04.468Z","repository":{"id":4331647,"uuid":"5466992","full_name":"chazmcgarvey/vimcoder","owner":"chazmcgarvey","description":"The topcoder vim editor plug-in.","archived":false,"fork":false,"pushed_at":"2017-04-09T01:43:08.000Z","size":98,"stargazers_count":67,"open_issues_count":5,"forks_count":22,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-31T02:05:25.796Z","etag":null,"topics":["topcoder","vim"],"latest_commit_sha":null,"homepage":"http://www.vim.org/scripts/script.php?script_id=3321","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chazmcgarvey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-18T23:36:21.000Z","updated_at":"2023-04-04T02:29:45.000Z","dependencies_parsed_at":"2022-09-20T23:03:23.809Z","dependency_job_id":null,"html_url":"https://github.com/chazmcgarvey/vimcoder","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chazmcgarvey%2Fvimcoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chazmcgarvey%2Fvimcoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chazmcgarvey%2Fvimcoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chazmcgarvey%2Fvimcoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chazmcgarvey","download_url":"https://codeload.github.com/chazmcgarvey/vimcoder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249638250,"owners_count":21304305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["topcoder","vim"],"created_at":"2024-11-09T06:23:44.313Z","updated_at":"2025-04-19T07:33:19.037Z","avatar_url":"https://github.com/chazmcgarvey.png","language":"Java","readme":"\nVim + TopCoder = VimCoder\n=========================\n\n![VimCoder Logo](http://chazmcgarvey.github.com/vimcoder/img/vimcoder.png)\n\nThis plug-in makes it easy to use [Vim](http://www.vim.org/) as your\ntext editor in the [TopCoder Competition Arena](http://topcoder.com/tc).\nIt aims to be minimal in comparison to other editors such as\n[KawigiEdit](http://topcoder.yajags.com/) or\n[CodeProcessor](http://www.topcoder.com/tc?module=Static\u0026d1=applet\u0026d2=plugins)\nplug-in chains while also providing enough functionality to also be useful.\n\nFeatures\n--------\n\n* Works on any platform that the TopCoder Arena applet itself supports.\n* Works with any language supported by TopCoder.\n* Keeps track of your code files locally so you always have a copy.\n* Downloads and stores a copy of the problem statement with your code for\n  off-line viewing.\n* Has support for simple templates (default templates provided only for C++\n  and Java).\n* Test-case \"drivers\" can be generated locally with the example test-case data\n  (currently C++ only).\n\nBuild Status\n------------\n\n[![Build Status](https://travis-ci.org/chazmcgarvey/vimcoder.svg?branch=master)](https://travis-ci.org/chazmcgarvey/vimcoder)\n\nLicense\n-------\n\nThis software is licensed according to the terms and conditions of the\n[BSD 2-Clause License](http://www.opensource.org/licenses/bsd-license.php).\nPlease see the COPYING file for more information.\nThis project is neither supported nor endorsed by TopCoder, Inc.\n\nDownload\n--------\n\nThe latest VimCoder jar file can be downloaded from the\n[vim.org script page](http://www.vim.org/scripts/script.php?script_id=3321).\n\nInstall\n-------\n\nUnfortunately, installation is a bit cumbersome, but it is what it is:\n\n1. Download the latest version of the VimCoder jar file.\n2. Run the TopCoder Arena applet and log in.\n3. Click the \"Options\" menu and select \"Editor\" to show the editor\n   preferences.\n4. Click the \"Add\" button to bring up a new window.\n5. For \"Name,\" type \"Vim\" or whatever you want to represent this plug-in.\n6. For \"EntryPoint,\" type \"com.dogcows.VimCoder\" without the quotes.\n7. For \"ClassPath,\" click on \"Browse\" and locate the VimCoder jar file.  The\n   third field should now have the path to the jar file.\n8. Click \"OK\" to close the window with the three fields.\n9. Click \"Save.\"\n\nYou should now be able select \"Vim\" (or whatever you entered into the first\nfield) as your editor from the pull-down list on any problem statement window.\n\nConfigure\n---------\n\nDepending on your preference or system attributes, you may want or need to\nfirst configure the plug-in so that it will work how you want it to.  You can\nbring up the plug-in preferences window by following these steps:\n\n1. Run the TopCoder Arena applet and log in.\n2. Click the \"Options\" menu and select \"Editor.\"\n3. In the new window, make sure the entry for VimCoder is selected from the\n   list, and click the \"Configure\" button.\n\n![VimCoder Preferences](http://chazmcgarvey.github.com/vimcoder/img/prefs.png)\n\n##### Storage Directory\n\nVimCoder saves the problem files and the code you're working on in\na particular directory you can set.  By default, this directory is `.vimcoder`\nin your home directory.  This is an \"invisible\" directory on most systems.\nWithin this storage directory are several sub-directories, one for each\nproblem you open.  Each sub-directory is named after the problem identifier\nand contains your source code and other files related to the problem.\n\nIf you want to change the storage directory, click the \"Browse\" button in the\nVimCoder preferences window and navigate to the directory you would like to\nuse.  If you have already saved some problems to the previous storage\ndirectory, you may also want to actually move the directory to the new\nlocation so that VimCoder can find the work you've already done.\n\nBeginning with VimCoder 0.3.5, there is a new option for an alternative\ndirectory structure.  It is not enabled by default, but it may be in the\nfuture.  Rather than having directories named after problem identifiers, the\nnew structure uses two levels of directories.  On the first level, directories\nare named after the contest associated with the problem (e.g. SRM-144-DIV-1),\nand on the second level, directories are named after the problem's point value\n(e.g. 300).  This directory structure may be preferable if you ever want to\nbrowse your repository since the contest name and point values are more easily\nidentifiable than the problem identifier.\n\nIf this new directory structure is enabled, it will only apply to new\nproblems.  VimCoder will not try to reorganize your current repository, though\nyou are welcome to do it manually yourself if you would like to switch to the\nnew directory structure.\n\n##### Vim Command\n\nBy default, VimCoder tries to invoke Vim using the `gvim` command (or\n`C:\\WINDOWS\\gvim.bat` on Windows).  This will typically work just fine unless\nyou don't have gvim in your PATH (or your installation of Vim on Windows\ndidn't include the wrappers for the command line).  If you get errors about\nthe vim process not being able to run and no Vim session comes up when you use\nthe VimCoder plug-in, you need to either make sure the Vim command exists in\nyour PATH, or else change the Vim command in the VimCoder preferences window\nto something else.\n\nYou may use an absolute path to your vim executable, such as\n`/usr/local/bin/gvim` or `C:\\Program Files\\Vim\\vim73\\gvim.exe`\nor wherever your actual Vim executable is.  You may also invoke vim through\nsome other command (e.g. `xterm -e vim` or `gnome-terminal -e vim --`).\n\nThe xterm example above demonstrates using Vim without the GUI, running in\na terminal emulator.  You can enter any elaborate command you want as long as\nVim ultimately gets executed with the arguments that will be appended to the\ncommand when it is invoked.  After changing this value and saving your\npreferences, the command you enter will be used the next time you open\na problem.\n\nUsage\n-----\n\nTo use VimCoder once it is installed and configured, go to a room in the\nTopCoder Arena applet and open one of the problems.  If you have set VimCoder\nas your default editor, you will see the usual problem statement window come\nup as well as a separate Vim editor window.  Otherwise, you can change the\neditor from the problem statement window, and the Vim editor window will come\nup.  You will see that the area usually devoted to editor will be used for log\nmessages; you will do your actual coding in the Vim window that comes up.\n\nJust enter your code into the Vim window and use the regular TopCoder Arena\napplet buttons to compile, test, and submit your code.\n\n**Pro Tip:** If you accidentally close your Vim session, you can get it back\nby switching to a different editor (such as the default editor) and then\nswitching back to VimCoder.  Alternatively, the session will also reappear\n(and load a buffer to a different source code file) if you switch languages.\n\nStorage Directory Structure\n---------------------------\n\nKnowing about the files created by VimCoder is useful if you ever need to do\nanything advanced.  When you open a problem, VimCoder will check to see if you\nhave already opened that problem by looking for the problem and solution\nfiles.  If these files are found, it will load your previous work.  Otherwise,\nit will fill out the templates based on the problem class name, parameter\ntypes, and so on, and will create several files in a sub-directory of the main\nstorage directory:\n\n##### `$CLASSNAME$`.`$LANGUAGE$`\n\nThis is the file where you write your solution code.  If the class name for\nthe problem was BinaryCode and your language was Java, the name of this file\nwould be `BinaryCode.java`.  When you open a problem, Vim will load this file\ninto a new buffer so that you can start coding.  If there is a template for\nthe language you're using, that template will be used to fill in this file to\ngive you a reasonable place to start.  When you save your code to TopCoder or\ncompile remotely, this is also the file that will be read to provide the code\nfor your solution.\n\n##### testcases.txt\n\nThis file contains the example test cases that are associated with the\nproblem.  The format is pretty simple.  For each test case, there is one line\nfor the expected return value followed by the inputs (i.e. the method\narguments), in order, each on its own line.  The format of this file is meant\nto be easy for a human to write and easy for a program to read so that\na driver program (more on this later) can easily be written to run the test\ncases against your code.\n\nWhile you are coding a solution, you may want to open this file in a new\nbuffer (type \":e testcases.txt\") and add additional test cases to make sure\nyour code doesn't mess up on edge cases for which an example test case was not\nprovided.\n\n##### Problem.html\n\nThis file contains the problem statement which is what you see in the top half\nof the problem window.  You can load this in a browser to read the particulars\nof the problem when you aren't running the TopCoder Arena applet.  You\ntypically shouldn't edit this file, but it's up to you.\n\n##### Makefile\n\nIf there exists a Makefile template for the selected language, it will also be\nfilled out and saved in the problem directory.  The purpose of the Makefile is\nto compile your code locally.  You can execute targets in the Makefile using\nVim's `:make` command.  You also shouldn't need to edit this file directly,\nbut of course you can if the need does arise.  Exactly what happens when you\nuse the `:make` command depends on the Makefile template.\n\nIf you are using the default Makefile template for C++, typing \":make\" without\nany arguments will compile your code.  Typing \":make run\" will run all of the\ntest cases against your code.  Typing \":make test\" will also run the test\ncases against your code, except it will abort at the first failed test.\n\nA Makefile template is not yet provided for any other language, but you can\nwrite one yourself if you are so inclined.  Read on to learn how templates\nwork.\n\n**Important:** Make sure you understand the difference between compiling\nlocally and compiling remotely (on the TopCoder servers).  If you use the\nMakefile to compile your solution (and maybe run the tests), you are not\ninteracting with the TopCoder servers at all.  When you compile *remotely*,\nyou are sending a snapshot of your current solution to the servers for\nprocessing.  The distinction becomes important when it comes time for you to\nsubmit your solution.  When you push the \"Submit\" button, you are submitting\nthe **last version that was uploaded to the TopCoder servers** (by compiling\nremotely), and that may be different from what is currently in your Vim\nbuffer, even if your Vim buffer was saved to disk.  Therefore, it is very\nimportant that you get into the habit of always pushing the \"Compile\" button\nright before you submit your code.  This point can't be overemphasized.\n\n##### driver.`$LANGUAGE$`\n\nIf there exists a driver template for the selected language, it will also be\nfilled out and saved in the problem directory.  If the language was currently\nset to C++, the driver code would be in the driver.cc file.  You normally\ndon't have to do anything with this file.  It just provides supporting code\nfor running the test cases against your code.\n\nThe driver should output TAP (Test Anything Protocol) so that tests can be run\nin a test harness such as [prove](http://search.cpan.org/perldoc?prove).  The\ndefault Makefile template has a `prove` target (type \":make prove\") that can\nrun the tests in a test harness; the test harness is `prove` unless otherwise\nconfigured.  TAP output is also very human-readable all by itself, so having\na test harness isn't really required.\n\nA default driver template is currently only provided for the C++ language.\nYou could write your own template if you wanted to.\n\n##### `$CLASSNAME$`\n\nSometimes the TopCoder Arena applet will pass back what source code it has\nsaved.  This will be saved in a file named after the class, without any file\nextension.  You can open this file if you need to access this code for any\nreason (say, you messed up some code and need to revert back to the last time\nyou saved from the TopCoder Arena applet).\n\nTemplates\n---------\n\nVimCoder comes with default templates for C++ and Java, but you can create\nyour own customized templates for any language supported by TopCoder.  To use\nyour own template, you need to add a file to the storage directory with a file\nname depending on the language.  The file name should start with the name of\nthe language and end with \"Template\" with no file extension.  For example, if\nyou wanted to create a C# template and your storage directory was\n`/home/foo/.vimcoder`, you would need to create the file\n`/home/foo/.vimcoder/C#Template`.\n\nA template is like a regular source code file with special keywords that will\nbe replaced as the template is \"filled out\" whenever you open a new problem.\nKeywords are surrounded by two dollar signs so they're not confused with other\nparts of the source code.  The template expansion process is rather\nsimplistic, so if you can't get the right format for the terms you need, you\nmight have to change the plug-in source code to get the effect you're trying\nto achieve.  Here are the possible keywords and replacement terms:\n\n##### `$CLASSNAME$`\n\nThis keyword is replaced by the name of the class you must use in your\nsolution to the problem.\n\n##### `$METHODNAME$`\n\nThis keyword is replaced by the name of the public method your class needs to\nhave.\n\n##### `$RETURNTYPE$`\n\nThis keyword is replaced by the type of the return variable of your public\nmethod.\n\n##### `$METHODPARAMS$`\n\nThis keyword is replaced by a comma-separated list of method parameter types\nand names.\n\n----\n\nOther keywords are also available, but the rest are intended to be used in\ndriver or Makefile templates, though any keyword can be used in any type of\ntemplate.  You can create other types of templates by adding specially-named\nfiles to the storage directory.  Driver templates are named starting with the\nname of the language and ending with \"Driver\" with no file extension.\nSimilarly, Makefile templates are named starting with the name of the language\nand ending with \"Makefile\" with no file extension.\n\nDrivers provide additional code that allows the test cases to be run against\nyour solution.  Currently, Makefile and driver templates are only provided for\nthe C++ language.  Makefiles should have the commands needed to compile the\nsolution source code and/or make a driver program that will perform the tests.\nIf you want automatic building and testing for one of the other languages, you\nwill need to create a driver and Makefile template for that language.  Here\nare more keywords that may be useful for these types of templates:\n\n##### `$METHODPARAMDECLARES$`\n\nThis keyword is replaced by C-style declarations of the method parameters.  In\nother words, each parameter is declared with its type on its own line\nterminated by a semicolon.\n\n##### `$METHODPARAMNAMES$`\n\nThis keyword is replaced by a comma-separated list of only the method\nparameter names.\n\n##### `$METHODPARAMSTREAMOUT$`\n\nThis keyword is replaced by a list of the method parameter names separated by\nthe C++ output stream operator (\u003c\u003c).  The C++ driver template uses this to\ndisplay the input values of the test case data.\n\n##### `$METHODPARAMSTREAMIN$`\n\nThis keyword is replaced by a list of the method parameter names separated by\nthe C++ input stream operator (\u003e\u003e).  The C++ driver template uses this to read\nin the test case data from testcases.txt.\n\n----\n\nTo give you an idea of how this all fits together, here is an example template\nfor Java, similar to the built-in default Java template:\n\n```java\nimport static java.lang.Math.*;\nimport static java.math.BigInteger.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class $CLASSNAME$ {\n    public $RETURNTYPE$ $METHODNAME$($METHODPARAMS$) {\n    }\n}\n```\n\nNotice that it looks just like regular code but has some keywords surrounded\nby dollar signs that will be expanded to real values.  Something like this\ncould be saved in a filed named `JavaTemplate` in your VimCoder storage\ndirectory.\n\nPotential Pitfalls\n------------------\n\n##### Vim Client/Server\n\nVimCoder requires Vim's client/server feature in order to work.  If the log is\nshowing errors with the invocation of Vim or if it's just not working and has\nother strange symptoms, make sure your version of Vim supports the\nclient/server feature.  If you are unsure, use Vim's `:version` command and\nlook for \"+clientserver\" in the output.  If you see \"-clientserver\" instead,\nthen you'll need to get yourself another version of Vim.\n\nI think this feature was introduced in Vim 6.x, but I haven't done any testing\nwith any versions of Vim less than 7.2.  If you're still on 6.x, you should\nreally upgrade anyway.\n\n##### Vim Settings Not Applied\n\nThe problem is that sometimes your settings (in your vimrc file) are not being\napplied as you would expect.  This may be because you are using `setlocal` in\nyour vimrc file rather than `set`.  The `setlocal` command applies settings\nonly to the current buffer or window (see `:help setlocal` for more\ninformation), but VimCoder works by first launching Vim and then loading\na brand new buffer.\n\nThe solution is to consider whether or not such settings should actually be\nglobal; if they should be global, change `setlocal` to `set` in your vimrc\nfile.  Alternatively, if you want certain settings to be set only for certain\nkinds of buffers, you can use the `autocmd` command to selectively set\nsettings according to file path pattern and various events.\nSee `:help autocmd` for more information.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchazmcgarvey%2Fvimcoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchazmcgarvey%2Fvimcoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchazmcgarvey%2Fvimcoder/lists"}