mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 07:10:06 +08:00
feat(githubissues): use bundle github-issues & fix python command
This commit is contained in:
parent
78e2dfcaa6
commit
4dfcda8146
@ -25,7 +25,7 @@
|
||||
|
||||
function! SpaceVim#layers#github#plugins() abort
|
||||
return [
|
||||
\ ['jaxbot/github-issues.vim', { 'on_cmd' : 'Gissues' }],
|
||||
\ [g:_spacevim_root_dir . 'bundle/github-issues.vim', {'merged': 0}],
|
||||
\ ['junegunn/vim-github-dashboard', {
|
||||
\ 'on_cmd': ['GHA', 'GHD', 'GHActivity', 'GHDashboard'],
|
||||
\ }],
|
||||
|
@ -8,6 +8,7 @@ In `bundle/` directory, there are two kinds of plugins: forked plugins without c
|
||||
- `delimitMate`: based on [`Raimondi/delimitMate@537a1da`](https://github.com/Raimondi/delimitMate/tree/537a1da0fa5eeb88640425c37e545af933c56e1b)
|
||||
- `vim-toml`: based on [cespare/vim-toml@717bd87ef9](https://github.com/cespare/vim-toml/tree/717bd87ef928293e0cc6cfc12ebf2e007cb25311)
|
||||
- `neoformat`: based on [neoformat](https://github.com/sbdchd/neoformat/tree/f1b6cd506b72be0a2aaf529105320ec929683920)
|
||||
- `github-issues.vim`: based on [github-issues.vim](https://github.com/jaxbot/github-issues.vim/tree/46f1922d3d225ed659f3dda1c95e35001c9f41f4)
|
||||
|
||||
### No changed plugins
|
||||
|
||||
|
1
bundle/github-issues.vim/.gitignore
vendored
Normal file
1
bundle/github-issues.vim/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
tags
|
24
bundle/github-issues.vim/LICENSE
Normal file
24
bundle/github-issues.vim/LICENSE
Normal file
@ -0,0 +1,24 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2014 Jonathan Warner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
I am providing code in this repository to you under an open source license. Because this is my personal repository, the license you receive to my code is from me and not my employer (Facebook).
|
||||
|
147
bundle/github-issues.vim/README.md
Normal file
147
bundle/github-issues.vim/README.md
Normal file
@ -0,0 +1,147 @@
|
||||
github-issues.vim
|
||||
=================
|
||||
|
||||
Github issue integration in Vim. It's kind of awesome.
|
||||
|
||||
# Looking for a new owner
|
||||
|
||||
If you're interested in taking over this project and giving it the love it deserves, send me an email or file a bug.
|
||||
|
||||
### Omnicomplete
|
||||
|
||||
If you use Fugitive or edit gitcommit files in Vim, github-issues will automatically populate the omnicomplete menu with issues on Github. This is useful when you want to reference commits, close issues, etc., through Github's commit message parsing.
|
||||
|
||||
Here's how it works with Neocomplete:
|
||||
|
||||
<img src='https://jaxbot.me/pics/vim/vim_gissues2.gif'>
|
||||
|
||||
If you use pure omnicomplete, use `C-x C-o` to pull up the menu.
|
||||
|
||||
No need to run commands, no need to configure. It just works. ;) (And if it doesn't, it should, so submit an issue) Not bad, huh?
|
||||
|
||||
### Lookup menu
|
||||
|
||||
To show Github issues for the current repository:
|
||||
```
|
||||
:Gissues
|
||||
```
|
||||
|
||||
Press enter to view more details.
|
||||
|
||||
<img src='https://jaxbot.me/pics/vim/vim-github-issues-1.gif'>
|
||||
|
||||
### Handling issues
|
||||
|
||||
You can open and close issues using `co` and `cc` in the issue view.
|
||||
|
||||
<img src='https://jaxbot.me/pics/vim/vim-github-issues-2.gif'>
|
||||
|
||||
They're also totally editable buffers, and saving the file will sync with Github's servers. You can use this to write comments, too:
|
||||
|
||||
<img src='https://jaxbot.me/pics/vim/vim-github-issues-4.gif'>
|
||||
|
||||
You can also open the current issue in your browser using `cb`.
|
||||
|
||||
### Creating issues
|
||||
|
||||
You can even use `:Giadd` to create a blank issue. Saving the buffer will generate a new issue and update the buffer with an issue number and the ability to add comments.
|
||||
|
||||
<img src='https://jaxbot.me/pics/vim/vim-github-issues-6.gif'>
|
||||
|
||||
How awesome is that!?
|
||||
|
||||
### Milestones
|
||||
|
||||
New feature: Use `:Gmiles` to open a menu of milestones. Press return on one to select it and filter `:Gissues` by that milestone from then on.
|
||||
|
||||
### Custom Issue Search
|
||||
|
||||
You have the ability to define your own issue search using [Githubs search API](https://developer.github.com/v3/search/). This allows you to view issues and pull requests across repos.
|
||||
|
||||
To use this feature, you can add a line like the following, with the search parameters that you wish to use.
|
||||
|
||||
```vim
|
||||
let g:gh_issues_query = "state:open user:github label:\"feature\" sort:created-asc"
|
||||
```
|
||||
|
||||
You can than get this list of issues using the command `:Gisearch`
|
||||
|
||||
### Fugitive integration
|
||||
|
||||
Github will show any commits that reference the issue. That's what the omnicomplete helps with. But to make things even more awesome, github-issues.vim integrates with Fugitive.vim to make commit hashes clickable with the return key.
|
||||
|
||||
<img src='https://jaxbot.me/pics/vim/vim-github-issues-3.gif'>
|
||||
|
||||
### Requirements and Installation
|
||||
|
||||
Vim with Python 2.7, Python 2.7 installed and working with Vim.
|
||||
|
||||
I recommend using [Pathogen](https://github.com/tpope/vim-pathogen) and Git cloning into ~/.vim/bundle. You can also just download the plugin and paste it into your plugin directory.
|
||||
|
||||
Then **read below about adding an access token**.
|
||||
|
||||
### Configuration
|
||||
|
||||
The omnicomplete and lookup features will work out of the box for public repos.
|
||||
|
||||
If you have private repos, or would like the ability to comment, open, close, and add issues, you will need to set an access token. Don't worry, this is super easy.
|
||||
|
||||
```
|
||||
g:github_access_token
|
||||
```
|
||||
|
||||
Grab an access token [from here](
|
||||
https://github.com/settings/tokens/new), then set this variable, preferably in a local vim file not included in any public repositories:
|
||||
|
||||
`let g:github_access_token = "9jb19c1189f083d7013i24367lol"`
|
||||
|
||||
**Remember**, you should treat your access token like a password!
|
||||
|
||||
|
||||
Other options include:
|
||||
|
||||
```
|
||||
g:github_issues_no_omni
|
||||
```
|
||||
|
||||
When this is set to any value, github-issues will not set Neocomplete and Omnicomplete hooks.
|
||||
|
||||
|
||||
```
|
||||
g:github_upstream_issues
|
||||
```
|
||||
|
||||
When this is set to 1, github-issues will use upstream issues (if repo is fork). This will require extra requests for the Github API, however.
|
||||
|
||||
```
|
||||
g:github_api_url = "https://api.github.com/"
|
||||
```
|
||||
|
||||
If you use Github Enterprise, where the Github server is hosted somewhere other than Github.com, set this parameter to your API path. This is specifically for Github Enterprise and will not work for Bitbucket, Gitlab, etc.
|
||||
|
||||
```
|
||||
g:github_same_window = 1
|
||||
```
|
||||
|
||||
When this is set to 1, github-issues will use the current window instead of splitting the screen via the `:new` command.
|
||||
|
||||
```
|
||||
g:gissues_lazy_load = 0
|
||||
```
|
||||
|
||||
When this is set to 1, omnicomplete will not be populated until it is triggered. This eliminates potential lag when opening `gitcommit` files.
|
||||
|
||||
```
|
||||
g:gissues_async_omni = 0
|
||||
```
|
||||
|
||||
**Experimental**: When set to 1, omnicomplete will be populated asynchronously, on another thread. This removes almost all lag from the UI when using Gissues, and can be combined with g:gissues_lazy_load to reduce network traffic while still receiving the same speed boost. However, this uses threads and needs a lot more testing to ensure it is stable.
|
||||
|
||||
### Contributing
|
||||
|
||||
Pull requests, feature requests, and issues are always welcome!
|
||||
|
||||
## Shameless plug
|
||||
|
||||
I hack around with Vim plugins, so [follow me](https://github.com/jaxbot) if you're into that kind of stuff (or just want to make my day) ;)
|
||||
|
268
bundle/github-issues.vim/autoload/gh_colors.vim
Normal file
268
bundle/github-issues.vim/autoload/gh_colors.vim
Normal file
@ -0,0 +1,268 @@
|
||||
Python <<EOF
|
||||
xterm_colors = {
|
||||
"000000": "x016_Grey0",
|
||||
"00005f": "x017_NavyBlue",
|
||||
"000087": "x018_DarkBlue",
|
||||
"0000af": "x019_Blue3",
|
||||
"0000d7": "x020_Blue3",
|
||||
"0000ff": "x021_Blue1",
|
||||
"005f00": "x022_DarkGreen",
|
||||
"005f5f": "x023_DeepSkyBlue4",
|
||||
"005f87": "x024_DeepSkyBlue4",
|
||||
"005faf": "x025_DeepSkyBlue4",
|
||||
"005fd7": "x026_DodgerBlue3",
|
||||
"005fff": "x027_DodgerBlue2",
|
||||
"008700": "x028_Green4",
|
||||
"00875f": "x029_SpringGreen4",
|
||||
"008787": "x030_Turquoise4",
|
||||
"0087af": "x031_DeepSkyBlue3",
|
||||
"0087d7": "x032_DeepSkyBlue3",
|
||||
"0087ff": "x033_DodgerBlue1",
|
||||
"00af00": "x034_Green3",
|
||||
"00af5f": "x035_SpringGreen3",
|
||||
"00af87": "x036_DarkCyan",
|
||||
"00afaf": "x037_LightSeaGreen",
|
||||
"00afd7": "x038_DeepSkyBlue2",
|
||||
"00afff": "x039_DeepSkyBlue1",
|
||||
"00d700": "x040_Green3",
|
||||
"00d75f": "x041_SpringGreen3",
|
||||
"00d787": "x042_SpringGreen2",
|
||||
"00d7af": "x043_Cyan3",
|
||||
"00d7d7": "x044_DarkTurquoise",
|
||||
"00d7ff": "x045_Turquoise2",
|
||||
"00ff00": "x046_Green1",
|
||||
"00ff5f": "x047_SpringGreen2",
|
||||
"00ff87": "x048_SpringGreen1",
|
||||
"00ffaf": "x049_MediumSpringGreen",
|
||||
"00ffd7": "x050_Cyan2",
|
||||
"00ffff": "x051_Cyan1",
|
||||
"5f0000": "x052_DarkRed",
|
||||
"5f005f": "x053_DeepPink4",
|
||||
"5f0087": "x054_Purple4",
|
||||
"5f00af": "x055_Purple4",
|
||||
"5f00d7": "x056_Purple3",
|
||||
"5f00ff": "x057_BlueViolet",
|
||||
"5f5f00": "x058_Orange4",
|
||||
"5f5f5f": "x059_Grey37",
|
||||
"5f5f87": "x060_MediumPurple4",
|
||||
"5f5faf": "x061_SlateBlue3",
|
||||
"5f5fd7": "x062_SlateBlue3",
|
||||
"5f5fff": "x063_RoyalBlue1",
|
||||
"5f8700": "x064_Chartreuse4",
|
||||
"5f875f": "x065_DarkSeaGreen4",
|
||||
"5f8787": "x066_PaleTurquoise4",
|
||||
"5f87af": "x067_SteelBlue",
|
||||
"5f87d7": "x068_SteelBlue3",
|
||||
"5f87ff": "x069_CornflowerBlue",
|
||||
"5faf00": "x070_Chartreuse3",
|
||||
"5faf5f": "x071_DarkSeaGreen4",
|
||||
"5faf87": "x072_CadetBlue",
|
||||
"5fafaf": "x073_CadetBlue",
|
||||
"5fafd7": "x074_SkyBlue3",
|
||||
"5fafff": "x075_SteelBlue1",
|
||||
"5fd700": "x076_Chartreuse3",
|
||||
"5fd75f": "x077_PaleGreen3",
|
||||
"5fd787": "x078_SeaGreen3",
|
||||
"5fd7af": "x079_Aquamarine3",
|
||||
"5fd7d7": "x080_MediumTurquoise",
|
||||
"5fd7ff": "x081_SteelBlue1",
|
||||
"5fff00": "x082_Chartreuse2",
|
||||
"5fff5f": "x083_SeaGreen2",
|
||||
"5fff87": "x084_SeaGreen1",
|
||||
"5fffaf": "x085_SeaGreen1",
|
||||
"5fffd7": "x086_Aquamarine1",
|
||||
"5fffff": "x087_DarkSlateGray2",
|
||||
"870000": "x088_DarkRed",
|
||||
"87005f": "x089_DeepPink4",
|
||||
"870087": "x090_DarkMagenta",
|
||||
"8700af": "x091_DarkMagenta",
|
||||
"8700d7": "x092_DarkViolet",
|
||||
"8700ff": "x093_Purple",
|
||||
"875f00": "x094_Orange4",
|
||||
"875f5f": "x095_LightPink4",
|
||||
"875f87": "x096_Plum4",
|
||||
"875faf": "x097_MediumPurple3",
|
||||
"875fd7": "x098_MediumPurple3",
|
||||
"875fff": "x099_SlateBlue1",
|
||||
"878700": "x100_Yellow4",
|
||||
"87875f": "x101_Wheat4",
|
||||
"878787": "x102_Grey53",
|
||||
"8787af": "x103_LightSlateGrey",
|
||||
"8787d7": "x104_MediumPurple",
|
||||
"8787ff": "x105_LightSlateBlue",
|
||||
"87af00": "x106_Yellow4",
|
||||
"87af5f": "x107_DarkOliveGreen3",
|
||||
"87af87": "x108_DarkSeaGreen",
|
||||
"87afaf": "x109_LightSkyBlue3",
|
||||
"87afd7": "x110_LightSkyBlue3",
|
||||
"87afff": "x111_SkyBlue2",
|
||||
"87d700": "x112_Chartreuse2",
|
||||
"87d75f": "x113_DarkOliveGreen3",
|
||||
"87d787": "x114_PaleGreen3",
|
||||
"87d7af": "x115_DarkSeaGreen3",
|
||||
"87d7d7": "x116_DarkSlateGray3",
|
||||
"87d7ff": "x117_SkyBlue1",
|
||||
"87ff00": "x118_Chartreuse1",
|
||||
"87ff5f": "x119_LightGreen",
|
||||
"87ff87": "x120_LightGreen",
|
||||
"87ffaf": "x121_PaleGreen1",
|
||||
"87ffd7": "x122_Aquamarine1",
|
||||
"87ffff": "x123_DarkSlateGray1",
|
||||
"af0000": "x124_Red3",
|
||||
"af005f": "x125_DeepPink4",
|
||||
"af0087": "x126_MediumVioletRed",
|
||||
"af00af": "x127_Magenta3",
|
||||
"af00d7": "x128_DarkViolet",
|
||||
"af00ff": "x129_Purple",
|
||||
"af5f00": "x130_DarkOrange3",
|
||||
"af5f5f": "x131_IndianRed",
|
||||
"af5f87": "x132_HotPink3",
|
||||
"af5faf": "x133_MediumOrchid3",
|
||||
"af5fd7": "x134_MediumOrchid",
|
||||
"af5fff": "x135_MediumPurple2",
|
||||
"af8700": "x136_DarkGoldenrod",
|
||||
"af875f": "x137_LightSalmon3",
|
||||
"af8787": "x138_RosyBrown",
|
||||
"af87af": "x139_Grey63",
|
||||
"af87d7": "x140_MediumPurple2",
|
||||
"af87ff": "x141_MediumPurple1",
|
||||
"afaf00": "x142_Gold3",
|
||||
"afaf5f": "x143_DarkKhaki",
|
||||
"afaf87": "x144_NavajoWhite3",
|
||||
"afafaf": "x145_Grey69",
|
||||
"afafd7": "x146_LightSteelBlue3",
|
||||
"afafff": "x147_LightSteelBlue",
|
||||
"afd700": "x148_Yellow3",
|
||||
"afd75f": "x149_DarkOliveGreen3",
|
||||
"afd787": "x150_DarkSeaGreen3",
|
||||
"afd7af": "x151_DarkSeaGreen2",
|
||||
"afd7d7": "x152_LightCyan3",
|
||||
"afd7ff": "x153_LightSkyBlue1",
|
||||
"afff00": "x154_GreenYellow",
|
||||
"afff5f": "x155_DarkOliveGreen2",
|
||||
"afff87": "x156_PaleGreen1",
|
||||
"afffaf": "x157_DarkSeaGreen2",
|
||||
"afffd7": "x158_DarkSeaGreen1",
|
||||
"afffff": "x159_PaleTurquoise1",
|
||||
"d70000": "x160_Red3",
|
||||
"d7005f": "x161_DeepPink3",
|
||||
"d70087": "x162_DeepPink3",
|
||||
"d700af": "x163_Magenta3",
|
||||
"d700d7": "x164_Magenta3",
|
||||
"d700ff": "x165_Magenta2",
|
||||
"d75f00": "x166_DarkOrange3",
|
||||
"d75f5f": "x167_IndianRed",
|
||||
"d75f87": "x168_HotPink3",
|
||||
"d75faf": "x169_HotPink2",
|
||||
"d75fd7": "x170_Orchid",
|
||||
"d75fff": "x171_MediumOrchid1",
|
||||
"d78700": "x172_Orange3",
|
||||
"d7875f": "x173_LightSalmon3",
|
||||
"d78787": "x174_LightPink3",
|
||||
"d787af": "x175_Pink3",
|
||||
"d787d7": "x176_Plum3",
|
||||
"d787ff": "x177_Violet",
|
||||
"d7af00": "x178_Gold3",
|
||||
"d7af5f": "x179_LightGoldenrod3",
|
||||
"d7af87": "x180_Tan",
|
||||
"d7afaf": "x181_MistyRose3",
|
||||
"d7afd7": "x182_Thistle3",
|
||||
"d7afff": "x183_Plum2",
|
||||
"d7d700": "x184_Yellow3",
|
||||
"d7d75f": "x185_Khaki3",
|
||||
"d7d787": "x186_LightGoldenrod2",
|
||||
"d7d7af": "x187_LightYellow3",
|
||||
"d7d7d7": "x188_Grey84",
|
||||
"d7d7ff": "x189_LightSteelBlue1",
|
||||
"d7ff00": "x190_Yellow2",
|
||||
"d7ff5f": "x191_DarkOliveGreen1",
|
||||
"d7ff87": "x192_DarkOliveGreen1",
|
||||
"d7ffaf": "x193_DarkSeaGreen1",
|
||||
"d7ffd7": "x194_Honeydew2",
|
||||
"d7ffff": "x195_LightCyan1",
|
||||
"ff0000": "x196_Red1",
|
||||
"ff005f": "x197_DeepPink2",
|
||||
"ff0087": "x198_DeepPink1",
|
||||
"ff00af": "x199_DeepPink1",
|
||||
"ff00d7": "x200_Magenta2",
|
||||
"ff00ff": "x201_Magenta1",
|
||||
"ff5f00": "x202_OrangeRed1",
|
||||
"ff5f5f": "x203_IndianRed1",
|
||||
"ff5f87": "x204_IndianRed1",
|
||||
"ff5faf": "x205_HotPink",
|
||||
"ff5fd7": "x206_HotPink",
|
||||
"ff5fff": "x207_MediumOrchid1",
|
||||
"ff8700": "x208_DarkOrange",
|
||||
"ff875f": "x209_Salmon1",
|
||||
"ff8787": "x210_LightCoral",
|
||||
"ff87af": "x211_PaleVioletRed1",
|
||||
"ff87d7": "x212_Orchid2",
|
||||
"ff87ff": "x213_Orchid1",
|
||||
"ffaf00": "x214_Orange1",
|
||||
"ffaf5f": "x215_SandyBrown",
|
||||
"ffaf87": "x216_LightSalmon1",
|
||||
"ffafaf": "x217_LightPink1",
|
||||
"ffafd7": "x218_Pink1",
|
||||
"ffafff": "x219_Plum1",
|
||||
"ffd700": "x220_Gold1",
|
||||
"ffd75f": "x221_LightGoldenrod2",
|
||||
"ffd787": "x222_LightGoldenrod2",
|
||||
"ffd7af": "x223_NavajoWhite1",
|
||||
"ffd7d7": "x224_MistyRose1",
|
||||
"ffd7ff": "x225_Thistle1",
|
||||
"ffff00": "x226_Yellow1",
|
||||
"ffff5f": "x227_LightGoldenrod1",
|
||||
"ffff87": "x228_Khaki1",
|
||||
"ffffaf": "x229_Wheat1",
|
||||
"ffffd7": "x230_Cornsilk1",
|
||||
"ffffff": "x231_Grey100",
|
||||
"080808": "x232_Grey3",
|
||||
"121212": "x233_Grey7",
|
||||
"1c1c1c": "x234_Grey11",
|
||||
"262626": "x235_Grey15",
|
||||
"303030": "x236_Grey19",
|
||||
"3a3a3a": "x237_Grey23",
|
||||
"444444": "x238_Grey27",
|
||||
"4e4e4e": "x239_Grey30",
|
||||
"585858": "x240_Grey35",
|
||||
"626262": "x241_Grey39",
|
||||
"6c6c6c": "x242_Grey42",
|
||||
"767676": "x243_Grey46",
|
||||
"808080": "x244_Grey50",
|
||||
"8a8a8a": "x245_Grey54",
|
||||
"949494": "x246_Grey58",
|
||||
"9e9e9e": "x247_Grey62",
|
||||
"a8a8a8": "x248_Grey66",
|
||||
"b2b2b2": "x249_Grey70",
|
||||
"bcbcbc": "x250_Grey74",
|
||||
"c6c6c6": "x251_Grey78",
|
||||
"d0d0d0": "x252_Grey82",
|
||||
"dadada": "x253_Grey85",
|
||||
"e4e4e4": "x254_Grey89",
|
||||
"eeeeee": "x255_Grey93",
|
||||
}
|
||||
|
||||
def rgb_distance(rgb1, rgb2):
|
||||
r = abs(int(rgb1[:2], 16) - int(rgb2[:2], 16))
|
||||
g = abs(int(rgb1[2:4], 16) - int(rgb2[2:4], 16))
|
||||
b = abs(int(rgb1[4:6], 16) - int(rgb2[4:6], 16))
|
||||
return r + g + b
|
||||
|
||||
def rgb_to_xterm(rgb):
|
||||
curDist = float("inf")
|
||||
# Failsafe
|
||||
curColor = "x242_Grey42"
|
||||
|
||||
for key in xterm_colors:
|
||||
dist = rgb_distance(key, rgb)
|
||||
if dist < curDist:
|
||||
curDist = dist
|
||||
curColor = xterm_colors[key]
|
||||
|
||||
return curColor
|
||||
EOF
|
||||
|
||||
function! gh_colors#init()
|
||||
" stub to load the colors
|
||||
let g:gissues_xterm_colors = 1
|
||||
endfunction
|
30
bundle/github-issues.vim/autoload/ghissues.vim
Normal file
30
bundle/github-issues.vim/autoload/ghissues.vim
Normal file
@ -0,0 +1,30 @@
|
||||
" core is written in Python for easy JSON/HTTP support
|
||||
" do not continue if Vim is not compiled with Python support
|
||||
if exists("g:github_issues_pyloaded") || !has("python") && !has("python3")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:path = fnamemodify(resolve(expand('<sfile>:p')), ':h') . '/../rplugin/python/ghissues.py'
|
||||
|
||||
if has("python3")
|
||||
command! -nargs=1 Python python3 <args>
|
||||
execute 'py3file ' . s:path
|
||||
else
|
||||
command! -nargs=1 Python python <args>
|
||||
execute 'pyfile ' . s:path
|
||||
endif
|
||||
|
||||
|
||||
" Default to not having loaded xterm
|
||||
let g:gissues_xterm_colors = 0
|
||||
|
||||
function! ghissues#init()
|
||||
let g:github_issues_pyloaded = 1
|
||||
|
||||
" Load in colors if we're in terminal mode
|
||||
if &term == "xterm-256color"
|
||||
call gh_colors#init()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim: softtabstop=2 expandtab shiftwidth=2 tabstop=2
|
216
bundle/github-issues.vim/doc/Gissues.txt
Normal file
216
bundle/github-issues.vim/doc/Gissues.txt
Normal file
@ -0,0 +1,216 @@
|
||||
*gissues.txt* github-issues.vim
|
||||
|
||||
===============================================================================
|
||||
Contents ~
|
||||
|
||||
1. Introduction |gissues-introduction|
|
||||
1. Omnicomplete |gissues-omnicomplete|
|
||||
2. Lookup menu |gissues-lookup-menu|
|
||||
3. Handling issues |gissues-handling-issues|
|
||||
4. Creating issues |gissues-creating-issues|
|
||||
5. Milestones |gissues-milestones|
|
||||
6. Fugitive integration |gissues-fugitive-integration|
|
||||
7. Requirements and Installation |gissues-requirements-installation|
|
||||
8. Configuration |gissues-configuration|
|
||||
9. Contributing |gissues-contributing|
|
||||
2. Shameless plug |gissues-shameless-plug|
|
||||
3. References |gissues-references|
|
||||
|
||||
===============================================================================
|
||||
*gissues-introduction*
|
||||
Introduction ~
|
||||
|
||||
Github issue integration in Vim. It's kind of awesome.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
*gissues-omnicomplete*
|
||||
Omnicomplete ~
|
||||
|
||||
If you use Fugitive or edit gitcommit files in Vim, github-issues will
|
||||
automatically populate the omnicomplete menu with issues on Github. This is
|
||||
useful when you want to reference commits, close issues, etc., through Github's
|
||||
commit message parsing.
|
||||
|
||||
Here's how it works with Neocomplete:
|
||||
|
||||
Image: (see reference [1])
|
||||
|
||||
If you use pure omnicomplete, use 'C-x C-o' to pull up the menu.
|
||||
|
||||
No need to run commands, no need to configure. It just works. ;) (And if it
|
||||
doesn't, it should, so submit an issue) Not bad, huh?
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
*gissues-lookup-menu*
|
||||
Lookup menu ~
|
||||
|
||||
To show Github issues for the current repository:
|
||||
>
|
||||
:Gissues
|
||||
<
|
||||
Press enter to view more details.
|
||||
|
||||
Image: (see reference [2])
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
*gissues-handling-issues*
|
||||
Handling issues ~
|
||||
|
||||
You can open and close issues using 'co' and 'cc' in the issue view.
|
||||
|
||||
Image: (see reference [3])
|
||||
|
||||
They're also totally editable buffers, and saving the file will sync with
|
||||
Github's servers. You can use this to write comments, too:
|
||||
|
||||
Image: (see reference [4])
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
*gissues-creating-issues*
|
||||
Creating issues ~
|
||||
|
||||
You can even use ':Giadd' to create a blank issue. Saving the buffer will
|
||||
generate a new issue and update the buffer with an issue number and the ability
|
||||
to add comments.
|
||||
|
||||
Image: (see reference [5])
|
||||
|
||||
While creating or editing issues it is possible to add multiple space separated
|
||||
assignees.
|
||||
|
||||
How awesome is that!?
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
*gissues-milestones*
|
||||
Milestones ~
|
||||
|
||||
New feature: Use ':Gmiles' to open a menu of milestones. Press return on one to
|
||||
select it and filter ':Gissues' by that milestone from then on.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
*gissues-fugitive-integration*
|
||||
Fugitive integration ~
|
||||
|
||||
Github will show any commits that reference the issue. That's what the
|
||||
omnicomplete helps with. But to make things even more awesome, github-
|
||||
issues.vim integrates with Fugitive.vim to make commit hashes clickable with
|
||||
the return key.
|
||||
|
||||
Image: (see reference [6])
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
*gissues-requirements-installation*
|
||||
Requirements and Installation ~
|
||||
|
||||
Vim with Python 2.7, Python 2.7 installed and working with Vim.
|
||||
|
||||
I recommend using Pathogen [7] and Git cloning into ~/.vim/bundle. You can also
|
||||
just download the plugin and paste it into your plugin directory.
|
||||
|
||||
Then **read below about adding an access token**.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
*gissues-configuration*
|
||||
Configuration ~
|
||||
|
||||
The omnicomplete and lookup features will work out of the box for public repos.
|
||||
|
||||
If you have private repos, or would like the ability to comment, open, close,
|
||||
and add issues, you will need to set an access token. Don't worry, this is
|
||||
super easy.
|
||||
>
|
||||
g:github_access_token
|
||||
<
|
||||
Grab an access token from here [8], then set this variable, preferably in a
|
||||
local vim file not included in any public repositories:
|
||||
|
||||
'let g:github_access_token = "9jb19c1189f083d7013i24367lol"'
|
||||
|
||||
**Remember**, you should treat your access token like a password!
|
||||
|
||||
Other options include:
|
||||
>
|
||||
g:github_issues_no_omni
|
||||
<
|
||||
When this is set to any value, github-issues will not set Neocomplete and
|
||||
Omnicomplete hooks.
|
||||
>
|
||||
g:github_upstream_issues
|
||||
<
|
||||
When this is set to 1, github-issues will use upstream issues (if repo is
|
||||
fork). This will require extra requests for the Github API, however.
|
||||
>
|
||||
g:github_api_url = "https://api.github.com/"
|
||||
<
|
||||
If you use Github Enterprise, where the Github server is hosted somewhere other
|
||||
than Github.com, set this parameter to your API path. This is specifically for
|
||||
Github Enterprise and will not work for Bitbucket, Gitlab, etc.
|
||||
>
|
||||
g:github_same_window = 1
|
||||
<
|
||||
When this is set to 1, github-issues will use the current window instead of
|
||||
splitting the screen via the ':new' command.
|
||||
>
|
||||
g:gissues_issue_vsplit = 0
|
||||
|
||||
When this set to one the issue details buffer will open in vertical buffer
|
||||
instead of horizontal. Works only if `g:github_same_window` is not set
|
||||
>
|
||||
g:gissues_list_vsplit = 0
|
||||
|
||||
Same as above but for the list of issues.
|
||||
>
|
||||
g:gissues_split_expand = 0
|
||||
|
||||
Setting to 1 will expand the buffer to full width for horizontal split and
|
||||
full height for vertical split instead of nesting inside parent split.
|
||||
>
|
||||
g:gissues_split_height = 0
|
||||
|
||||
Set the height of horizontal split, default 50% of parent.
|
||||
>
|
||||
g:issues_vsplit_width = 0
|
||||
|
||||
Same as above but for vertical split.
|
||||
>
|
||||
g:gissues_lazy_load = 0
|
||||
<
|
||||
When this is set to 1, omnicomplete will not be populated until it is
|
||||
triggered. This eliminates potential lag when opening 'gitcommit' files.
|
||||
>
|
||||
g:gissues_async_omni = 0
|
||||
<
|
||||
**Experimental**: When set to 1, omnicomplete will be populated asynchronously,
|
||||
on another thread. This removes almost all lag from the UI when using Gissues,
|
||||
and can be combined with g:gissues_lazy_load to reduce network traffic while
|
||||
still receiving the same speed boost. However, this uses threads and needs a
|
||||
lot more testing to ensure it is stable.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
*gissues-contributing*
|
||||
Contributing ~
|
||||
|
||||
Pull requests, feature requests, and issues are always welcome!
|
||||
|
||||
===============================================================================
|
||||
*gissues-shameless-plug*
|
||||
Shameless plug ~
|
||||
|
||||
I hack around with Vim plugins, so follow me [9] if you're into that kind of
|
||||
stuff (or just want to make my day) ;)
|
||||
|
||||
===============================================================================
|
||||
*gissues-references*
|
||||
References ~
|
||||
|
||||
[1] https://jaxbot.me/pics/vim/vim_gissues2.gif
|
||||
[2] https://jaxbot.me/pics/vim/vim-github-issues-1.gif
|
||||
[3] https://jaxbot.me/pics/vim/vim-github-issues-2.gif
|
||||
[4] https://jaxbot.me/pics/vim/vim-github-issues-4.gif
|
||||
[5] https://jaxbot.me/pics/vim/vim-github-issues-6.gif
|
||||
[6] https://jaxbot.me/pics/vim/vim-github-issues-3.gif
|
||||
[7] https://github.com/tpope/vim-pathogen
|
||||
[8] https://github.com/settings/tokens/new
|
||||
[9] https://github.com/jaxbot
|
||||
|
||||
vim: ft=help
|
363
bundle/github-issues.vim/plugin/githubissues.vim
Normal file
363
bundle/github-issues.vim/plugin/githubissues.vim
Normal file
@ -0,0 +1,363 @@
|
||||
" File: github-issues.vim
|
||||
" Version: 3.1.0
|
||||
" Description: Pulls github issues into Vim
|
||||
" Maintainer: Jonathan Warner <jaxbot@gmail.com> <http://github.com/jaxbot>
|
||||
" Homepage: http://jaxbot.me/
|
||||
" Repository: https://github.com/jaxbot/github-issues.vim
|
||||
" License: Copyright (C) 2014 Jonathan Warner
|
||||
" Released under the MIT license
|
||||
" ======================================================================
|
||||
|
||||
" do not load twice
|
||||
if exists("g:github_issues_loaded") || &cp
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:github_issues_loaded = 1
|
||||
|
||||
" do not continue if Vim is not compiled with Python support
|
||||
if !has("python") && !has("python3")
|
||||
echo "github-issues.vim requires Python support, sorry :c"
|
||||
finish
|
||||
endif
|
||||
|
||||
function! s:showGithubMilestones(...)
|
||||
call ghissues#init()
|
||||
|
||||
if a:0 <1
|
||||
Python showMilestoneList(0, "True")
|
||||
else
|
||||
Python showMilestoneList(vim.eval("a:1"), "True")
|
||||
endif
|
||||
|
||||
set buftype=nofile
|
||||
nnoremap <buffer> q :q<cr>
|
||||
nnoremap <buffer> <cr> :normal! 0<cr>:call <SID>setMilestone(getline("."))<cr>
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:showGithubIssues(...)
|
||||
call ghissues#init()
|
||||
|
||||
let github_failed = 0
|
||||
if a:0 < 1
|
||||
Python showIssueList(0, "True")
|
||||
else
|
||||
Python showIssueList(vim.eval("a:1"), "True")
|
||||
endif
|
||||
|
||||
if github_failed == "1"
|
||||
return
|
||||
endif
|
||||
|
||||
" its not a real file
|
||||
set buftype=nofile
|
||||
" map the enter key to show issue
|
||||
nnoremap <buffer> <cr> :call <SID>showIssue(expand("<cword>"),"")<cr>
|
||||
nnoremap <buffer> i :Giadd<cr>
|
||||
nnoremap <buffer> q :q<cr>
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:showSearchList()
|
||||
call ghissues#init()
|
||||
Python showSearchList()
|
||||
|
||||
" its not a real file
|
||||
set buftype=nofile
|
||||
" map the enter key to show issue
|
||||
nnoremap <buffer> <cr> :call <SID>showIssue(expand("<cword>"),"")<cr>
|
||||
nnoremap <buffer> i :Giadd<cr>
|
||||
nnoremap <buffer> q :q<cr>
|
||||
endfunction
|
||||
|
||||
function! s:showIssueLink(...)
|
||||
call ghissues#init()
|
||||
if a:0 > 2
|
||||
Python showIssueLink(vim.eval("a:1"), vim.eval("a:2"), vim.eval("a:3"))
|
||||
elseif a:0 > 1
|
||||
Python showIssueLink(vim.eval("a:1"), vim.eval("a:2"))
|
||||
else
|
||||
Python showIssueLink(vim.eval("a:1"))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:showIssue(...)
|
||||
call ghissues#init()
|
||||
|
||||
if a:0 > 2
|
||||
Python showIssueBuffer(vim.eval("a:1"), vim.eval("a:2"), vim.eval("a:3"))
|
||||
elseif a:0 > 1
|
||||
Python showIssueBuffer(vim.eval("a:1"), vim.eval("a:2"))
|
||||
else
|
||||
Python showIssueBuffer(vim.eval("a:1"))
|
||||
endif
|
||||
|
||||
|
||||
call s:setupOmni()
|
||||
|
||||
if a:1 == "new"
|
||||
normal 0llllllllll
|
||||
startinsert
|
||||
endif
|
||||
|
||||
setlocal nomodified
|
||||
endfunction
|
||||
|
||||
function! s:showThisIssue(...)
|
||||
call ghissues#init()
|
||||
|
||||
Python curUri = getRepoURI()
|
||||
|
||||
silent tabe
|
||||
set buftype=nofile
|
||||
normal ggdG
|
||||
|
||||
if a:0 > 1
|
||||
let name = "gissues/" . a:2 . "/" . a:1
|
||||
execute 'edit' name
|
||||
Python showIssue(vim.eval("a:1"),vim.eval("a:2"))
|
||||
else
|
||||
Python <<EOF
|
||||
name = "gissues/" + curUri + "/" + vim.eval("a:1")
|
||||
vim.command("edit " + name)
|
||||
Python showIssue(vim.eval("a:1"), curUri)
|
||||
EOF
|
||||
endif
|
||||
|
||||
" map the enter key to show issue or click link
|
||||
nnoremap <buffer> <cr> :call <SID>showIssueLink("","","False")<cr>
|
||||
nnoremap <buffer> s :call <SID>showIssueLink("","","True")<cr>
|
||||
nnoremap <buffer> <silent> q :q<CR>
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:setIssueState(state)
|
||||
Python setIssueData({ 'state': 'open' if vim.eval("a:state") == '1' else 'closed' })
|
||||
endfunction
|
||||
|
||||
function! s:browse()
|
||||
if has("patch-7.4.567")
|
||||
call netrw#BrowseX(b:ghissue_url,0)
|
||||
else
|
||||
call netrw#NetrwBrowseX(b:ghissue_url,0)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:updateIssue()
|
||||
call ghissues#init()
|
||||
Python showIssue()
|
||||
silent execute 'doautocmd BufReadPost '.expand('%:p')
|
||||
endfunction
|
||||
|
||||
function! s:saveIssue()
|
||||
call ghissues#init()
|
||||
Python saveGissue()
|
||||
silent execute 'doautocmd BufWritePost '.expand('%:p')
|
||||
endfunction
|
||||
|
||||
" omnicomplete function, also used by neocomplete
|
||||
function! githubissues#CompleteIssues(findstart, base)
|
||||
if g:gissues_lazy_load
|
||||
if !b:did_init_omnicomplete
|
||||
Python populateOmniComplete()
|
||||
let b:did_init_omnicomplete = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
if g:gissues_async_omni && len(b:omni_options) < 1
|
||||
if !b:did_init_omnicomplete_async
|
||||
let b:did_init_omnicomplete_async = 1
|
||||
Python doPopulateOmniComplete()
|
||||
endif
|
||||
endif
|
||||
|
||||
if a:findstart
|
||||
" locate the start of the word
|
||||
let line = getline('.')
|
||||
let start = col('.') - 1
|
||||
|
||||
while start > 0 && line[start - 1] =~ '\w'
|
||||
let start -= 1
|
||||
endwhile
|
||||
let b:compl_context = getline('.')[start - 1: col('.')]
|
||||
return start
|
||||
else
|
||||
let res = []
|
||||
if b:compl_context == '.'
|
||||
return res
|
||||
endif
|
||||
|
||||
for m in b:omni_options
|
||||
if m['menu'] == '[Issue]'
|
||||
if '#' . m['word'] =~ '^' . b:compl_context
|
||||
call add(res, m)
|
||||
endif
|
||||
elseif m['menu'] == '[User]'
|
||||
if '@' . m['word'] =~ '^' . b:compl_context
|
||||
call add(res, m)
|
||||
endif
|
||||
else
|
||||
if m['word'] =~ '^' . b:compl_context || ' ' . m['word'] =~ '^' . b:compl_context
|
||||
call add(res, m)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
return res
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" set omnifunc for the buffer
|
||||
function! s:setupOmni()
|
||||
call ghissues#init()
|
||||
|
||||
setlocal omnifunc=githubissues#CompleteIssues
|
||||
|
||||
" empty array will store the menu items
|
||||
let b:omni_options = []
|
||||
|
||||
if !g:gissues_lazy_load
|
||||
Python populateOmniComplete()
|
||||
if !g:gissues_async_omni
|
||||
Python doPopulateOmniComplete()
|
||||
endif
|
||||
else
|
||||
let b:did_init_omnicomplete = 0
|
||||
endif
|
||||
|
||||
let b:did_init_omnicomplete_async = 0
|
||||
endfunction
|
||||
|
||||
function! s:setMilestone(title)
|
||||
let title = ""
|
||||
if a:title != "[None]"
|
||||
let title = a:title
|
||||
echo "Switched current milestone to " . title
|
||||
else
|
||||
echo "No longer filtering by milestone"
|
||||
endif
|
||||
|
||||
let g:github_current_milestone = title
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:commitHighlighting()
|
||||
hi shaHighlight term=bold cterm=bold gui=bold ctermfg=red guifg=red
|
||||
syn match shaHighlight "\v^[a-zA-Z0-9]{40}"
|
||||
endfunction
|
||||
|
||||
" define the :Gissues command
|
||||
command! -nargs=* Gissues call s:showGithubIssues(<f-args>)
|
||||
command! -nargs=* Gisearch call s:showSearchList(<f-args>)
|
||||
command! -nargs=* Giadd call s:showIssue("new", <f-args>)
|
||||
command! -nargs=* Giedit call s:showIssue(<f-args>)
|
||||
command! -nargs=0 Giupdate call s:updateIssue()
|
||||
|
||||
command! -nargs=* Gmiles call s:showGithubMilestones(<f-args>)
|
||||
|
||||
command! -nargs=* Gishow call s:showThisIssue(<f-args>)
|
||||
|
||||
autocmd BufReadCmd gissues/*/\([0-9]*\|new\) call s:updateIssue()
|
||||
autocmd BufReadCmd gissues/*/\([0-9]*\|new\) nnoremap <buffer> cc :call <SID>setIssueState(0)<cr>
|
||||
autocmd BufReadCmd gissues/*/\([0-9]*\|new\) nnoremap <buffer> co :call <SID>setIssueState(1)<cr>
|
||||
autocmd BufReadCmd gissues/*/\([0-9]*\|new\) nnoremap <buffer> cb :call <SID>browse()<cr>
|
||||
|
||||
" map the enter key to show issue or click link
|
||||
autocmd BufReadCmd gissues/*/\([0-9]*\|new\) nnoremap <buffer> <cr> :call <SID>showIssueLink("","","False")<cr>
|
||||
autocmd BufReadCmd gissues/*/\([0-9]*\|new\) nnoremap <buffer> s :call <SID>showIssueLink("","","True")<cr>
|
||||
autocmd BufReadCmd gissues/*/\([0-9]*\|new\) nnoremap <buffer> <silent> q :q<CR>
|
||||
|
||||
autocmd BufWriteCmd gissues/*/[0-9a-z]* call s:saveIssue()
|
||||
|
||||
if !exists("g:github_issues_no_omni")
|
||||
" Neocomplete support
|
||||
if !exists('g:neocomplete#sources#omni#input_patterns')
|
||||
let g:neocomplete#sources#omni#input_patterns = {}
|
||||
endif
|
||||
let g:neocomplete#sources#omni#input_patterns.gitcommit = '.'
|
||||
let g:neocomplete#sources#omni#input_patterns.gfimarkdown = '.'
|
||||
|
||||
" Install omnifunc on gitcommit files
|
||||
autocmd FileType gitcommit call s:setupOmni()
|
||||
endif
|
||||
|
||||
if !exists("g:github_access_token")
|
||||
let g:github_access_token = ""
|
||||
elseif filereadable(expand(g:github_access_token))
|
||||
let lines = readfile(expand(g:github_access_token))
|
||||
if !empty(lines)
|
||||
let g:github_access_token=lines[0]
|
||||
endif
|
||||
endif
|
||||
|
||||
if !exists("g:github_upstream_issues")
|
||||
let g:github_upstream_issues = 0
|
||||
endif
|
||||
|
||||
if !exists("g:github_issues_urls")
|
||||
let g:github_issues_urls = ["github.com:", "github.com/"]
|
||||
endif
|
||||
|
||||
if !exists("g:github_api_url")
|
||||
let g:github_api_url = "https://api.github.com/"
|
||||
endif
|
||||
|
||||
if !exists("g:github_issues_max_pages")
|
||||
let g:github_issues_max_pages = 1
|
||||
endif
|
||||
|
||||
" force issues and what not to stay in the same window
|
||||
if !exists("g:github_same_window")
|
||||
let g:github_same_window = 0
|
||||
endif
|
||||
|
||||
" allow milestone filtering
|
||||
if !exists("g:github_current_milestone")
|
||||
let g:github_current_milestone = ""
|
||||
endif
|
||||
|
||||
" lazy load issues
|
||||
if !exists("g:gissues_lazy_load")
|
||||
let g:gissues_lazy_load = 0
|
||||
endif
|
||||
|
||||
" asynchronously load autocomplete
|
||||
if !exists("g:gissues_async_omni")
|
||||
let g:gissues_async_omni = 0
|
||||
endif
|
||||
|
||||
if !exists("g:gissues_default_remote")
|
||||
let g:gissues_default_remote = "origin"
|
||||
endif
|
||||
|
||||
if !exists("g:gissues_show_errors")
|
||||
let g:gissues_show_errors = 0
|
||||
endif
|
||||
|
||||
if !exists("g:gissues_offline_cache")
|
||||
let g:gissues_offline_cache = 0
|
||||
endif
|
||||
|
||||
if !exists("g:gissues_issue_vsplit")
|
||||
let g:gissues_issue_vsplit = 0
|
||||
endif
|
||||
|
||||
if !exists("g:gissues_list_vsplit")
|
||||
let g:gissues_list_vsplit = 0
|
||||
endif
|
||||
|
||||
if !exists("g:gissues_split_expand")
|
||||
let g:gissues_split_expand = 0
|
||||
endif
|
||||
|
||||
if !exists("g:gissues_split_height")
|
||||
let g:gissues_split_height = 0
|
||||
endif
|
||||
|
||||
if !exists("g:gissues_vsplit_width")
|
||||
let g:gissues_vsplit_width = 0
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
1113
bundle/github-issues.vim/rplugin/python/ghissues.py
Normal file
1113
bundle/github-issues.vim/rplugin/python/ghissues.py
Normal file
File diff suppressed because it is too large
Load Diff
125
bundle/github-issues.vim/syntax/gfimarkdown.vim
Normal file
125
bundle/github-issues.vim/syntax/gfimarkdown.vim
Normal file
@ -0,0 +1,125 @@
|
||||
" Vim syntax file
|
||||
" Language: Github Flavored Markdown plus Issues
|
||||
" Markdown.vim Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" GFM Maintainer: Jeff Tratner <github.com/jtratner>
|
||||
" GFM plus issues Maintainer: Jonathan Warner <github.com/jaxbot>
|
||||
" Same as GFM, but with issue highlighting and such
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('main_syntax')
|
||||
let main_syntax = 'ghmarkdown'
|
||||
endif
|
||||
|
||||
runtime! syntax/html.vim
|
||||
unlet! b:current_syntax
|
||||
|
||||
syn sync minlines=10
|
||||
syn case ignore
|
||||
|
||||
syn match markdownValid '[<>]\c[a-z/$!]\@!'
|
||||
syn match markdownValid '&\%(#\=\w*;\)\@!'
|
||||
|
||||
syn match markdownLineStart "^[<@]\@!" nextgroup=@markdownBlock,htmlSpecialChar
|
||||
|
||||
syn cluster markdownBlock contains=markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6,markdownBlockquote,markdownListMarker,markdownOrderedListMarker,markdownCodeBlock,markdownRule,markdownGHCodeBlock
|
||||
syn cluster markdownInline contains=markdownLineBreak,markdownLinkText,markdownItalic,markdownBold,markdownCode,markdownEscape,@htmlTop,markdownError
|
||||
|
||||
syn match markdownH1 "^.\+\n=\+$" contained contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink
|
||||
syn match markdownH2 "^.\+\n-\+$" contained contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink
|
||||
|
||||
syn match markdownHeadingRule "^[=-]\+$" contained
|
||||
|
||||
syn region markdownH1 matchgroup=markdownHeadingDelimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
syn region markdownH2 matchgroup=markdownHeadingDelimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
syn region markdownH3 matchgroup=markdownHeadingDelimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
syn region markdownH4 matchgroup=markdownHeadingDelimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
syn region markdownH5 matchgroup=markdownHeadingDelimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
syn region markdownH6 matchgroup=markdownHeadingDelimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
|
||||
|
||||
syn match markdownBlockquote ">\%(\s\|$\)" contained nextgroup=@markdownBlock
|
||||
|
||||
syn region markdownCodeBlock start=" \|\t" end="$" contained
|
||||
|
||||
" TODO: real nesting
|
||||
syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained
|
||||
syn match markdownOrderedListMarker "\%(\t\| \{0,4}\)\<\d\+\.\%(\s\+\S\)\@=" contained
|
||||
|
||||
syn match markdownRule "\* *\* *\*[ *]*$" contained
|
||||
syn match markdownRule "- *- *-[ -]*$" contained
|
||||
|
||||
syn match markdownLineBreak " \{2,\}$"
|
||||
|
||||
syn region markdownIdDeclaration matchgroup=markdownLinkDelimiter start="^ \{0,3\}!\=\[" end="\]:" oneline keepend nextgroup=markdownUrl skipwhite
|
||||
syn match markdownUrl "\S\+" nextgroup=markdownUrlTitle skipwhite contained
|
||||
syn region markdownUrl matchgroup=markdownUrlDelimiter start="<" end=">" oneline keepend nextgroup=markdownUrlTitle skipwhite contained
|
||||
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+"+ end=+"+ keepend contained
|
||||
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+'+ end=+'+ keepend contained
|
||||
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+(+ end=+)+ keepend contained
|
||||
|
||||
syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" keepend nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart
|
||||
syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained
|
||||
syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
|
||||
syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline
|
||||
|
||||
syn region markdownItalic start="\<\*\|\*\>" end="\<\*\|\*\>" keepend contains=markdownLineStart
|
||||
syn region markdownItalic start="\<_\|_\>" end="\<_\|_\>" keepend contains=markdownLineStart
|
||||
syn region markdownBold start="\<\*\*\|\*\*\>" end="\<\*\*\|\*\*\>" keepend contains=markdownLineStart,markdownItalic
|
||||
syn region markdownBold start="\<__\|__\>" end="\<__\|__\>" keepend contains=markdownLineStart,markdownItalic
|
||||
syn region markdownBoldItalic start="\<\*\*\*\|\*\*\*\>" end="\<\*\*\*\|\*\*\*\>" keepend contains=markdownLineStart
|
||||
syn region markdownBoldItalic start="\<___\|___\>" end="\<___\|___\>" keepend contains=markdownLineStart
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart
|
||||
syn region markdownGHCodeBlock matchgroup=markdownCodeDelimiter start="^\s*$\n\s*```\s\?\S*\s*$" end="\s*```$\n\s*\n" contained keepend
|
||||
syn region markdownGHCodeBlock matchgroup=markdownCodeDelimiter start="^\s*```.*$" end="^\s*```\ze\s*$" keepend
|
||||
|
||||
syn match markdownEscape "\\[][\\`*_{}()#+.!-]"
|
||||
|
||||
" github-issues.vim stuff:
|
||||
" commit hash
|
||||
syn match Constant "[A-Za-z0-9]\{40}"
|
||||
" issue number
|
||||
syn match Constant "\#[0-9]\+"
|
||||
|
||||
" Copying rst's method of using literal strings
|
||||
hi def link markdownGHCodeBlock String
|
||||
hi def link markdownCodeBlock String
|
||||
hi def link markdownCode String
|
||||
hi def link markdownH1 htmlH1
|
||||
hi def link markdownH2 htmlH2
|
||||
hi def link markdownH3 htmlH3
|
||||
hi def link markdownH4 htmlH4
|
||||
hi def link markdownH5 htmlH5
|
||||
hi def link markdownH6 htmlH6
|
||||
hi def link markdownHeadingRule markdownRule
|
||||
hi def link markdownHeadingDelimiter Delimiter
|
||||
hi def link markdownOrderedListMarker markdownListMarker
|
||||
hi def link markdownListMarker htmlTagName
|
||||
hi def link markdownBlockquote Comment
|
||||
hi def link markdownRule PreProc
|
||||
|
||||
hi def link markdownLinkText htmlLink
|
||||
hi def link markdownIdDeclaration Typedef
|
||||
hi def link markdownId Type
|
||||
hi def link markdownAutomaticLink markdownUrl
|
||||
hi def link markdownUrl Float
|
||||
hi def link markdownUrlTitle String
|
||||
hi def link markdownIdDelimiter markdownLinkDelimiter
|
||||
hi def link markdownUrlDelimiter htmlTag
|
||||
hi def link markdownUrlTitleDelimiter Delimiter
|
||||
|
||||
hi def link markdownItalic htmlItalic
|
||||
hi def link markdownBold htmlBold
|
||||
hi def link markdownBoldItalic htmlBoldItalic
|
||||
hi def link markdownCodeDelimiter Delimiter
|
||||
|
||||
hi def link markdownEscape Special
|
||||
|
||||
let b:current_syntax = "gfimarkdown"
|
||||
|
||||
if main_syntax ==# 'gfimarkdown'
|
||||
unlet main_syntax
|
||||
endif
|
||||
" vim:set sw=2:
|
47
bundle/github-issues.vim/test/test.vim
Normal file
47
bundle/github-issues.vim/test/test.vim
Normal file
@ -0,0 +1,47 @@
|
||||
function! s:run_tests()
|
||||
exec ":Gissues"
|
||||
let line = getline(".")
|
||||
|
||||
call s:expectEqual(getline("."), "No results found in jaxbot/test")
|
||||
|
||||
exec ":Giadd"
|
||||
|
||||
call s:expectEqual(getline("."), "# (new)")
|
||||
|
||||
exec "normal iTest Issue for Gissues"
|
||||
exec ":w"
|
||||
|
||||
call s:expectEqual(getline("7"), "No comments.")
|
||||
|
||||
exec ":4"
|
||||
normal $a enhancement
|
||||
normal GoTest comment
|
||||
|
||||
exec ":w"
|
||||
call s:expectEqual(getline("8"), "Test comment")
|
||||
call s:expectEqual(getline("4"), "## Labels: enhancement")
|
||||
|
||||
exec ":Gissues"
|
||||
normal ee
|
||||
call s:expectEqual(expand("<cword>"), "Test")
|
||||
|
||||
exec "normal \<cr>"
|
||||
|
||||
call s:expectEqual(getline("3"), "## State: open")
|
||||
normal cc
|
||||
call s:expectEqual(getline("3"), "## State: closed")
|
||||
|
||||
echom "Finished!"
|
||||
exec ":messages"
|
||||
endfunction
|
||||
|
||||
function! s:expectEqual(actual, expected)
|
||||
if a:actual == a:expected
|
||||
else
|
||||
throw "Assertion failed: Expected " . a:expected . ", got " . a:actual
|
||||
endif
|
||||
endfunction
|
||||
|
||||
edit ~/www/test/README.md
|
||||
call s:run_tests()
|
||||
|
Loading…
Reference in New Issue
Block a user