{"id":15978347,"url":"https://github.com/tandrewnichols/vim-determined","last_synced_at":"2025-06-11T00:34:41.669Z","repository":{"id":142028487,"uuid":"149538384","full_name":"tandrewnichols/vim-determined","owner":"tandrewnichols","description":"A wrapper to make term_start more friendly","archived":false,"fork":false,"pushed_at":"2025-03-16T22:12:26.000Z","size":32,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T11:36:26.052Z","etag":null,"topics":["vim","vim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tandrewnichols.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-20T02:16:18.000Z","updated_at":"2025-03-16T22:12:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ac72de8-b78e-47a7-93db-22503682f7bc","html_url":"https://github.com/tandrewnichols/vim-determined","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"290ccc738100c93b79f2b8ef2a3c2db737e43a9e"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tandrewnichols%2Fvim-determined","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tandrewnichols%2Fvim-determined/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tandrewnichols%2Fvim-determined/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tandrewnichols%2Fvim-determined/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tandrewnichols","download_url":"https://codeload.github.com/tandrewnichols/vim-determined/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tandrewnichols%2Fvim-determined/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259176236,"owners_count":22817150,"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":["vim","vim-plugin"],"created_at":"2024-10-07T23:08:51.240Z","updated_at":"2025-06-11T00:34:41.650Z","avatar_url":"https://github.com/tandrewnichols.png","language":"Vim Script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vim-Determined\n\nA wrapper around vim 8's new term_start to make it friendlier and easier to use.\n\n## Overview\n\nVim 8 added asynchronous terminal support via `term_start`, and it's _really neat_. Except it's a _pain_ to use. I basically have to do `:h term_start` every time I think I might want to use it. But it seems like it wasn't really intended to be used directly, since there's no command for it. You have to invoke it with `:call term_start`. I could've made a simple command like `:Term cmd { args }` but that's annoying to type every time, so instead, this plugin exposes the `determined#command` function, which you should call in your vim config setup (e.g. in vimrc). This function will create commands for you that wrap specific invocations of `:call term_start` to make it easy to use. For example, here are the current commands I'm creating in my setup via `determined#command`:\n\n```vim\n\" Example:\n\" :Npm install some-module\ncall determined#command('Npm', 'npm', { 'vertical': 0, 'rows': '5', 'cols': '40%' })\n\n\" Example:\n\" :Repl\n\" start an interactive node repl\ncall determined#command('Repl', 'node', { 'autoclose': 0, 'background': 0 })\n\n\" Example:\n\" :Node -e \"[1, 2, 3].map((i) =\u003e i * i)\"\ncall determined#command('Node', 'node', { 'vertical': 0, 'rows': '10', 'cols': '40%' })\n\n\" Example:\n\" :Rg blah ./test\ncall determined#command('Rg', 'rg', { 'background': 0, 'autoclose': 0 })\n\n\" Example:\n\" :Grunt spec:unit\ncall determined#command('Grunt', 'grunt', { 'autoclose': 0, 'reuse': 1 })\n```\n\n`vim-determined` makes it easy to interact with any command line tool directly from node. I'd suggest `git` as an obvious candidate except it _still_ wouldn't be as good as [vim-fugitive](https://github.com/tpope/vim-fugitive).\n\n## Requirements\n\nThis plugin requires vim at or above version 8 compiled with `+terminal` (check `:echo has('terminal')`).\n\n## Installation\n\nIf you don't have a preferred installation method, I really like vim-plug and recommend it.\n\n#### Manual\n\nClone this repository and copy the files in plugin/, autoload/, and doc/ to their respective directories in your vimfiles, or copy the text from the github repository into new files in those directories. Make sure to run `:helptags`.\n\n#### Plug (https://github.com/junegunn/vim-plug)\n\nAdd the following to your vimrc, or something sourced therein:\n\n```vim\nPlug 'tandrewnichols/vim-determined'\n```\n\nThen install via `:PlugInstall`\n\n#### Vundle (https://github.com/gmarik/Vundle.vim)\n\nAdd the following to your vimrc, or something sourced therein:\n\n```vim\nPlugin 'tandrewnichols/vim-determined'\n```\n\nThen install via `:BundleInstall`\n\n#### NeoBundle (https://github.com/Shougo/neobundle.vim)\n\nAdd the following to your vimrc, or something sourced therein:\n\n```vim\nNeoBundle 'tandrewnichols/vim-determined'\n```\n\nThen install via `:BundleInstall`\n\n#### Pathogen (https://github.com/tpope/vim-pathogen)\n\n```sh\ngit clone https://github.com/tandrewnichols/vim-determined.git ~/.vim/bundle/vim-determined\n```\n\n## Usage\n\nTo create `term_start` wrappers at vim startup, call the following function:\n\n### determined#command\n\nThis creates a command that wraps some command line tool in a call to `term_start`. Invoke as follows:\n\n```vim\ncall determined#command(name, cmd, args)\n```\n\n#### Name\n\nType: string\n\nThe name of the vim command to create. This argument will be capitalized if it is not already because vim requires that custom commands be capitalized.\n\n#### Cmd\n\nType: string\n\nThe static part of the command to run when the vim command is invoked. Usually this is the base binary name only, but it could be more if you run very specific things very often. For example:\n\n```vim\ncall determined#command('TermGrep', 'grep -r')\n```\n\n#### Args\n\nType: dict\n\nThe following options are supported:\n\n- `vertical`: Whether the terminal window should split vertically or not. Default `1` (because I use it this way far more often, even though the default for term_start is _not_ vertical). Regardless of the value passed here, you can invert this behavior by calling the created command with `!`. So in the `TermGrep` example above, by default, `:TermGrep foo` would open in a vertical split, but `:TermGrep! foo` would open in a horizontal one.\n- `background`: Whether focus should be returned to your current window. Default `1`. The nice thing about `term_start` is that it is async, so it doesn't interrupt what you're doing in vim. The not so nice thing is that it focuses you on the new terminal window instead of keeping you where you're already working. This flag just runs `wincmd p` at the end to return you to where you were previously working.\n- `autoclose`: This param sets `'term_finish': 'close'` in the options passed to `term_start`. Default `0`. This is useful if you need to install something or run some other kind of build command of which you don't need to see the final output.\n- `reuse`: If the same command has been run previously, reuse the existing window instead of creating a new one. Default `0`. Useful for running tests or other recurring commands.\n- `singleton`: Like `reuse` but for the top level command. If you created `:TermGrep` with the `singleton` flag, all greps, regardless of other parameters, will happen in the same window. Default `0`.\n- `expand`: Treat `%` (and `#`, `\u003ccfile\u003e`, etc.) specially and call `expand()` on it. Default `0`. `filename-modifiers` work here as well, so something like `:TermGrep foo %:h:h` would work as expected.\n- `size`: The size of the terminal window. By default, `term_start` will use half the vertical or horizontal space, and `vim-determined` keeps this default. You can pass a number (or string number) to specify the number of rows or columns, depending on the vertical flag (i.e. this becomes `term_rows` or `term_cols`). But you can also pass a percentage as a string (e.g. '40%') and `vim-determined` will figure out the number of rows or columns to use. You can also pass the special flags `'small'` (or `'sm'` or `'quarter'`) to make it 25%, `'medium'` (or `'med'` or `'half'`) to make it 50% (but instead you should probably just let it use the default), or `'large'` (or `'lg'`) to make it 75%. Finally, there is a special value `auto` which will look at the window height and width ratios to determine _for you_ whether a vertical or horizontal split would be more efficient. Passing `auto` is incompatible with passing `rows` and `cols` (see below). It will also cause `!` to be ignored. The one exception to this parameter is that if `curwin` is set, this option is ignored, as it will use the space of the current window regardless.\n- `rows`/`cols`: The `size` parameter is not very granular, since you might want different sizes based on the window orientation. In that case, you can pass the same kinds of identifiers for `rows` and/or `cols` as you can for `size` (except for `'auto'` which would not make sense).\n- `complete`: Add custom completion. This maps basically one to one to the `-complete` option of commands, so pass it exactly as you would there.\n- `tabnew`: Always run `cmd` in a new tab. Default `0`.\n- `curwin`: Always run `cmd` in the current window. Default `0`.\n- `term_args`: Finally, a catch all. This should be a dict, and anything you pass here will be added to the `term_start` options via `extend()`. Have a look at `:h term_start` for the various options supported.\n\n### Commands\n\n#### Commands created via determined#command\nOnce the command is created, you can call it with additional string parameters to pass to `term_start`. For example, if you created a command like this:\n\n```vim\ncall determined#command('Npm', 'npm')\n```\n\nYou can invoke it in any of the following ways:\n\n- `:Npm install foo`\n- `:Npm uninstall foo`\n- `:Npm test`\n- `:Npm run custom-script`\n- `:Npm ls`\n- `:Npm install -D grunt grunt-contrib-copy grunt-contrib-uglify grunt-contrib-concat`\n- etc. etc.\n\nFor completeness, `determined#command` also creates `E` and `T` versions for opening the command in a new tab or in the current window (even though you can configure this per command via [args](#args). So in the case above, the following commands are also created:\n\n- `:ENpm` - Run the npm command in the current window.\n- `:TNpm` - Run the npm command in a new tabpage.\n\n#### Additional commands\n\n`vim-determined` does include a few built in commands.\n\n- `:TermClose[!]` - Close all open term windows (where the job is not currently running). When `\u003cbang\u003e` is included, stop running jobs and close those terms too.\n- `:Term[!]` - A generic wrapper for call `term_start` with commands that you haven't created via `determined#command`. For instance, I don't use `find` very often, so I'm not creating a command for it with `determined#command`, but if I _need_ to use it in vim, I can run `:Term find . -name somefile.ext`. This uses the default arguments to `term_start`, which means it will open in a horizontal split. Use `\u003cbang\u003e` to open it in a vertical split.\n- `:ETerm` - Like `:Term`, but in the current window.\n- `:TTerm` - Like `:Term`, but in a new tabpage.\n- `:VTerm` - Like `:Term`, but in a vertical split . . . so this is identical to `:Term!` but is included for completeness.\n- `:STerm` - Synonymous with `:Term` but included for completeness.\n\n### Mappings\n\nWithin a terminal window opened by `vim-determined`, `\u003cC-r\u003e` is mapped to rerun the original command. Hopefully, the symmetry is obvious. `\u003cC-r\u003e` is for \"redo,\" but terminals are not modifiable, so I'm repurposing that keybinding to have specialized meaning.\n\n## Contributing\n\nI always try to be open to suggestions, but I do still have opinions about what this should and should not be so . . . it never hurts to ask before investing a lot of time on a patch.\n\n## License\n\nSee [LICENSE](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftandrewnichols%2Fvim-determined","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftandrewnichols%2Fvim-determined","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftandrewnichols%2Fvim-determined/lists"}