From 017ef0b420a4d9e85a36eb6b0f2a431ff6b42254 Mon Sep 17 00:00:00 2001 From: eliasrodrigo Date: Tue, 19 Sep 2017 12:37:40 +0200 Subject: [PATCH 01/89] Add _sass/ dir to _config.yml. --- docs/_config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/_config.yml b/docs/_config.yml index cf23c2cda..ea6cba2d1 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -13,3 +13,7 @@ plugins: - jekyll-sitemap github: [metadata] + +sass: + sass_dir: _sass + style: compressed From 1e31e27f4b4d3ea5b3477f032b07d6eb888e068c Mon Sep 17 00:00:00 2001 From: eliasrodrigo Date: Tue, 19 Sep 2017 12:41:12 +0200 Subject: [PATCH 02/89] css/style.css is now just main.scss. (https://jekyllrb.com/docs/assets/#sassscss). --- docs/assets/css/main.scss | 6 + docs/assets/css/style.css | 277 -------------------------------------- 2 files changed, 6 insertions(+), 277 deletions(-) create mode 100644 docs/assets/css/main.scss delete mode 100644 docs/assets/css/style.css diff --git a/docs/assets/css/main.scss b/docs/assets/css/main.scss new file mode 100644 index 000000000..aac3c6f6e --- /dev/null +++ b/docs/assets/css/main.scss @@ -0,0 +1,6 @@ +--- +# this ensures Jekyll reads the file to be transformed into CSS later +# only Main files contain this front matter, not partials. +--- + +@import "_spacevim.scss"; diff --git a/docs/assets/css/style.css b/docs/assets/css/style.css deleted file mode 100644 index f00fd2bdd..000000000 --- a/docs/assets/css/style.css +++ /dev/null @@ -1,277 +0,0 @@ -/*! normalize.css 2012-02-07T12:37 UTC - https://github.com/necolas/normalize.css */ -/* ============================================================================= HTML5 display definitions ========================================================================== */ -/* Corrects block display not defined in IE6/7/8/9 & FF3 */ -article, aside, details, figcaption, figure, footer, header, hgroup, nav, section, summary { display: block; } - -/* Corrects inline-block display not defined in IE6/7/8/9 & FF3 */ -audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } - -/* Prevents modern browsers from displaying 'audio' without controls */ -audio:not([controls]) { display: none; } - -/* Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4 Known issue: no IE6 support */ -[hidden] { display: none; } - -/* ============================================================================= Base ========================================================================== */ -/* 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units http://clagnut.com/blog/348/#c790 2. Prevents iOS text size adjust after orientation change, without disabling user zoom www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/ */ -html { font-size: 100%; /* 1 */ -webkit-text-size-adjust: 100%; /* 2 */ -ms-text-size-adjust: 100%; /* 2 */ } - -/* Addresses font-family inconsistency between 'textarea' and other form elements. */ -html, button, input, select, textarea { font-family: sans-serif; } - -/* Addresses margins handled incorrectly in IE6/7 */ -body { margin: 0; } - -/* ============================================================================= Links ========================================================================== */ -/* Addresses outline displayed oddly in Chrome */ -a:focus { outline: thin dotted; } - -/* Improves readability when focused and also mouse hovered in all browsers people.opera.com/patrickl/experiments/keyboard/test */ -a:hover, a:active { outline: 0; } - -/* ============================================================================= Typography ========================================================================== */ -/* Addresses font sizes and margins set differently in IE6/7 Addresses font sizes within 'section' and 'article' in FF4+, Chrome, S5 */ -h1 { font-size: 3em; margin: 0.67em 0; } - -h2 { font-size: 2.75em; margin: 0.83em 0; } - -h3 { font-size: 2.5em; margin: 1em 0; } - -h4 { font-size: 2.25em; margin: 1.33em 0; } - -h5 { font-size: 2em; margin: 1.67em 0; } - -h6 { font-size: 1.75em; margin: 2.33em 0; } - -/* Addresses styling not present in IE7/8/9, S5, Chrome */ -abbr[title] { border-bottom: 1px dotted; } - -/* Addresses style set to 'bolder' in FF3+, S4/5, Chrome -*/ -b, strong { font-weight: bold; } - -blockquote { margin: 1em 40px; } - -/* Addresses styling not present in S5, Chrome */ -dfn { font-style: italic; } - -/* Addresses styling not present in IE6/7/8/9 */ -mark { background: #ff0; color: #000; } - -/* Addresses margins set differently in IE6/7 */ -p, pre { margin: 1em 0; } - -/* Corrects font family set oddly in IE6, S4/5, Chrome en.wikipedia.org/wiki/User:Davidgothberg/Test59 */ -pre, code, kbd, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; } - -/* 1. Addresses CSS quotes not supported in IE6/7 2. Addresses quote property not supported in S4 */ -/* 1 */ -q { quotes: none; } - -/* 2 */ -q:before, q:after { content: ''; content: none; } - -small { font-size: 75%; } - -/* Prevents sub and sup affecting line-height in all browsers gist.github.com/413930 */ -sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } - -sup { top: -0.5em; } - -sub { bottom: -0.25em; } - -/* ============================================================================= Lists ========================================================================== */ -/* Addresses margins set differently in IE6/7 */ -dl, menu, ol, ul { margin: 1em 0; } - -dd { margin: 0 0 0 40px; } - -/* Addresses paddings set differently in IE6/7 */ -menu, ol, ul { padding: 0 0 0 20px; } - -/* Corrects list images handled incorrectly in IE7 */ -nav ul, nav ol { list-style: none; list-style-image: none; } - -/* ============================================================================= Embedded content ========================================================================== */ -/* 1. Removes border when inside 'a' element in IE6/7/8/9, FF3 2. Improves image quality when scaled in IE7 code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/ */ -img { border: 0; /* 1 */ -ms-interpolation-mode: bicubic; /* 2 */ } - -/* Corrects overflow displayed oddly in IE9 */ -svg:not(:root) { overflow: hidden; } - -/* ============================================================================= Figures ========================================================================== */ -/* Addresses margin not present in IE6/7/8/9, S5, O11 */ -figure { margin: 0; } - -/* ============================================================================= Forms ========================================================================== */ -/* Corrects margin displayed oddly in IE6/7 */ -form { margin: 0; } - -/* Define consistent border, margin, and padding */ -fieldset { border: 1px solid #c0c0c0; margin: 0 2px; padding: 0.35em 0.625em 0.75em; } - -/* 1. Corrects color not being inherited in IE6/7/8/9 2. Corrects text not wrapping in FF3 3. Corrects alignment displayed oddly in IE6/7 */ -legend { border: 0; /* 1 */ padding: 0; white-space: normal; /* 2 */ *margin-left: -7px; /* 3 */ } - -/* 1. Corrects font size not being inherited in all browsers 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome 3. Improves appearance and consistency in all browsers */ -button, input, select, textarea { font-size: 100%; /* 1 */ margin: 0; /* 2 */ vertical-align: baseline; /* 3 */ *vertical-align: middle; /* 3 */ } - -/* Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet */ -button, input { line-height: normal; /* 1 */ } - -/* 1. Improves usability and consistency of cursor style between image-type 'input' and others 2. Corrects inability to style clickable 'input' types in iOS 3. Removes inner spacing in IE7 without affecting normal text inputs Known issue: inner spacing remains in IE6 */ -button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; /* 1 */ -webkit-appearance: button; /* 2 */ *overflow: visible; /* 3 */ } - -/* Re-set default cursor for disabled elements */ -button[disabled], input[disabled] { cursor: default; } - -/* 1. Addresses box sizing set to content-box in IE8/9 2. Removes excess padding in IE8/9 3. Removes excess padding in IE7 Known issue: excess padding remains in IE6 */ -input[type="checkbox"], input[type="radio"] { box-sizing: border-box; /* 1 */ padding: 0; /* 2 */ *height: 13px; /* 3 */ *width: 13px; /* 3 */ } - -/* 1. Addresses appearance set to searchfield in S5, Chrome 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof) */ -input[type="search"] { -webkit-appearance: textfield; /* 1 */ -moz-box-sizing: content-box; -webkit-box-sizing: content-box; /* 2 */ box-sizing: content-box; } - -/* Removes inner padding and search cancel button in S5, Chrome on OS X */ -input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; } - -/* Removes inner padding and border in FF3+ www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/ */ -button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } - -/* 1. Removes default vertical scrollbar in IE6/7/8/9 2. Improves readability and alignment in all browsers */ -textarea { overflow: auto; /* 1 */ vertical-align: top; /* 2 */ } - -/* ============================================================================= Tables ========================================================================== */ -/* Remove most spacing between table cells */ -table { border-collapse: collapse; border-spacing: 0; } - -@font-face { font-family: 'OpenSansLight'; src: url("../fonts/OpenSans-Light-webfont.eot"); src: url("../fonts/OpenSans-Light-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Light-webfont.woff") format("woff"), url("../fonts/OpenSans-Light-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Light-webfont.svg#OpenSansLight") format("svg"); font-weight: normal; font-style: normal; } -@font-face { font-family: 'OpenSansLightItalic'; src: url("../fonts/OpenSans-LightItalic-webfont.eot"); src: url("../fonts/OpenSans-LightItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-LightItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-LightItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-LightItalic-webfont.svg#OpenSansLightItalic") format("svg"); font-weight: normal; font-style: normal; } -@font-face { font-family: 'OpenSansRegular'; src: url("../fonts/OpenSans-Regular-webfont.eot"); src: url("../fonts/OpenSans-Regular-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Regular-webfont.woff") format("woff"), url("../fonts/OpenSans-Regular-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Regular-webfont.svg#OpenSansRegular") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } -@font-face { font-family: 'OpenSansItalic'; src: url("../fonts/OpenSans-Italic-webfont.eot"); src: url("../fonts/OpenSans-Italic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Italic-webfont.woff") format("woff"), url("../fonts/OpenSans-Italic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Italic-webfont.svg#OpenSansItalic") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } -@font-face { font-family: 'OpenSansSemibold'; src: url("../fonts/OpenSans-Semibold-webfont.eot"); src: url("../fonts/OpenSans-Semibold-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Semibold-webfont.woff") format("woff"), url("../fonts/OpenSans-Semibold-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Semibold-webfont.svg#OpenSansSemibold") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } -@font-face { font-family: 'OpenSansSemiboldItalic'; src: url("../fonts/OpenSans-SemiboldItalic-webfont.eot"); src: url("../fonts/OpenSans-SemiboldItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-SemiboldItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-SemiboldItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-SemiboldItalic-webfont.svg#OpenSansSemiboldItalic") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } -@font-face { font-family: 'OpenSansBold'; src: url("../fonts/OpenSans-Bold-webfont.eot"); src: url("../fonts/OpenSans-Bold-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Bold-webfont.woff") format("woff"), url("../fonts/OpenSans-Bold-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Bold-webfont.svg#OpenSansBold") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } -@font-face { font-family: 'OpenSansBoldItalic'; src: url("../fonts/OpenSans-BoldItalic-webfont.eot"); src: url("../fonts/OpenSans-BoldItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-BoldItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-BoldItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-BoldItalic-webfont.svg#OpenSansBoldItalic") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } -/* generated by rouge http://rouge.jneen.net/ original base16 by Chris Kempson (https://github.com/chriskempson/base16) -*/ -.highlight table td { padding: 5px; } - -.highlight table pre { margin: 0; } - -.highlight, .highlight .w { color: #d0d0d0; } - -.highlight .err { color: #151515; background-color: #ac4142; } - -.highlight .c, .highlight .cd, .highlight .cm, .highlight .c1, .highlight .cs { color: #888; } - -.highlight .cp { color: #f4bf75; } - -.highlight .nt { color: #f4bf75; } - -.highlight .o, .highlight .ow { color: #d0d0d0; } - -.highlight .p, .highlight .pi { color: #d0d0d0; } - -.highlight .gi { color: #90a959; } - -.highlight .gd { color: #ac4142; } - -.highlight .gh { color: #6a9fb5; font-weight: bold; } - -.highlight .k, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kv { color: #aa759f; } - -.highlight .kc { color: #d28445; } - -.highlight .kt { color: #d28445; } - -.highlight .kd { color: #d28445; } - -.highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .s1 { color: #90a959; } - -.highlight .sr { color: #75b5aa; } - -.highlight .si { color: #8f5536; } - -.highlight .se { color: #8f5536; } - -.highlight .nn { color: #f4bf75; } - -.highlight .nc { color: #f4bf75; } - -.highlight .no { color: #f4bf75; } - -.highlight .na { color: #6a9fb5; } - -.highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mb, .highlight .mx { color: #90a959; } - -.highlight .ss { color: #90a959; } - -body { padding: 0px 0 20px 0px; margin: 0px; font: 14px/1.5 "OpenSansRegular", "Helvetica Neue", Helvetica, Arial, sans-serif; color: #f0e7d5; font-weight: normal; background: #252525; background-attachment: fixed !important; background: linear_gradient(#2a2a29, #1c1c1c); } - -h1, h2, h3, h4, h5, h6 { color: #e8e8e8; margin: 0 0 10px; font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; } - -p, ul, ol, table, pre, dl { margin: 0 0 20px; } - -h1, h2, h3 { line-height: 1.1; } - -h1 { font-size: 28px; } - -h2 { font-size: 24px; } - -h4, h5, h6 { color: #e8e8e8; } - -h3 { font-size: 18px; line-height: 24px; font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif !important; font-weight: normal; color: #b6b6b6; } - -a { color: #ffcc00; font-weight: 400; text-decoration: none; } -a:hover { color: #ffeb9b; } - -a small { font-size: 11px; color: #666; margin-top: -0.6em; display: block; } - -ul { list-style-image: url("../images/bullet.png"); } - -strong { font-family: 'OpenSansBold', "Helvetica Neue", Helvetica, Arial, sans-serif !important; font-weight: normal; } - -.wrapper { max-width: 650px; margin: 0 auto; position: relative; padding: 0 20px; } - -section img { max-width: 100%; } - -blockquote { border-left: 3px solid #ffcc00; margin: 0; padding: 0 0 0 20px; font-style: italic; } - -code { font-family: Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal, monospace; color: #efefef; font-size: 13px; margin: 0 4px; padding: 4px 6px; border-radius: 2px; } - -pre { padding: 8px 15px; background: #191919; border-radius: 2px; border: 1px solid #121212; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3); overflow: auto; overflow-y: hidden; } -pre code { color: #efefef; text-shadow: 0px 1px 0px #000; margin: 0; padding: 0; } - -table { width: 100%; border-collapse: collapse; } - -th { text-align: left; padding: 5px 10px; border-bottom: 1px solid #434343; color: #b6b6b6; font-family: 'OpenSansSemibold', "Helvetica Neue", Helvetica, Arial, sans-serif !important; font-weight: normal; } - -td { text-align: left; padding: 5px 10px; border-bottom: 1px solid #434343; } - -hr { border: 0; outline: none; height: 3px; background: transparent url("../images/hr.gif") center center repeat-x; margin: 0 0 20px; } - -dt { color: #F0E7D5; font-family: 'OpenSansSemibold', "Helvetica Neue", Helvetica, Arial, sans-serif !important; font-weight: normal; } - -#header { z-index: 100; left: 0; top: 0px; height: 60px; width: 100%; position: fixed; background: url(../images/nav-bg.gif) #353535; border-bottom: 4px solid #434343; box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.25); } -#header nav { max-width: 650px; margin: 0 auto; padding: 0 10px; background: blue; margin: 6px auto; } -#header nav li { font-family: 'OpenSansLight', "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; list-style: none; display: inline; color: white; line-height: 50px; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.2); font-size: 14px; } -#header nav li a { color: white; border: 1px solid #5d910b; background: linear_gradient(#93bd20, #659e10); border-radius: 2px; box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.3), 0px 3px 7px rgba(0, 0, 0, 0.7); background-color: #93bd20; padding: 10px 12px; margin-top: 6px; line-height: 14px; font-size: 14px; display: inline-block; text-align: center; } -#header nav li a:hover { background: linear_gradient(#749619, #527f0e); background-color: #659e10; border: 1px solid #527f0e; box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 1px 0px rgba(0, 0, 0, 0); } -#header nav li.fork { float: left; margin-left: 0px; } -#header nav li.downloads { float: right; margin-left: 6px; } -#header nav li.title { float: right; margin-right: 10px; font-size: 11px; } - -section { max-width: 650px; padding: 30px 0px 50px 0px; margin: 20px 0; margin-top: 70px; } -section #title { border: 0; outline: none; margin: 0 0 50px 0; padding: 0 0 5px 0; } -section #title h1 { font-family: 'OpenSansLight', "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; font-size: 40px; text-align: center; line-height: 36px; } -section #title p { color: #d7cfbe; font-family: 'OpenSansLight', "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; font-size: 18px; text-align: center; } -section #title .credits { font-size: 11px; font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; color: #696969; margin-top: -10px; } -section #title .credits.left { float: left; } -section #title .credits.right { float: right; } - -@media print, screen and (max-width: 720px) { #title .credits { display: block; width: 100%; line-height: 30px; text-align: center; } - #title .credits .left { float: none; display: block; } - #title .credits .right { float: none; display: block; } } -@media print, screen and (max-width: 480px) { #header { margin-top: -20px; } - section { margin-top: 40px; } - nav { display: none; } } From 1131b66da2058e72ad1f8dcbc4768122034a42a2 Mon Sep 17 00:00:00 2001 From: eliasrodrigo Date: Tue, 19 Sep 2017 12:46:27 +0200 Subject: [PATCH 03/89] The content from css/styles.css is now on _sass/_spacevim.scss. The _sass/_variables.scss file can be used change css values, ex: the headers font-size. --- docs/_sass/_spacevim.scss | 286 +++++++++++++++++++++++++++++++++++++ docs/_sass/_variables.scss | 7 + 2 files changed, 293 insertions(+) create mode 100644 docs/_sass/_spacevim.scss create mode 100644 docs/_sass/_variables.scss diff --git a/docs/_sass/_spacevim.scss b/docs/_sass/_spacevim.scss new file mode 100644 index 000000000..8bd59c25b --- /dev/null +++ b/docs/_sass/_spacevim.scss @@ -0,0 +1,286 @@ +@charset "utf-8"; + +// Variables +@import "variables"; + +/*! normalize.css 2012-02-07T12:37 UTC - https://github.com/necolas/normalize.css */ +/* ============================================================================= HTML5 display definitions ========================================================================== */ +/* Corrects block display not defined in IE6/7/8/9 & FF3 */ +article, aside, details, figcaption, figure, footer, header, hgroup, nav, section, summary { display: block; } + +/* Corrects inline-block display not defined in IE6/7/8/9 & FF3 */ +audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } + +/* Prevents modern browsers from displaying 'audio' without controls */ +audio:not([controls]) { display: none; } + +/* Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4 Known issue: no IE6 support */ +[hidden] { display: none; } + +/* ============================================================================= Base ========================================================================== */ +/* 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units http://clagnut.com/blog/348/#c790 2. Prevents iOS text size adjust after orientation change, without disabling user zoom www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/ */ +html { font-size: 100%; /* 1 */ -webkit-text-size-adjust: 100%; /* 2 */ -ms-text-size-adjust: 100%; /* 2 */ } + +/* Addresses font-family inconsistency between 'textarea' and other form elements. */ +html, button, input, select, textarea { font-family: sans-serif; } + +/* Addresses margins handled incorrectly in IE6/7 */ +body { margin: 0; } + +/* ============================================================================= Links ========================================================================== */ +/* Addresses outline displayed oddly in Chrome */ +a:focus { outline: thin dotted; } + +/* Improves readability when focused and also mouse hovered in all browsers people.opera.com/patrickl/experiments/keyboard/test */ +a:hover, a:active { outline: 0; } + +/* ============================================================================= Typography ========================================================================== */ +/* Addresses font sizes and margins set differently in IE6/7 Addresses font sizes within 'section' and 'article' in FF4+, Chrome, S5 */ +h1 { font-size: 3em; margin: 0.67em 0; } + +h2 { font-size: 2.75em; margin: 0.83em 0; } + +h3 { font-size: 2.5em; margin: 1em 0; } + +h4 { font-size: 2.25em; margin: 1.33em 0; } + +h5 { font-size: 2em; margin: 1.67em 0; } + +h6 { font-size: 1.75em; margin: 2.33em 0; } + +/* Addresses styling not present in IE7/8/9, S5, Chrome */ +abbr[title] { border-bottom: 1px dotted; } + +/* Addresses style set to 'bolder' in FF3+, S4/5, Chrome +*/ +b, strong { font-weight: bold; } + +blockquote { margin: 1em 40px; } + +/* Addresses styling not present in S5, Chrome */ +dfn { font-style: italic; } + +/* Addresses styling not present in IE6/7/8/9 */ +mark { background: #ff0; color: #000; } + +/* Addresses margins set differently in IE6/7 */ +p, pre { margin: 1em 0; } + +/* Corrects font family set oddly in IE6, S4/5, Chrome en.wikipedia.org/wiki/User:Davidgothberg/Test59 */ +pre, code, kbd, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; } + +/* 1. Addresses CSS quotes not supported in IE6/7 2. Addresses quote property not supported in S4 */ +/* 1 */ +q { quotes: none; } + +/* 2 */ +q:before, q:after { content: ''; content: none; } + +small { font-size: 75%; } + +/* Prevents sub and sup affecting line-height in all browsers gist.github.com/413930 */ +sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } + +sup { top: -0.5em; } + +sub { bottom: -0.25em; } + +/* ============================================================================= Lists ========================================================================== */ +/* Addresses margins set differently in IE6/7 */ +dl, menu, ol, ul { margin: 1em 0; } + +dd { margin: 0 0 0 40px; } + +/* Addresses paddings set differently in IE6/7 */ +menu, ol, ul { padding: 0 0 0 20px; } + +/* Corrects list images handled incorrectly in IE7 */ +nav ul, nav ol { list-style: none; list-style-image: none; } + +/* ============================================================================= Embedded content ========================================================================== */ +/* 1. Removes border when inside 'a' element in IE6/7/8/9, FF3 2. Improves image quality when scaled in IE7 code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/ */ +img { border: 0; /* 1 */ -ms-interpolation-mode: bicubic; /* 2 */ } + +/* Corrects overflow displayed oddly in IE9 */ +svg:not(:root) { overflow: hidden; } + +/* ============================================================================= Figures ========================================================================== */ +/* Addresses margin not present in IE6/7/8/9, S5, O11 */ +figure { margin: 0; } + +/* ============================================================================= Forms ========================================================================== */ +/* Corrects margin displayed oddly in IE6/7 */ +form { margin: 0; } + +/* Define consistent border, margin, and padding */ +fieldset { border: 1px solid #c0c0c0; margin: 0 2px; padding: 0.35em 0.625em 0.75em; } + +/* 1. Corrects color not being inherited in IE6/7/8/9 2. Corrects text not wrapping in FF3 3. Corrects alignment displayed oddly in IE6/7 */ +legend { border: 0; /* 1 */ padding: 0; white-space: normal; /* 2 */ *margin-left: -7px; /* 3 */ } + +/* 1. Corrects font size not being inherited in all browsers 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome 3. Improves appearance and consistency in all browsers */ +button, input, select, textarea { font-size: 100%; /* 1 */ margin: 0; /* 2 */ vertical-align: baseline; /* 3 */ *vertical-align: middle; /* 3 */ } + +/* Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet */ +button, input { line-height: normal; /* 1 */ } + +/* 1. Improves usability and consistency of cursor style between image-type 'input' and others 2. Corrects inability to style clickable 'input' types in iOS 3. Removes inner spacing in IE7 without affecting normal text inputs Known issue: inner spacing remains in IE6 */ +button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; /* 1 */ -webkit-appearance: button; /* 2 */ *overflow: visible; /* 3 */ } + +/* Re-set default cursor for disabled elements */ +button[disabled], input[disabled] { cursor: default; } + +/* 1. Addresses box sizing set to content-box in IE8/9 2. Removes excess padding in IE8/9 3. Removes excess padding in IE7 Known issue: excess padding remains in IE6 */ +input[type="checkbox"], input[type="radio"] { box-sizing: border-box; /* 1 */ padding: 0; /* 2 */ *height: 13px; /* 3 */ *width: 13px; /* 3 */ } + +/* 1. Addresses appearance set to searchfield in S5, Chrome 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof) */ +input[type="search"] { -webkit-appearance: textfield; /* 1 */ -moz-box-sizing: content-box; -webkit-box-sizing: content-box; /* 2 */ box-sizing: content-box; } + +/* Removes inner padding and search cancel button in S5, Chrome on OS X */ +input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; } + +/* Removes inner padding and border in FF3+ www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/ */ +button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } + +/* 1. Removes default vertical scrollbar in IE6/7/8/9 2. Improves readability and alignment in all browsers */ +textarea { overflow: auto; /* 1 */ vertical-align: top; /* 2 */ } + +/* ============================================================================= Tables ========================================================================== */ +/* Remove most spacing between table cells */ +table { border-collapse: collapse; border-spacing: 0; } + +@font-face { font-family: 'OpenSansLight'; src: url("../fonts/OpenSans-Light-webfont.eot"); src: url("../fonts/OpenSans-Light-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Light-webfont.woff") format("woff"), url("../fonts/OpenSans-Light-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Light-webfont.svg#OpenSansLight") format("svg"); font-weight: normal; font-style: normal; } +@font-face { font-family: 'OpenSansLightItalic'; src: url("../fonts/OpenSans-LightItalic-webfont.eot"); src: url("../fonts/OpenSans-LightItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-LightItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-LightItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-LightItalic-webfont.svg#OpenSansLightItalic") format("svg"); font-weight: normal; font-style: normal; } +@font-face { font-family: 'OpenSansRegular'; src: url("../fonts/OpenSans-Regular-webfont.eot"); src: url("../fonts/OpenSans-Regular-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Regular-webfont.woff") format("woff"), url("../fonts/OpenSans-Regular-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Regular-webfont.svg#OpenSansRegular") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } +@font-face { font-family: 'OpenSansItalic'; src: url("../fonts/OpenSans-Italic-webfont.eot"); src: url("../fonts/OpenSans-Italic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Italic-webfont.woff") format("woff"), url("../fonts/OpenSans-Italic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Italic-webfont.svg#OpenSansItalic") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } +@font-face { font-family: 'OpenSansSemibold'; src: url("../fonts/OpenSans-Semibold-webfont.eot"); src: url("../fonts/OpenSans-Semibold-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Semibold-webfont.woff") format("woff"), url("../fonts/OpenSans-Semibold-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Semibold-webfont.svg#OpenSansSemibold") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } +@font-face { font-family: 'OpenSansSemiboldItalic'; src: url("../fonts/OpenSans-SemiboldItalic-webfont.eot"); src: url("../fonts/OpenSans-SemiboldItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-SemiboldItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-SemiboldItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-SemiboldItalic-webfont.svg#OpenSansSemiboldItalic") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } +@font-face { font-family: 'OpenSansBold'; src: url("../fonts/OpenSans-Bold-webfont.eot"); src: url("../fonts/OpenSans-Bold-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-Bold-webfont.woff") format("woff"), url("../fonts/OpenSans-Bold-webfont.ttf") format("truetype"), url("../fonts/OpenSans-Bold-webfont.svg#OpenSansBold") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } +@font-face { font-family: 'OpenSansBoldItalic'; src: url("../fonts/OpenSans-BoldItalic-webfont.eot"); src: url("../fonts/OpenSans-BoldItalic-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/OpenSans-BoldItalic-webfont.woff") format("woff"), url("../fonts/OpenSans-BoldItalic-webfont.ttf") format("truetype"), url("../fonts/OpenSans-BoldItalic-webfont.svg#OpenSansBoldItalic") format("svg"); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased; } +/* generated by rouge http://rouge.jneen.net/ original base16 by Chris Kempson (https://github.com/chriskempson/base16) +*/ +.highlight table td { padding: 5px; } + +.highlight table pre { margin: 0; } + +.highlight, .highlight .w { color: #d0d0d0; } + +.highlight .err { color: #151515; background-color: #ac4142; } + +.highlight .c, .highlight .cd, .highlight .cm, .highlight .c1, .highlight .cs { color: #888; } + +.highlight .cp { color: #f4bf75; } + +.highlight .nt { color: #f4bf75; } + +.highlight .o, .highlight .ow { color: #d0d0d0; } + +.highlight .p, .highlight .pi { color: #d0d0d0; } + +.highlight .gi { color: #90a959; } + +.highlight .gd { color: #ac4142; } + +.highlight .gh { color: #6a9fb5; font-weight: bold; } + +.highlight .k, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kv { color: #aa759f; } + +.highlight .kc { color: #d28445; } + +.highlight .kt { color: #d28445; } + +.highlight .kd { color: #d28445; } + +.highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .s1 { color: #90a959; } + +.highlight .sr { color: #75b5aa; } + +.highlight .si { color: #8f5536; } + +.highlight .se { color: #8f5536; } + +.highlight .nn { color: #f4bf75; } + +.highlight .nc { color: #f4bf75; } + +.highlight .no { color: #f4bf75; } + +.highlight .na { color: #6a9fb5; } + +.highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mb, .highlight .mx { color: #90a959; } + +.highlight .ss { color: #90a959; } + +body { padding: 0px 0 20px 0px; margin: 0px; font: 14px/1.5 "OpenSansRegular", "Helvetica Neue", Helvetica, Arial, sans-serif; color: #f0e7d5; font-weight: normal; background: #252525; background-attachment: fixed !important; background: linear_gradient(#2a2a29, #1c1c1c); } + +h1, h2, h3, h4, h5, h6 { color: #e8e8e8; margin: 0 0 10px; font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; } + +p, ul, ol, table, pre, dl { margin: 0 0 20px; } + +h1, h2, h3 { line-height: 1.1; } + +h1 { font-size: $h1-font-size; } + +h2 { font-size: $h2-font-size; } + +h4, h5, h6 { color: #e8e8e8; } + +h3 { font-size: $h3-font-size; line-height: 24px; font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif !important; font-weight: normal; color: #b6b6b6; } + +h4 { font-size: $h4-font-size; } +h5 { font-size: $h5-font-size; } +h6 { font-size: $h6-font-size; } + +a { color: #ffcc00; font-weight: 400; text-decoration: none; } +a:hover { color: #ffeb9b; } + +a small { font-size: 11px; color: #666; margin-top: -0.6em; display: block; } + +ul { list-style-image: url("../images/bullet.png"); } + +strong { font-family: 'OpenSansBold', "Helvetica Neue", Helvetica, Arial, sans-serif !important; font-weight: normal; } + +.wrapper { max-width: 650px; margin: 0 auto; position: relative; padding: 0 20px; } + +section img { max-width: 100%; } + +blockquote { border-left: 3px solid #ffcc00; margin: 0; padding: 0 0 0 20px; font-style: italic; } + +code { font-family: Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal, monospace; color: #efefef; font-size: 13px; margin: 0 4px; padding: 4px 6px; border-radius: 2px; } + +pre { padding: 8px 15px; background: #191919; border-radius: 2px; border: 1px solid #121212; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3); overflow: auto; overflow-y: hidden; } +pre code { color: #efefef; text-shadow: 0px 1px 0px #000; margin: 0; padding: 0; } + +table { width: 100%; border-collapse: collapse; } + +th { text-align: left; padding: 5px 10px; border-bottom: 1px solid #434343; color: #b6b6b6; font-family: 'OpenSansSemibold', "Helvetica Neue", Helvetica, Arial, sans-serif !important; font-weight: normal; } + +td { text-align: left; padding: 5px 10px; border-bottom: 1px solid #434343; } + +hr { border: 0; outline: none; height: 3px; background: transparent url("../images/hr.gif") center center repeat-x; margin: 0 0 20px; } + +dt { color: #F0E7D5; font-family: 'OpenSansSemibold', "Helvetica Neue", Helvetica, Arial, sans-serif !important; font-weight: normal; } + +#header { z-index: 100; left: 0; top: 0px; height: 60px; width: 100%; position: fixed; background: url(../images/nav-bg.gif) #353535; border-bottom: 4px solid #434343; box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.25); } +#header nav { max-width: 650px; margin: 0 auto; padding: 0 10px; background: blue; margin: 6px auto; } +#header nav li { font-family: 'OpenSansLight', "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; list-style: none; display: inline; color: white; line-height: 50px; text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.2); font-size: 14px; } +#header nav li a { color: white; border: 1px solid #5d910b; background: linear_gradient(#93bd20, #659e10); border-radius: 2px; box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.3), 0px 3px 7px rgba(0, 0, 0, 0.7); background-color: #93bd20; padding: 10px 12px; margin-top: 6px; line-height: 14px; font-size: 14px; display: inline-block; text-align: center; } +#header nav li a:hover { background: linear_gradient(#749619, #527f0e); background-color: #659e10; border: 1px solid #527f0e; box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 1px 0px rgba(0, 0, 0, 0); } +#header nav li.fork { float: left; margin-left: 0px; } +#header nav li.downloads { float: right; margin-left: 6px; } +#header nav li.title { float: right; margin-right: 10px; font-size: 11px; } + +section { max-width: 650px; padding: 30px 0px 50px 0px; margin: 20px 0; margin-top: 70px; } +section #title { border: 0; outline: none; margin: 0 0 50px 0; padding: 0 0 5px 0; } +section #title h1 { font-family: 'OpenSansLight', "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; font-size: 40px; text-align: center; line-height: 36px; } +section #title p { color: #d7cfbe; font-family: 'OpenSansLight', "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; font-size: 18px; text-align: center; } +section #title .credits { font-size: 11px; font-family: 'OpenSansRegular', "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; color: #696969; margin-top: -10px; } +section #title .credits.left { float: left; } +section #title .credits.right { float: right; } + +@media print, screen and (max-width: 720px) { #title .credits { display: block; width: 100%; line-height: 30px; text-align: center; } + #title .credits .left { float: none; display: block; } + #title .credits .right { float: none; display: block; } } +@media print, screen and (max-width: 480px) { #header { margin-top: -20px; } + section { margin-top: 40px; } + nav { display: none; } } diff --git a/docs/_sass/_variables.scss b/docs/_sass/_variables.scss new file mode 100644 index 000000000..84c5de09e --- /dev/null +++ b/docs/_sass/_variables.scss @@ -0,0 +1,7 @@ +$h1-font-size: 3em; +$h2-font-size: 2.75em; +$h3-font-size: 2.5em; +$h4-font-size: 2.25em; +$h5-font-size: 2em; +$h6-font-size: 1.75em; + From 62a0d21080f2dfb0130b8f7a4ee97171606f5aae Mon Sep 17 00:00:00 2001 From: eliasrodrigo Date: Tue, 19 Sep 2017 12:47:19 +0200 Subject: [PATCH 04/89] Correctly point the stylesheet path on the tag to the main.scss file. --- docs/_layouts/default.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index 1eb0b706b..90ea600f0 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -47,7 +47,7 @@ {{ page.title | default: Home }} - SpaceVim - + + ## Achievements ### issues -Achievements | Account ------ | ----- -[100th issue(issue)](https://github.com/SpaceVim/SpaceVim/issues/100) | [BenBergman](https://github.com/BenBergman) +| Achievements | Account | +| --------------------------------------------------------------------- | ------------------------------------------- | +| [100th issue(issue)](https://github.com/SpaceVim/SpaceVim/issues/100) | [BenBergman](https://github.com/BenBergman) | ### Stars, forks and watchers -Achievements | Account ------ | ----- -First stargazers | [monkeydterry](https://github.com/monkeydterry) -100th stargazers | [iwillalwaysbe](https://github.com/iwillalwaysbe) -1000th stargazers | [elvin-du](https://github.com/elvin-du) -2000th stargazers | [tobiasgoecke](https://github.com/tobiasgoecke) -3000th stargazers | [WellerQu](https://github.com/WellerQu) +| Achievements | Account | +| ----------------- | ------------------------------------------------- | +| First stargazers | [monkeydterry](https://github.com/monkeydterry) | +| 100th stargazers | [iwillalwaysbe](https://github.com/iwillalwaysbe) | +| 1000th stargazers | [elvin-du](https://github.com/elvin-du) | +| 2000th stargazers | [tobiasgoecke](https://github.com/tobiasgoecke) | +| 3000th stargazers | [WellerQu](https://github.com/WellerQu) | From a93d86ea2269908ad9c58492b7b49ae2f8d8905e Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Thu, 30 Nov 2017 00:34:48 +0800 Subject: [PATCH 07/89] Add mappings --- autoload/SpaceVim/layers/default.vim | 2 ++ autoload/SpaceVim/mapping/space.vim | 1 + 2 files changed, 3 insertions(+) diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim index 6925f7dc8..a6d854418 100644 --- a/autoload/SpaceVim/layers/default.vim +++ b/autoload/SpaceVim/layers/default.vim @@ -166,6 +166,8 @@ function! SpaceVim#layers#default#config() abort let g:_spacevim_mappings_space.f.v = {'name' : '+Vim(SpaceVim)'} call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'v'], 'let @+=g:spacevim_version | echo g:spacevim_version', 'display-and-copy-version', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'd'], 'SPConfig', 'open-custom-configuration', 1) + call SpaceVim#mapping#space#def('noremap', ['n', '-'], '', 'Decrease number under cursor', 0) + call SpaceVim#mapping#space#def('noremap', ['n', '+'], '', 'Increase number under cursor', 0) endfunction let s:file = SpaceVim#api#import('file') diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 743d55a98..840b2a9f7 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -17,6 +17,7 @@ function! SpaceVim#mapping#space#init() abort let g:_spacevim_mappings_space.w = {'name' : '+Windows'} let g:_spacevim_mappings_space.p = {'name' : '+Projects'} let g:_spacevim_mappings_space.h = {'name' : '+Help'} + let g:_spacevim_mappings_space.n = {'name' : '+Narrow/Numbers'} let g:_spacevim_mappings_space.q = {'name' : '+Quit'} let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'} let g:_spacevim_mappings_space.s = {'name' : '+Searching'} From 4be5048c024b9f4bed3155033f4a271409c18f1c Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Thu, 30 Nov 2017 00:49:36 +0800 Subject: [PATCH 08/89] Add number transient state --- autoload/SpaceVim/layers/default.vim | 768 ++++++++++++++------------- 1 file changed, 403 insertions(+), 365 deletions(-) diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim index a6d854418..4c9a65bb9 100644 --- a/autoload/SpaceVim/layers/default.vim +++ b/autoload/SpaceVim/layers/default.vim @@ -5,441 +5,479 @@ let s:filename = expand(':~') function! SpaceVim#layers#default#plugins() abort - let plugins = [] + let plugins = [] - return plugins + return plugins endfunction let s:lnum = expand('') + 3 function! SpaceVim#layers#default#config() abort - " Unimpaired bindings - " Quickly add empty lines - nnoremap [ :put! =repeat(nr2char(10), v:count1) - nnoremap ] :put =repeat(nr2char(10), v:count1) + " Unimpaired bindings + " Quickly add empty lines + nnoremap [ :put! =repeat(nr2char(10), v:count1) + nnoremap ] :put =repeat(nr2char(10), v:count1) - "]e or [e move current line ,count can be useed - nnoremap [e :execute 'move -1-'. v:count1 - nnoremap ]e :execute 'move +'. v:count1 + "]e or [e move current line ,count can be useed + nnoremap [e :execute 'move -1-'. v:count1 + nnoremap ]e :execute 'move +'. v:count1 - " [b or ]n go to previous or next buffer - nnoremap [b :bN - nnoremap ]b :bn + " [b or ]n go to previous or next buffer + nnoremap [b :bN + nnoremap ]b :bn - " [f or ]f go to next or previous file in dir - nnoremap ]f :call next_file() - nnoremap [f :call previous_file() + " [f or ]f go to next or previous file in dir + nnoremap ]f :call next_file() + nnoremap [f :call previous_file() - " [l or ]l go to next and previous error - nnoremap [l :lprevious - nnoremap ]l :lnext + " [l or ]l go to next and previous error + nnoremap [l :lprevious + nnoremap ]l :lnext - " [c or ]c go to next or previous vcs hunk + " [c or ]c go to next or previous vcs hunk - " [w or ]w go to next or previous window - nnoremap [w :call previous_window() - nnoremap ]w :call next_window() + " [w or ]w go to next or previous window + nnoremap [w :call previous_window() + nnoremap ]w :call next_window() - " [t or ]t for next and previous tab - nnoremap [t :tabprevious - nnoremap ]t :tabnext + " [t or ]t for next and previous tab + nnoremap [t :tabprevious + nnoremap ]t :tabnext - " [p or ]p for p and P - nnoremap [p P - nnoremap ]p p + " [p or ]p for p and P + nnoremap [p P + nnoremap ]p p - " Select last paste - nnoremap gp '`['.strpart(getregtype(), 0, 1).'`]' + " Select last paste + nnoremap gp '`['.strpart(getregtype(), 0, 1).'`]' - let lnum = expand('') + s:lnum - 1 - if has('python3') - let cmd = 'DeniteBufferDir file_rec' - elseif has('python') - let cmd = "exe 'LeaderfFile ' . fnamemodify(bufname('%'), ':h')" - else - let cmd = "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')" - endif - call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'], - \ cmd, - \ ['Find files in the directory of the current buffer', - \ [ - \ '[SPC f f] is to find files in the directory of the current buffer', - \ 'vim with +python3 support will use denite', - \ 'vim with +python support will use leaderf', - \ 'otherwise will use ctrlp', - \ '', - \ 'Definition: ' . s:filename . ':' . lnum, - \ ] - \ ] - \ , 1) - call SpaceVim#mapping#space#def('nnoremap', ['f', 's'], 'write', 'save buffer', 1) - call SpaceVim#mapping#space#def('nnoremap', ['f', 'S'], 'wall', 'save all buffer', 1) - call SpaceVim#mapping#space#def('nnoremap', ['f', 'W'], 'write !sudo tee % >/dev/null', 'save buffer with sudo', 1) - " help mappings - call SpaceVim#mapping#space#def('nnoremap', ['h', 'I'], 'call SpaceVim#issue#report()', 'Reporting an issue of SpaceVim', 1) - if has('python3') - call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'DeniteCursorWord help', 'get help with the symbol at point', 1) - else - call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'UniteWithCursorWord help', 'get help with the symbol at point', 1) - endif - call SpaceVim#mapping#space#def('nnoremap', ['h', 'l'], 'SPLayer -l', 'lists all the layers available in SpaceVim', 1) - call SpaceVim#mapping#space#def('nnoremap', ['h', 'm'], 'Unite manpage', 'search available man pages', 1) - call SpaceVim#mapping#space#def('nnoremap', ['h', 'k'], 'LeaderGuide "[KEYs]"', 'show top-level bindings with mapping guide', 1) - call SpaceVim#mapping#space#def('nnoremap', ['h', '[SPC]'], 'Unite help -input=SpaceVim', 'unite-SpaceVim-help', 1) - call SpaceVim#mapping#space#def('nnoremap', ['j', '0'], 'm`^', 'push mark and goto beginning of line', 0) - call SpaceVim#mapping#space#def('nnoremap', ['j', '$'], 'm`g_', 'push mark and goto end of line', 0) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'b'], '', 'jump backward', 0) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'f'], '', 'jump forward', 0) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'VimFiler -no-split', 'Explore current directory', 1) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'VimFiler', 'Explore current directory (other window)', 1) - call SpaceVim#mapping#space#def('nmap', ['j', 'j'], '(easymotion-prefix)s', 'jump to a character', 0) - call SpaceVim#mapping#space#def('nmap', ['j', 'J'], '(easymotion-s2)', 'jump to a suite of two characters', 0) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'k'], 'j==', 'go to next line and indent', 0) - call SpaceVim#mapping#space#def('nmap', ['j', 'l'], '(easymotion-bd-jk)', 'jump to a line', 0) - call SpaceVim#mapping#space#def('nmap', ['j', 'v'], '(easymotion-bd-jk)', 'jump to a line', 0) - call SpaceVim#mapping#space#def('nmap', ['j', 'w'], '(easymotion-bd-w)', 'jump to a word', 0) - call SpaceVim#mapping#space#def('nmap', ['j', 'q'], '(easymotion-bd-jk)', 'jump to a line', 0) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'n'], "i\\", 'sp-newline', 0) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'o'], "i\\k$", 'open-line', 0) - call SpaceVim#mapping#space#def('nnoremap', ['j', 's'], 'call call(' - \ . string(s:_function('s:split_string')) . ', [0])', - \ 'split sexp', 1) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'S'], 'call call(' - \ . string(s:_function('s:split_string')) . ', [1])', - \ 'split-and-add-newline', 1) - call SpaceVim#mapping#space#def('nnoremap', ['w', 'r'], 'call call(' - \ . string(s:_function('s:next_window')) . ', [])', - \ 'rotate windows forward', 1) - call SpaceVim#mapping#space#def('nnoremap', ['w', 'R'], 'call call(' - \ . string(s:_function('s:previous_window')) . ', [])', - \ 'rotate windows backward', 1) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'u'], 'call call(' - \ . string(s:_function('s:jump_to_url')) . ', [])', - \ 'jump to url', 1) - call SpaceVim#mapping#space#def('nnoremap', [''], 'try | b# | catch | endtry', 'last buffer', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', '.'], 'call call(' - \ . string(s:_function('s:buffer_transient_state')) . ', [])', - \ 'buffer transient state', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'd'], 'call SpaceVim#mapping#close_current_buffer()', 'kill-this-buffer', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'D'], - \ 'call SpaceVim#mapping#kill_visible_buffer_choosewin()', - \ 'kill-this-buffer', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', ''], 'call SpaceVim#mapping#clearBuffers()', 'kill-other-buffers', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'c'], 'call SpaceVim#mapping#clear_saved_buffers()', 'clear all saved buffers', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'e'], 'call call(' - \ . string(s:_function('s:safe_erase_buffer')) . ', [])', - \ 'safe-erase-buffer', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'h'], 'Startify', 'home', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'm'], 'call call(' - \ . string(s:_function('s:open_message_buffer')) . ', [])', - \ 'open-message-buffer', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'P'], 'normal! ggdG"+P', 'copy-clipboard-to-whole-buffer', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'R'], 'call call(' - \ . string(s:_function('s:safe_revert_buffer')) . ', [])', - \ 'safe-revert-buffer', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'Y'], 'normal! ggVG"+y``', 'copy-whole-buffer-to-clipboard', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'w'], 'setl readonly!', 'read-only-mode', 1) - let g:_spacevim_mappings_space.b.N = {'name' : '+New empty buffer'} - call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'h'], 'topleft vertical new', 'new-empty-buffer-left', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'j'], 'rightbelow new', 'new-empty-buffer-below', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'k'], 'new', 'new-empty-buffer-above', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'l'], 'rightbelow vertical new', 'new-empty-buffer-right', 1) - call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'n'], 'enew', 'new-empty-buffer', 1) + let lnum = expand('') + s:lnum - 1 + if has('python3') + let cmd = 'DeniteBufferDir file_rec' + elseif has('python') + let cmd = "exe 'LeaderfFile ' . fnamemodify(bufname('%'), ':h')" + else + let cmd = "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')" + endif + call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'], + \ cmd, + \ ['Find files in the directory of the current buffer', + \ [ + \ '[SPC f f] is to find files in the directory of the current buffer', + \ 'vim with +python3 support will use denite', + \ 'vim with +python support will use leaderf', + \ 'otherwise will use ctrlp', + \ '', + \ 'Definition: ' . s:filename . ':' . lnum, + \ ] + \ ] + \ , 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 's'], 'write', 'save buffer', 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 'S'], 'wall', 'save all buffer', 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 'W'], 'write !sudo tee % >/dev/null', 'save buffer with sudo', 1) + " help mappings + call SpaceVim#mapping#space#def('nnoremap', ['h', 'I'], 'call SpaceVim#issue#report()', 'Reporting an issue of SpaceVim', 1) + if has('python3') + call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'DeniteCursorWord help', 'get help with the symbol at point', 1) + else + call SpaceVim#mapping#space#def('nnoremap', ['h', 'i'], 'UniteWithCursorWord help', 'get help with the symbol at point', 1) + endif + call SpaceVim#mapping#space#def('nnoremap', ['h', 'l'], 'SPLayer -l', 'lists all the layers available in SpaceVim', 1) + call SpaceVim#mapping#space#def('nnoremap', ['h', 'm'], 'Unite manpage', 'search available man pages', 1) + call SpaceVim#mapping#space#def('nnoremap', ['h', 'k'], 'LeaderGuide "[KEYs]"', 'show top-level bindings with mapping guide', 1) + call SpaceVim#mapping#space#def('nnoremap', ['h', '[SPC]'], 'Unite help -input=SpaceVim', 'unite-SpaceVim-help', 1) + call SpaceVim#mapping#space#def('nnoremap', ['j', '0'], 'm`^', 'push mark and goto beginning of line', 0) + call SpaceVim#mapping#space#def('nnoremap', ['j', '$'], 'm`g_', 'push mark and goto end of line', 0) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'b'], '', 'jump backward', 0) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'f'], '', 'jump forward', 0) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'VimFiler -no-split', 'Explore current directory', 1) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'VimFiler', 'Explore current directory (other window)', 1) + call SpaceVim#mapping#space#def('nmap', ['j', 'j'], '(easymotion-prefix)s', 'jump to a character', 0) + call SpaceVim#mapping#space#def('nmap', ['j', 'J'], '(easymotion-s2)', 'jump to a suite of two characters', 0) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'k'], 'j==', 'go to next line and indent', 0) + call SpaceVim#mapping#space#def('nmap', ['j', 'l'], '(easymotion-bd-jk)', 'jump to a line', 0) + call SpaceVim#mapping#space#def('nmap', ['j', 'v'], '(easymotion-bd-jk)', 'jump to a line', 0) + call SpaceVim#mapping#space#def('nmap', ['j', 'w'], '(easymotion-bd-w)', 'jump to a word', 0) + call SpaceVim#mapping#space#def('nmap', ['j', 'q'], '(easymotion-bd-jk)', 'jump to a line', 0) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'n'], "i\\", 'sp-newline', 0) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'o'], "i\\k$", 'open-line', 0) + call SpaceVim#mapping#space#def('nnoremap', ['j', 's'], 'call call(' + \ . string(s:_function('s:split_string')) . ', [0])', + \ 'split sexp', 1) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'S'], 'call call(' + \ . string(s:_function('s:split_string')) . ', [1])', + \ 'split-and-add-newline', 1) + call SpaceVim#mapping#space#def('nnoremap', ['w', 'r'], 'call call(' + \ . string(s:_function('s:next_window')) . ', [])', + \ 'rotate windows forward', 1) + call SpaceVim#mapping#space#def('nnoremap', ['w', 'R'], 'call call(' + \ . string(s:_function('s:previous_window')) . ', [])', + \ 'rotate windows backward', 1) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'u'], 'call call(' + \ . string(s:_function('s:jump_to_url')) . ', [])', + \ 'jump to url', 1) + call SpaceVim#mapping#space#def('nnoremap', [''], 'try | b# | catch | endtry', 'last buffer', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', '.'], 'call call(' + \ . string(s:_function('s:buffer_transient_state')) . ', [])', + \ 'buffer transient state', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'd'], 'call SpaceVim#mapping#close_current_buffer()', 'kill-this-buffer', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'D'], + \ 'call SpaceVim#mapping#kill_visible_buffer_choosewin()', + \ 'kill-this-buffer', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', ''], 'call SpaceVim#mapping#clearBuffers()', 'kill-other-buffers', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'c'], 'call SpaceVim#mapping#clear_saved_buffers()', 'clear all saved buffers', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'e'], 'call call(' + \ . string(s:_function('s:safe_erase_buffer')) . ', [])', + \ 'safe-erase-buffer', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'h'], 'Startify', 'home', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'm'], 'call call(' + \ . string(s:_function('s:open_message_buffer')) . ', [])', + \ 'open-message-buffer', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'P'], 'normal! ggdG"+P', 'copy-clipboard-to-whole-buffer', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'R'], 'call call(' + \ . string(s:_function('s:safe_revert_buffer')) . ', [])', + \ 'safe-revert-buffer', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'Y'], 'normal! ggVG"+y``', 'copy-whole-buffer-to-clipboard', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'w'], 'setl readonly!', 'read-only-mode', 1) + let g:_spacevim_mappings_space.b.N = {'name' : '+New empty buffer'} + call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'h'], 'topleft vertical new', 'new-empty-buffer-left', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'j'], 'rightbelow new', 'new-empty-buffer-below', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'k'], 'new', 'new-empty-buffer-above', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'l'], 'rightbelow vertical new', 'new-empty-buffer-right', 1) + call SpaceVim#mapping#space#def('nnoremap', ['b', 'N', 'n'], 'enew', 'new-empty-buffer', 1) - " file mappings - call SpaceVim#mapping#space#def('nnoremap', ['f', 'b'], 'Unite vim_bookmarks', 'unite-filtered-bookmarks', 1) - let g:_spacevim_mappings_space.f.C = {'name' : '+Files/convert'} - call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'd'], 'update | e ++ff=dos | w', 'unix2dos', 1) - call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'u'], 'update | e ++ff=dos | setlocal ff=unix | w', 'dos2unix', 1) - call SpaceVim#mapping#space#def('nnoremap', ['f', 'D'], 'call call(' - \ . string(s:_function('s:delete_current_buffer_file')) . ', [])', - \ 'delete-current-buffer-file', 1) - call SpaceVim#mapping#space#def('nnoremap', ['f', 'F'], 'normal! gf', 'open-cursor-file', 1) - call SpaceVim#mapping#space#def('nnoremap', ['f', 'r'], 'Unite file_mru', 'open-recent-file', 1) - if g:spacevim_filemanager ==# 'vimfiler' - call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'VimFiler', 'toggle_file_tree', 1) - call SpaceVim#mapping#space#def('nnoremap', ['f', 'T'], 'VimFiler -no-toggle', 'show_file_tree', 1) - elseif g:spacevim_filemanager ==# 'nerdtree' - call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTreeToggle', 'toggle_file_tree', 1) - call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTree', 'toggle_file_tree', 1) - endif - call SpaceVim#mapping#space#def('nnoremap', ['f', 'y'], 'call zvim#util#CopyToClipboard()', 'show-and-copy-buffer-filename', 1) - let g:_spacevim_mappings_space.f.v = {'name' : '+Vim(SpaceVim)'} - call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'v'], 'let @+=g:spacevim_version | echo g:spacevim_version', 'display-and-copy-version', 1) - call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'd'], 'SPConfig', 'open-custom-configuration', 1) - call SpaceVim#mapping#space#def('noremap', ['n', '-'], '', 'Decrease number under cursor', 0) - call SpaceVim#mapping#space#def('noremap', ['n', '+'], '', 'Increase number under cursor', 0) + " file mappings + call SpaceVim#mapping#space#def('nnoremap', ['f', 'b'], 'Unite vim_bookmarks', 'unite-filtered-bookmarks', 1) + let g:_spacevim_mappings_space.f.C = {'name' : '+Files/convert'} + call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'd'], 'update | e ++ff=dos | w', 'unix2dos', 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 'C', 'u'], 'update | e ++ff=dos | setlocal ff=unix | w', 'dos2unix', 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 'D'], 'call call(' + \ . string(s:_function('s:delete_current_buffer_file')) . ', [])', + \ 'delete-current-buffer-file', 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 'F'], 'normal! gf', 'open-cursor-file', 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 'r'], 'Unite file_mru', 'open-recent-file', 1) + if g:spacevim_filemanager ==# 'vimfiler' + call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'VimFiler', 'toggle_file_tree', 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 'T'], 'VimFiler -no-toggle', 'show_file_tree', 1) + elseif g:spacevim_filemanager ==# 'nerdtree' + call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTreeToggle', 'toggle_file_tree', 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'NERDTree', 'toggle_file_tree', 1) + endif + call SpaceVim#mapping#space#def('nnoremap', ['f', 'y'], 'call zvim#util#CopyToClipboard()', 'show-and-copy-buffer-filename', 1) + let g:_spacevim_mappings_space.f.v = {'name' : '+Vim(SpaceVim)'} + call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'v'], 'let @+=g:spacevim_version | echo g:spacevim_version', 'display-and-copy-version', 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'd'], 'SPConfig', 'open-custom-configuration', 1) + call SpaceVim#mapping#space#def('nnoremap', ['n', '-'], 'call call(' + \ . string(s:_function('s:number_transient_state')) . ', ["-"])', + \ 'Decrease number under cursor', 0) + call SpaceVim#mapping#space#def('nnoremap', ['n', '+'], 'call call(' + \ . string(s:_function('s:number_transient_state')) . ', ["+"])', + \ 'Increase number under cursor', 0) +endfunction + +function! s:number_transient_state(n) abort + if a:n ==# '+' + exe "normal! \" + else + exe "normal! \" + endif + let state = SpaceVim#api#import('transient_state') + call state.set_title('Number Transient State') + call state.defind_keys( + \ { + \ 'layout' : 'vertical split', + \ 'left' : [ + \ { + \ 'key' : ['+','='], + \ 'desc' : 'increase number', + \ 'func' : '', + \ 'cmd' : "normal! \", + \ 'exit' : 0, + \ }, + \ ], + \ 'right' : [ + \ { + \ 'key' : '-', + \ 'desc' : 'decrease number', + \ 'func' : '', + \ 'cmd' : "normal! \", + \ 'exit' : 0, + \ }, + \ ], + \ } + \ ) + call state.open() endfunction let s:file = SpaceVim#api#import('file') let s:MESSAGE = SpaceVim#api#import('vim#message') function! s:next_file() abort - let dir = expand('%:p:h') - let f = expand('%:t') - let file = s:file.ls(dir, 1) - if index(file, f) == -1 - call add(file,f) - endif - call sort(file) - if len(file) != 1 - if index(file, f) == len(file) - 1 - exe 'e ' . dir . s:file.separator . file[0] - else - exe 'e ' . dir . s:file.separator . file[index(file, f) + 1] - endif + let dir = expand('%:p:h') + let f = expand('%:t') + let file = s:file.ls(dir, 1) + if index(file, f) == -1 + call add(file,f) + endif + call sort(file) + if len(file) != 1 + if index(file, f) == len(file) - 1 + exe 'e ' . dir . s:file.separator . file[0] + else + exe 'e ' . dir . s:file.separator . file[index(file, f) + 1] endif + endif endfunction function! s:previous_file() abort - let dir = expand('%:p:h') - let f = expand('%:t') - let file = s:file.ls(dir, 1) - if index(file, f) == -1 - call add(file,f) - endif - call sort(file) - if len(file) != 1 - if index(file, f) == 0 - exe 'e ' . dir . s:file.separator . file[-1] - else - exe 'e ' . dir . s:file.separator . file[index(file, f) - 1] - endif + let dir = expand('%:p:h') + let f = expand('%:t') + let file = s:file.ls(dir, 1) + if index(file, f) == -1 + call add(file,f) + endif + call sort(file) + if len(file) != 1 + if index(file, f) == 0 + exe 'e ' . dir . s:file.separator . file[-1] + else + exe 'e ' . dir . s:file.separator . file[index(file, f) - 1] endif + endif endfunction function! s:next_window() abort - try - exe (winnr() + 1 ) . 'wincmd w' - catch - exe 1 . 'wincmd w' - endtry + try + exe (winnr() + 1 ) . 'wincmd w' + catch + exe 1 . 'wincmd w' + endtry endfunction function! s:previous_window() abort - try - if winnr() == 1 - exe winnr('$') . 'wincmd w' - else - exe (winnr() - 1 ) . 'wincmd w' - endif - catch - exe winnr('$') . 'wincmd w' - endtry + try + if winnr() == 1 + exe winnr('$') . 'wincmd w' + else + exe (winnr() - 1 ) . 'wincmd w' + endif + catch + exe winnr('$') . 'wincmd w' + endtry endfunction function! s:split_string(newline) abort - let syn_name = synIDattr(synID(line("."), col("."), 1), "name") - if syn_name == &filetype . 'String' - let c = col('.') - let sep = '' - while c > 0 - if s:is_string(line('.'), c) - let c = c - 1 - else - let sep = getline('.')[c] - break - endif - endwhile - if a:newline - let save_register_m = @m - let @m = sep . "\n" . sep - normal! "mp - let @m = save_register_m - else - let save_register_m = @m - let @m = sep . sep - normal! "mp - let @m = save_register_m - endif + let syn_name = synIDattr(synID(line("."), col("."), 1), "name") + if syn_name == &filetype . 'String' + let c = col('.') + let sep = '' + while c > 0 + if s:is_string(line('.'), c) + let c = c - 1 + else + let sep = getline('.')[c] + break + endif + endwhile + if a:newline + let save_register_m = @m + let @m = sep . "\n" . sep + normal! "mp + let @m = save_register_m + else + let save_register_m = @m + let @m = sep . sep + normal! "mp + let @m = save_register_m endif + endif endfunction function! s:is_string(l,c) abort - return synIDattr(synID(a:l, a:c, 1), "name") == &filetype . 'String' + return synIDattr(synID(a:l, a:c, 1), "name") == &filetype . 'String' endfunction " function() wrapper if v:version > 703 || v:version == 703 && has('patch1170') - function! s:_function(fstr) abort - return function(a:fstr) - endfunction + function! s:_function(fstr) abort + return function(a:fstr) + endfunction else - function! s:_SID() abort - return matchstr(expand(''), '\zs\d\+\ze__SID$') - endfunction - let s:_s = '' . s:_SID() . '_' - function! s:_function(fstr) abort - return function(substitute(a:fstr, 's:', s:_s, 'g')) - endfunction + function! s:_SID() abort + return matchstr(expand(''), '\zs\d\+\ze__SID$') + endfunction + let s:_s = '' . s:_SID() . '_' + function! s:_function(fstr) abort + return function(substitute(a:fstr, 's:', s:_s, 'g')) + endfunction endif function! s:jump_to_url() abort - let g:EasyMotion_re_anywhere = 'http[s]*://' - call feedkeys("\(easymotion-jumptoanywhere)") + let g:EasyMotion_re_anywhere = 'http[s]*://' + call feedkeys("\(easymotion-jumptoanywhere)") endfunction function! s:safe_erase_buffer() abort - if s:MESSAGE.confirm('Erase content of buffer ' . expand('%:t')) - normal! ggdG - endif - redraw! + if s:MESSAGE.confirm('Erase content of buffer ' . expand('%:t')) + normal! ggdG + endif + redraw! endfunction function! s:open_message_buffer() abort - vertical topleft edit __Message_Buffer__ - setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonumber norelativenumber - setf message - normal! ggdG - silent put =execute(':message') - normal! G - setlocal nomodifiable - nnoremap q :silent bd + vertical topleft edit __Message_Buffer__ + setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonumber norelativenumber + setf message + normal! ggdG + silent put =execute(':message') + normal! G + setlocal nomodifiable + nnoremap q :silent bd endfunction function! s:safe_revert_buffer() abort - if s:MESSAGE.confirm('Revert buffer form ' . expand('%:p')) - edit! - endif - redraw! + if s:MESSAGE.confirm('Revert buffer form ' . expand('%:p')) + edit! + endif + redraw! endfunction function! s:delete_current_buffer_file() abort - if s:MESSAGE.confirm('Are you sure you want to delete this file') - let f = fnameescape(expand('%:p')) - call SpaceVim#mapping#close_current_buffer() - if delete(f) == 0 - echo "File '" . f . "' successfully removed" - endif + if s:MESSAGE.confirm('Are you sure you want to delete this file') + let f = fnameescape(expand('%:p')) + call SpaceVim#mapping#close_current_buffer() + if delete(f) == 0 + echo "File '" . f . "' successfully removed" endif - redraw! + endif + redraw! endfunction function! s:swap_buffer_with_nth_win(nr) abort - if a:nr <= winnr('$') && a:nr != winnr() - let cb = bufnr('%') - let tb = winbufnr(a:nr) - if cb != tb - exe a:nr . 'wincmd w' - exe 'b' . cb - wincmd p - exe 'b' . tb - endif + if a:nr <= winnr('$') && a:nr != winnr() + let cb = bufnr('%') + let tb = winbufnr(a:nr) + if cb != tb + exe a:nr . 'wincmd w' + exe 'b' . cb + wincmd p + exe 'b' . tb endif + endif endfunction function! s:move_buffer_to_nth_win(nr) abort - if a:nr <= winnr('$') && a:nr != winnr() - let cb = bufnr('%') - bp - exe a:nr . 'wincmd w' - exe 'b' . cb - wincmd p - endif + if a:nr <= winnr('$') && a:nr != winnr() + let cb = bufnr('%') + bp + exe a:nr . 'wincmd w' + exe 'b' . cb + wincmd p + endif endfunction function! s:buffer_transient_state() abort - let state = SpaceVim#api#import('transient_state') - call state.set_title('Buffer Selection Transient State') - call state.defind_keys( - \ { - \ 'layout' : 'vertical split', - \ 'left' : [ - \ { - \ 'key' : { - \ 'name' : 'C-1..C-9', - \ 'pos' : [[1,4], [6,9]], - \ 'handles' : [ - \ ["\" , ''], - \ ["\" , ''], - \ ["\" , ''], - \ ["\" , ''], - \ ["\" , ''], - \ ["\" , ''], - \ ["\" , ''], - \ ["\" , ''], - \ ["\" , ''], - \ ], - \ }, - \ 'desc' : 'goto nth window', - \ 'func' : '', - \ 'cmd' : '', - \ 'exit' : 0, - \ }, - \ { - \ 'key' : { - \ 'name' : '1..9', - \ 'pos' : [[1,2], [4,5]], - \ 'handles' : [ - \ ['1' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [1])'], - \ ['2' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [2])'], - \ ['3' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [3])'], - \ ['4' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [4])'], - \ ['5' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [5])'], - \ ['6' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [6])'], - \ ['7' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [7])'], - \ ['8' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [8])'], - \ ['9' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [9])'], - \ ], - \ }, - \ 'desc' : 'move buffer to nth window', - \ 'func' : '', - \ 'cmd' : '', - \ 'exit' : 0, - \ }, - \ { - \ 'key' : { - \ 'name' : 'M-1..M-9', - \ 'pos' : [[1,4], [6,9]], - \ 'handles' : [ - \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [1])'], - \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [2])'], - \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [3])'], - \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [4])'], - \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [5])'], - \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [6])'], - \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [7])'], - \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [8])'], - \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [9])'], - \ ], - \ }, - \ 'desc' : 'swap buffer with nth window', - \ 'func' : '', - \ 'cmd' : '', - \ 'exit' : 0, - \ }, - \ ], - \ 'right' : [ - \ { - \ 'key' : 'n', - \ 'desc' : 'next buffer', - \ 'func' : '', - \ 'cmd' : 'bnext', - \ 'exit' : 0, - \ }, - \ { - \ 'key' : ['N', 'p'], - \ 'desc' : 'previous buffer', - \ 'func' : '', - \ 'cmd' : 'bp', - \ 'exit' : 0, - \ }, - \ { - \ 'key' : 'd', - \ 'desc' : 'kill buffer', - \ 'func' : '', - \ 'cmd' : 'call SpaceVim#mapping#close_current_buffer()', - \ 'exit' : 0, - \ }, - \ { - \ 'key' : 'q', - \ 'desc' : 'quit', - \ 'func' : '', - \ 'cmd' : '', - \ 'exit' : 1, - \ }, - \ ], - \ } - \ ) - call state.open() + let state = SpaceVim#api#import('transient_state') + call state.set_title('Buffer Selection Transient State') + call state.defind_keys( + \ { + \ 'layout' : 'vertical split', + \ 'left' : [ + \ { + \ 'key' : { + \ 'name' : 'C-1..C-9', + \ 'pos' : [[1,4], [6,9]], + \ 'handles' : [ + \ ["\" , ''], + \ ["\" , ''], + \ ["\" , ''], + \ ["\" , ''], + \ ["\" , ''], + \ ["\" , ''], + \ ["\" , ''], + \ ["\" , ''], + \ ["\" , ''], + \ ], + \ }, + \ 'desc' : 'goto nth window', + \ 'func' : '', + \ 'cmd' : '', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : { + \ 'name' : '1..9', + \ 'pos' : [[1,2], [4,5]], + \ 'handles' : [ + \ ['1' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [1])'], + \ ['2' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [2])'], + \ ['3' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [3])'], + \ ['4' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [4])'], + \ ['5' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [5])'], + \ ['6' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [6])'], + \ ['7' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [7])'], + \ ['8' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [8])'], + \ ['9' , 'call call(' . string(s:_function('s:move_buffer_to_nth_win')) . ', [9])'], + \ ], + \ }, + \ 'desc' : 'move buffer to nth window', + \ 'func' : '', + \ 'cmd' : '', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : { + \ 'name' : 'M-1..M-9', + \ 'pos' : [[1,4], [6,9]], + \ 'handles' : [ + \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [1])'], + \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [2])'], + \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [3])'], + \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [4])'], + \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [5])'], + \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [6])'], + \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [7])'], + \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [8])'], + \ ["\" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [9])'], + \ ], + \ }, + \ 'desc' : 'swap buffer with nth window', + \ 'func' : '', + \ 'cmd' : '', + \ 'exit' : 0, + \ }, + \ ], + \ 'right' : [ + \ { + \ 'key' : 'n', + \ 'desc' : 'next buffer', + \ 'func' : '', + \ 'cmd' : 'bnext', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : ['N', 'p'], + \ 'desc' : 'previous buffer', + \ 'func' : '', + \ 'cmd' : 'bp', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'd', + \ 'desc' : 'kill buffer', + \ 'func' : '', + \ 'cmd' : 'call SpaceVim#mapping#close_current_buffer()', + \ 'exit' : 0, + \ }, + \ { + \ 'key' : 'q', + \ 'desc' : 'quit', + \ 'func' : '', + \ 'cmd' : '', + \ 'exit' : 1, + \ }, + \ ], + \ } + \ ) + call state.open() endfunction From 19864bbfb84803d10b8e12eec8871ef925ad8e17 Mon Sep 17 00:00:00 2001 From: Mayeul d'Avezac Date: Wed, 29 Nov 2017 16:55:19 +0000 Subject: [PATCH 09/89] Enable syntax error/warning counts in status line --- autoload/SpaceVim/layers/core/statusline.vim | 75 ++++++++++---------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index f0bd9fd17..754275e3e 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -184,9 +184,47 @@ function! s:battery_status() abort endif endfunction +if g:spacevim_enable_neomake + function! s:syntax_checking() + if !exists('g:loaded_neomake') + return '' + endif + let counts = neomake#statusline#LoclistCounts() + let warnings = get(counts, 'W', 0) + let errors = get(counts, 'E', 0) + let l = warnings ? ' %#SpaceVim_statusline_warn#●' . warnings . ' ' : '' + let l .= errors ? (warnings ? '' : ' ') . '%#SpaceVim_statusline_error#●' . errors . ' ' : '' + return l + endfunction +elseif g:spacevim_enable_ale + function! s:syntax_checking() + if !exists('g:ale_enabled') + return '' + endif + let counts = ale#statusline#Count(bufnr('')) + let warnings = counts.warning + counts.style_warning + let errors = counts.error + counts.style_error + let l = warnings ? ' %#SpaceVim_statusline_warn#●' . warnings . ' ' : '' + let l .= errors ? (warnings ? '' : ' ') . '%#SpaceVim_statusline_error#●' . errors . ' ' : '' + return l + endfunction +else + function! s:syntax_checking() + if !exists(':SyntasticCheck') + return '' + endif + let l = SyntasticStatuslineFlag() + if strlen(l) > 0 + return l + else + return '' + endif + endfunction +endif let s:registed_sections = { \ 'winnr' : function('s:winnr'), + \ 'syntax checking' : function('s:syntax_checking'), \ 'filename' : function('s:filename'), \ 'fileformat' : function('s:fileformat'), \ 'major mode' : function('s:major_mode'), @@ -236,43 +274,6 @@ function! s:search_status() abort return ' ' . (str2nr(tt) - str2nr(ct) + 1) . '/' . tt . ' ' endfunction -if g:spacevim_enable_neomake - function! s:syntax_checking() - if !exists('g:loaded_neomake') - return '' - endif - let counts = neomake#statusline#LoclistCounts() - let warnings = get(counts, 'W', 0) - let errors = get(counts, 'E', 0) - let l = warnings ? ' %#SpaceVim_statusline_warn#●' . warnings . ' ' : '' - let l .= errors ? (warnings ? '' : ' ') . '%#SpaceVim_statusline_error#●' . errors . ' ' : '' - return l - endfunction -elseif g:spacevim_enable_ale - function! s:syntax_checking() - if !exists('g:ale_enabled') - return '' - endif - let counts = ale#statusline#Count(bufnr('')) - let warnings = counts.warning + counts.style_warning - let errors = counts.error + counts.style_error - let l = warnings ? ' %#SpaceVim_statusline_warn#●' . warnings . ' ' : '' - let l .= errors ? (warnings ? '' : ' ') . '%#SpaceVim_statusline_error#●' . errors . ' ' : '' - return l - endfunction -else - function! s:syntax_checking() - if !exists(':SyntasticCheck') - return '' - endif - let l = SyntasticStatuslineFlag() - if strlen(l) > 0 - return l - else - return '' - endif - endfunction -endif function! s:filesize() abort From 0dd62d9ca2648919171a8c4ee0eb28a6d3baba81 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 00:36:43 +0800 Subject: [PATCH 10/89] Update community page --- docs/community.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/community.md b/docs/community.md index b7892d5b2..15158689a 100644 --- a/docs/community.md +++ b/docs/community.md @@ -1,23 +1,32 @@ --- title: "Community" +description: "A list for community channels for SpaceVim." --- # Community -Try these SpaceVim hangouts for any questions, problems or comments. +Visit these resources for help or general questions. ## Ask + - [issue tracker](https://github.com/SpaceVim/SpaceVim/issues) for issue and feature requests -- vi StackExchange for "how to" & configuration questions +- Try [vi.stackexchange.com](https://vi.stackexchange.com/) for **usage and configuration questions**. - [Twitter](https://twitter.com/SpaceVim) for hugs & pithy comments +- [Facebook](https://www.facebook.com/SpaceVim) ## Chat -- [![Gitter](https://badges.gitter.im/SpaceVim/SpaceVim.svg)](https://gitter.im/SpaceVim/SpaceVim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) (bridged to #spacevim IRC) + +All of these channels are bridged together. Click on one of the badges below to join the chat, In all of these channels, messages from `SpaceVimBot` is sent by remote user, and the format of the remote messages is: + + "[{PROTOCOL}] <{NICK}> {MESSAGE}" + +- [Gitter: SpaceVim/SpaceVim](https://gitter.im/SpaceVim/SpaceVim) - [`#spacevim` on FreeNode](https://webchat.freenode.net/?channels=spacevim) -- [![QQ](https://img.shields.io/badge/QQ群-121056965-blue.svg)](https://jq.qq.com/?_wv=1027&k=43DB6SG) -- [![Facebook](https://img.shields.io/badge/FaceBook-SpaceVim-blue.svg)](https://www.facebook.com/SpaceVim) -- [/r/spacevim on Reddit](https://reddit.com/r/spacevim) +- [t.me/SpaceVim](t.me/SpaceVim) +- [Matrix roon](https://riot.im/app/#/room/%23spacevim:matrix.org) +- [`#spacevim` on slack](https://spacevim.slack.com/messages/C88CTJ62J) ## Discuss - [google mailing list](https://groups.google.com/forum/#!forum/spacevim) +- [/r/spacevim on Reddit](https://reddit.com/r/spacevim) From 33040fcaffd56ac10867b873e6f80a8ab70a8284 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 07:20:07 +0800 Subject: [PATCH 11/89] Improve chat list --- docs/community.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/community.md b/docs/community.md index 15158689a..72f75132f 100644 --- a/docs/community.md +++ b/docs/community.md @@ -20,10 +20,10 @@ All of these channels are bridged together. Click on one of the badges below to "[{PROTOCOL}] <{NICK}> {MESSAGE}" -- [Gitter: SpaceVim/SpaceVim](https://gitter.im/SpaceVim/SpaceVim) +- [`SpaceVim/SpaceVim` on gitter](https://gitter.im/SpaceVim/SpaceVim) - [`#spacevim` on FreeNode](https://webchat.freenode.net/?channels=spacevim) -- [t.me/SpaceVim](t.me/SpaceVim) -- [Matrix roon](https://riot.im/app/#/room/%23spacevim:matrix.org) +- [`t.me/SpaceVim` on telegram](t.me/SpaceVim) +- [`#spacevim:matrix.org` on Matrix](https://riot.im/app/#/room/%23spacevim:matrix.org) - [`#spacevim` on slack](https://spacevim.slack.com/messages/C88CTJ62J) ## Discuss From d81c4409479d9fb50217a1f79d4f2e801bce6fd5 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 07:58:00 +0800 Subject: [PATCH 12/89] Fix statuslibe --- autoload/SpaceVim.vim | 2 +- autoload/SpaceVim/layers/checkers.vim | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 21a5d990c..5d2c303d1 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -195,7 +195,7 @@ let g:spacevim_statusline_inactive_separator = 'arrow' " \ 'version control info' " \ ] " < -let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'minor mode lighters', 'version control info'] +let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters', 'version control info'] "" " Define the right section of statusline in active windows. By default: " > diff --git a/autoload/SpaceVim/layers/checkers.vim b/autoload/SpaceVim/layers/checkers.vim index af74f7b6a..e388a0dcc 100644 --- a/autoload/SpaceVim/layers/checkers.vim +++ b/autoload/SpaceVim/layers/checkers.vim @@ -38,7 +38,9 @@ function! SpaceVim#layers#checkers#config() abort augroup SpaceVim_layer_checker autocmd! - if g:spacevim_enable_ale + if g:spacevim_enable_neomake + autocmd User NeomakeFinished nested let &l:statusline = SpaceVim#layers#core#statusline#get(1) + elseif g:spacevim_enable_ale autocmd User ALELint let &l:statusline = SpaceVim#layers#core#statusline#get(1) endif augroup END From e6c4ae5d021c772193883a58ae9dd92131fd6be9 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 10:58:30 +0800 Subject: [PATCH 13/89] Add hunks summary --- autoload/SpaceVim.vim | 2 +- autoload/SpaceVim/layers/core/statusline.vim | 22 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 5d2c303d1..dd045c3e8 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -195,7 +195,7 @@ let g:spacevim_statusline_inactive_separator = 'arrow' " \ 'version control info' " \ ] " < -let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters', 'version control info'] +let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters', 'version control info', 'hunks'] "" " Define the right section of statusline in active windows. By default: " > diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 754275e3e..bd8ff225e 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -222,6 +222,25 @@ else endfunction endif +function! s:hunks() abort + let hunks = [0,0,0] + try + let hunks = GitGutterGetHunkSummary() + catch + endtry + let rst = '' + if hunks[0] > 0 + let rst .= hunks[0] . '+ ' + endif + if hunks[1] > 0 + let rst .= hunks[1] . '~ ' + endif + if hunks[2] > 0 + let rst .= hunks[2] . '- ' + endif + return empty(rst) ? '' : ' ' . rst +endfunction + let s:registed_sections = { \ 'winnr' : function('s:winnr'), \ 'syntax checking' : function('s:syntax_checking'), @@ -230,6 +249,7 @@ let s:registed_sections = { \ 'major mode' : function('s:major_mode'), \ 'minor mode lighters' : function('s:modes'), \ 'version control info' : function('s:git_branch'), + \ 'hunks' : function('s:hunks'), \ 'cursorpos' : function('s:cursorpos'), \ 'percentage' : function('s:percentage'), \ 'time' : function('s:time'), @@ -474,6 +494,8 @@ function! SpaceVim#layers#core#statusline#config() abort \ 'toggle the cursor position', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'T'], 'if &laststatus == 2 | let &laststatus = 0 | else | let &laststatus = 2 | endif', \ 'toggle the statuline itself', 1) + call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'h'], 'call SpaceVim#layers#core#statusline#toggle_section("hunks")', + \ 'toggle the hunks summary', 1) function! TagbarStatusline(...) abort let name = (strwidth(a:3) > (g:spacevim_sidebar_width - 15)) ? a:3[:g:spacevim_sidebar_width - 20] . '..' : a:3 return s:STATUSLINE.build([s:winnr(),' Tagbar ', ' ' . name . ' '], [], s:lsep, s:rsep, '', From 77823ecd4fe8372af5ed4a533ffc85159e106b05 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 14:05:46 +0800 Subject: [PATCH 14/89] Add feature for copy/paste file --- config/plugins/vimfiler.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index 9bfdd8a21..4473c0e2e 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -1,4 +1,7 @@ scriptencoding utf-8 + +let s:VCOP = SpaceVim#api#import('vim#compatible') + let g:vimfiler_as_default_explorer = get(g:, 'vimfiler_as_default_explorer', 1) let g:vimfiler_restore_alternate_file = get(g:, 'vimfiler_restore_alternate_file', 1) let g:vimfiler_tree_indentation = get(g:, 'vimfiler_tree_indentation', 1) @@ -80,6 +83,7 @@ function! s:vimfilerinit() nnoremap sg vimfiler#do_action('vsplit') nnoremap sv vimfiler#do_action('split') nnoremap st vimfiler#do_action('tabswitch') + nnoremap yY :call copy_to_system_clipboard() nmap gx (vimfiler_execute_vimfiler_associated) nmap ' (vimfiler_toggle_mark_current_line) nmap v (vimfiler_quick_look) @@ -92,4 +96,20 @@ function! s:vimfilerinit() nmap (vimfiler_smart_l) endf +function! s:copy_to_system_clipboard() abort + let filename = vimfiler#get_marked_filenames(b:vimfiler) + + if empty(filename) + " Use cursor filename. + let filename = vimfiler#get_filename() + if filename == '..' || empty(vimfiler#get_file(b:vimfiler)) + let filename = b:vimfiler.current_dir + else + let filename = vimfiler#get_file(b:vimfiler).action__path + endif + endif + " we need xclip-copyfile + call s:VCOP.systemlist(['xclip-copyfile', filename]) +endfunction + " vim:set et sw=2: From 007d3fda9cd6991717146a6d236a0fe54468e3bf Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 14:13:33 +0800 Subject: [PATCH 15/89] Fix marked file yank --- config/plugins/vimfiler.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index 4473c0e2e..373a56a32 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -102,14 +102,16 @@ function! s:copy_to_system_clipboard() abort if empty(filename) " Use cursor filename. let filename = vimfiler#get_filename() - if filename == '..' || empty(vimfiler#get_file(b:vimfiler)) + if filename ==# '..' || empty(vimfiler#get_file(b:vimfiler)) let filename = b:vimfiler.current_dir else let filename = vimfiler#get_file(b:vimfiler).action__path endif + call s:VCOP.systemlist(['xclip-copyfile', filename]) + else + call s:VCOP.systemlist(['xclip-copyfile'] + filename) endif - " we need xclip-copyfile - call s:VCOP.systemlist(['xclip-copyfile', filename]) + echo 'Yanked:' . (type(filename) == 3 ? len(filename) : 1 ) . ' files' endfunction " vim:set et sw=2: From edba8c1eed9f968ec20aaee68d5874a1fa7fe414 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 14:46:42 +0800 Subject: [PATCH 16/89] Add key bindings for paste files --- config/plugins/vimfiler.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index 373a56a32..513b6c9f2 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -84,6 +84,7 @@ function! s:vimfilerinit() nnoremap sv vimfiler#do_action('split') nnoremap st vimfiler#do_action('tabswitch') nnoremap yY :call copy_to_system_clipboard() + nnoremap P :call paste_to_file_manager() nmap gx (vimfiler_execute_vimfiler_associated) nmap ' (vimfiler_toggle_mark_current_line) nmap v (vimfiler_quick_look) @@ -96,6 +97,21 @@ function! s:vimfilerinit() nmap (vimfiler_smart_l) endf +function! s:paste_to_file_manager() abort + let path = vimfiler#get_filename() + if !isdirectory(path) + let path = fnamemodify(path, ':p:h') + endif + let old_wd = getcwd() + if old_wd == path + call s:VCOP.systemlist(['xclip-pastefile']) + else + noautocmd exe 'cd' fnameescape(path) + call s:VCOP.systemlist(['xclip-pastefile']) + noautocmd exe 'cd' fnameescape(old_wd) + endif +endfunction + function! s:copy_to_system_clipboard() abort let filename = vimfiler#get_marked_filenames(b:vimfiler) From be6593be24383b487ed23f92f4471913cf50fbcd Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 16:17:32 +0800 Subject: [PATCH 17/89] Add support for nerdtree --- autoload/SpaceVim/layers/tools.vim | 16 ------- config/plugins/nerdtree.vim | 41 +++++++++++++++++ docs/documentation.md | 74 +++++++++++++++--------------- 3 files changed, 79 insertions(+), 52 deletions(-) create mode 100644 config/plugins/nerdtree.vim diff --git a/autoload/SpaceVim/layers/tools.vim b/autoload/SpaceVim/layers/tools.vim index 15da0ce3a..2bf3aef75 100644 --- a/autoload/SpaceVim/layers/tools.vim +++ b/autoload/SpaceVim/layers/tools.vim @@ -73,25 +73,9 @@ function! SpaceVim#layers#tools#config() abort endif map td TaskList noremap :TlistToggle - function! OpenOrCloseNERDTree() abort - exec 'normal! A' - endfunction if g:spacevim_filemanager ==# 'nerdtree' noremap :NERDTreeToggle endif - let g:NERDTreeWinPos=get(g:,'NERDTreeWinPos','right') - let g:NERDTreeWinSize=get(g:,'NERDTreeWinSize',31) - let g:NERDTreeChDirMode=get(g:,'NERDTreeChDirMode',1) - augroup nerdtree_zvim - autocmd! - autocmd bufenter * - \ if (winnr('$') == 1 && exists('b:NERDTree') - \ && b:NERDTree.isTabTree()) - \| q - \| endif - autocmd FileType nerdtree nnoremap - \ :call OpenOrCloseNERDTree() - augroup END endfunction " vim:set et sw=2 cc=80: diff --git a/config/plugins/nerdtree.vim b/config/plugins/nerdtree.vim new file mode 100644 index 000000000..7b31df73b --- /dev/null +++ b/config/plugins/nerdtree.vim @@ -0,0 +1,41 @@ +let s:VCOP = SpaceVim#api#import('vim#compatible') + +let g:NERDTreeWinPos=get(g:,'NERDTreeWinPos','right') +let g:NERDTreeWinSize=get(g:,'NERDTreeWinSize',31) +let g:NERDTreeChDirMode=get(g:,'NERDTreeChDirMode',1) +augroup nerdtree_zvim + autocmd! + autocmd bufenter * + \ if (winnr('$') == 1 && exists('b:NERDTree') + \ && b:NERDTree.isTabTree()) + \| q + \| endif + autocmd FileType nerdtree call s:nerdtreeinit() +augroup END + + +function! s:nerdtreeinit() abort + nnoremap yY :call copy_to_system_clipboard() + nnoremap P :call paste_to_file_manager() +endfunction + +function! s:paste_to_file_manager() abort + let path = g:NERDTreeFileNode.GetSelected().path.str() + if !isdirectory(path) + let path = fnamemodify(path, ':p:h') + endif + let old_wd = getcwd() + if old_wd == path + call s:VCOP.systemlist(['xclip-pastefile']) + else + noautocmd exe 'cd' fnameescape(path) + call s:VCOP.systemlist(['xclip-pastefile']) + noautocmd exe 'cd' fnameescape(old_wd) + endif +endfunction + +function! s:copy_to_system_clipboard() abort + let filename = g:NERDTreeFileNode.GetSelected().path.str() + call s:VCOP.systemlist(['xclip-copyfile', filename]) + echo 'Yanked:' . (type(filename) == 3 ? len(filename) : 1 ) . ( isdirectory(filename) ? 'directory' : 'file' ) +endfunction diff --git a/docs/documentation.md b/docs/documentation.md index efb8b863f..88cd59b14 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -881,27 +881,31 @@ VCS integration is supported, there will be a column status, this feature maybe Navigation is centered on the `hjkl` keys with the hope of providing a fast navigation experience like in [vifm](https://github.com/vifm): -| Key Binding | Description | -| ----------------------------- | ------------------------------------------------- | -| `` or `SPC f t` | Toggle file explorer | -| **Within _VimFiler_ buffers** | | -| `` or `h` | go to parent node and collapse expanded directory | -| `` or `j` | select next file or directory | -| `` or `k` | select previous file or directory | -| `` or `l` | open selected file or expand directory | -| `Ctrl`+`j` | Un-map | -| `Ctrl`+`l` | Un-map | -| `E` | Un-map | -| `.` | toggle visible ignored files | -| `sv` | Split edit | -| `sg` | Vertical split edit | -| `p` | Preview | -| `i` | Switch to directory history | -| `v` | Quick look | -| `gx` | Execute with vimfiler associated | -| `'` | Toggle mark current line | -| `V` | Clear all marks | -| `Ctrl`+`r` | Redraw | +| Key Binding | Description | +| ------------------------------ | ------------------------------------------------- | +| `` or `SPC f t` | Toggle file explorer | +| **Within _file tree_ buffers** | | +| `` or `h` | go to parent node and collapse expanded directory | +| `` or `j` | select next file or directory | +| `` or `k` | select previous file or directory | +| `` or `l` | open selected file or expand directory | +| `Ctrl`+`j` | Un-map | +| `Ctrl`+`l` | Un-map | +| `E` | Un-map | +| `N` | Create new file under corsor | +| `yy` | Copy file full path to system clipboard | +| `yY` | Copy file to system clipboard | +| `P` | Paste file to the position under the cursor | +| `.` | toggle visible ignored files | +| `sv` | Split edit | +| `sg` | Vertical split edit | +| `p` | Preview | +| `i` | Switch to directory history | +| `v` | Quick look | +| `gx` | Execute with vimfiler associated | +| `'` | Toggle mark current line | +| `V` | Clear all marks | +| `Ctrl`+`r` | Redraw | ##### Open file with file tree. @@ -1335,7 +1339,7 @@ Custom sign symbol: | ------ | ----------- | --------------------------- | | `✖` | Error | `g:spacevim_error_symbol` | | `➤` | warning | `g:spacevim_warning_symbol` | -| `🛈` | Info | `g:spacevim_info_symbol` | +| `🛈` | Info | `g:spacevim_info_symbol` | ### Managing projects @@ -1347,7 +1351,6 @@ project manager commands start with `p`: | ----------- | ----------------------------------------------------- | | `SPC p '` | open a shell in project’s root (with the shell layer) | - ## EditorConfig SpaceVim has support for [EditorConfig](http://editorconfig.org/), a configuration file to “define and maintain consistent coding styles between different editors and IDEs.” @@ -1362,32 +1365,31 @@ SpaceVim starts a server at launch. This server is killed whenever you close you If you are using neovim, you need to install [neovim-remote](https://github.com/mhinz/neovim-remote), then add this to your bashrc. -``` -export PATH=$PATH:$HOME/.SpaceVim/bin -``` + export PATH=$PATH:$HOME/.SpaceVim/bin Use `svc` to open a file in the existing Vim server, or using `nsvc` to open a file in the existing neovim server. ![server-and-client](https://user-images.githubusercontent.com/13142418/32554968-7164fe9c-c4d6-11e7-95f7-f6a6ea75e05b.gif) + ## Achievements ### issues -Achievements | Account ------ | ----- -[100th issue(issue)](https://github.com/SpaceVim/SpaceVim/issues/100) | [BenBergman](https://github.com/BenBergman) +| Achievements | Account | +| --------------------------------------------------------------------- | ------------------------------------------- | +| [100th issue(issue)](https://github.com/SpaceVim/SpaceVim/issues/100) | [BenBergman](https://github.com/BenBergman) | ### Stars, forks and watchers -Achievements | Account ------ | ----- -First stargazers | [monkeydterry](https://github.com/monkeydterry) -100th stargazers | [iwillalwaysbe](https://github.com/iwillalwaysbe) -1000th stargazers | [elvin-du](https://github.com/elvin-du) -2000th stargazers | [tobiasgoecke](https://github.com/tobiasgoecke) -3000th stargazers | [WellerQu](https://github.com/WellerQu) +| Achievements | Account | +| ----------------- | ------------------------------------------------- | +| First stargazers | [monkeydterry](https://github.com/monkeydterry) | +| 100th stargazers | [iwillalwaysbe](https://github.com/iwillalwaysbe) | +| 1000th stargazers | [elvin-du](https://github.com/elvin-du) | +| 2000th stargazers | [tobiasgoecke](https://github.com/tobiasgoecke) | +| 3000th stargazers | [WellerQu](https://github.com/WellerQu) | From 8c61e77277532f204426e49602547539fa1c46ab Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 19:37:03 +0800 Subject: [PATCH 18/89] Support old version of git close #1049 --- autoload/SpaceVim/plugins/manager.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index e4dc862aa..ad7159549 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -302,7 +302,7 @@ endfunction " @vimlint(EVL103, 0, a:event) function! s:lock_revision(repo) abort - let cmd = ['git', '-C', a:repo.path, 'checkout', a:repo.rev] + let cmd = ['git', '--git-dir', a:repo.path, 'checkout', a:repo.rev] call s:VIM_CO.system(cmd) endfunction @@ -356,7 +356,7 @@ endfunction function! s:pull(repo) abort let s:pct += 1 let s:ui_buf[a:repo.name] = s:pct - let argv = ['git', '-C', a:repo.path, 'pull', '--progress'] + let argv = ['git', '--git-dir', a:repo.path, 'pull', '--progress'] if s:JOB.vim_job || s:JOB.nvim_job let jobid = s:JOB.start(argv,{ \ 'on_stderr' : function('s:on_install_stdout'), From 84c745de712fc2861e922b25868901dd93d98a7f Mon Sep 17 00:00:00 2001 From: chenchong Date: Fri, 1 Dec 2017 19:41:50 +0800 Subject: [PATCH 19/89] bugfix start zsh error --- autoload/SpaceVim/layers/shell.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/shell.vim b/autoload/SpaceVim/layers/shell.vim index 8322c5a5e..23d657617 100644 --- a/autoload/SpaceVim/layers/shell.vim +++ b/autoload/SpaceVim/layers/shell.vim @@ -69,7 +69,7 @@ function! s:open_default_shell() abort if has('nvim') exe 'terminal' else - call term_start('bash', {'curwin' : 1, 'term_finish' : 'close'}) + call term_start($SHELL, {'curwin' : 1, 'term_finish' : 'close'}) endif let s:shell_win_nr = winnr() let w:shell_layer_win = 1 From 9310e52cdc27a2e4367f13dfaf70669e9a392dbe Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 19:45:17 +0800 Subject: [PATCH 20/89] Fix up --- autoload/SpaceVim/plugins/manager.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index ad7159549..cf312f871 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -302,7 +302,7 @@ endfunction " @vimlint(EVL103, 0, a:event) function! s:lock_revision(repo) abort - let cmd = ['git', '--git-dir', a:repo.path, 'checkout', a:repo.rev] + let cmd = ['git', '--git-dir', a:repo.path . '/.git', 'checkout', a:repo.rev] call s:VIM_CO.system(cmd) endfunction @@ -356,7 +356,7 @@ endfunction function! s:pull(repo) abort let s:pct += 1 let s:ui_buf[a:repo.name] = s:pct - let argv = ['git', '--git-dir', a:repo.path, 'pull', '--progress'] + let argv = ['git', '--git-dir', a:repo.path . '/.git', 'pull', '--progress'] if s:JOB.vim_job || s:JOB.nvim_job let jobid = s:JOB.start(argv,{ \ 'on_stderr' : function('s:on_install_stdout'), From 817cf5ebd8bfdc9002ea618420b1809bb03a9615 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 23:47:24 +0800 Subject: [PATCH 21/89] Update runner --- autoload/SpaceVim/plugins/runner.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/SpaceVim/plugins/runner.vim b/autoload/SpaceVim/plugins/runner.vim index d8ef137f9..c70c70d30 100644 --- a/autoload/SpaceVim/plugins/runner.vim +++ b/autoload/SpaceVim/plugins/runner.vim @@ -33,6 +33,8 @@ let s:target = '' function! s:async_run(runner) abort if type(a:runner) == type('') let cmd = printf(a:runner, bufname('%')) + call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 3, 0, ['[Running] ' . cmd, '', repeat('-', 20)]) + let s:lines += 3 let s:start_time = reltime() let s:job_id = s:JOB.start(cmd,{ \ 'on_stdout' : function('s:on_stdout'), @@ -105,6 +107,8 @@ function! s:on_exit(job_id, data, event) abort let s:end_time = reltime(s:start_time) let s:status.is_exit = 1 let s:status.exit_code = a:data + let done = ['', '[Done] exited with code=' . a:data . ' in ' . s:STRING.trim(reltimestr(s:end_time)) . ' seconds'] + call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, done) call s:update_statusline() endfunction From aa520a1c7d151bac6ae57f1f913e660a9f918b19 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 2 Dec 2017 00:38:54 +0800 Subject: [PATCH 22/89] Fix neovim support --- autoload/SpaceVim/plugins/runner.vim | 56 ++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/autoload/SpaceVim/plugins/runner.vim b/autoload/SpaceVim/plugins/runner.vim index c70c70d30..53bec2e89 100644 --- a/autoload/SpaceVim/plugins/runner.vim +++ b/autoload/SpaceVim/plugins/runner.vim @@ -10,6 +10,7 @@ let s:JOB = SpaceVim#api#import('job') let s:BUFFER = SpaceVim#api#import('vim#buffer') let s:STRING = SpaceVim#api#import('data#string') + let s:runners = {} let s:bufnr = 0 @@ -86,22 +87,53 @@ function! SpaceVim#plugins#runner#open() abort call s:update_statusline() endif endfunction - " @vimlint(EVL103, 1, a:job_id) " @vimlint(EVL103, 1, a:data) " @vimlint(EVL103, 1, a:event) -function! s:on_stdout(job_id, data, event) abort - call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data) - let s:lines += len(a:data) - call s:update_statusline() -endfunction -function! s:on_stderr(job_id, data, event) abort - let s:status.has_errors = 1 - call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data) - let s:lines += len(a:data) - call s:update_statusline() -endfunction +let g:wsd = [] +if has('nvim') && exists('*chanclose') + let s:_out_data = [''] + function! s:on_stdout(job_id, data, event) abort + let s:_out_data[-1] .= a:data[0] + call extend(s:_out_data, a:data[1:]) + if s:_out_data[-1] == '' + call remove(s:_out_data, -1) + let lines = s:_out_data + else + let lines = s:_out_data + endif + if !empty(lines) + call add(g:wsd, lines) + call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines) + endif + let s:lines += len(lines) + let s:_out_data = [''] + call s:update_statusline() + endfunction + + let s:_err_data = [''] + function! s:on_stderr(job_id, data, event) abort + let s:status.has_errors = 1 + call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data) + let s:lines += len(a:data) + call s:update_statusline() + endfunction +else + function! s:on_stdout(job_id, data, event) abort + call add(g:wsd, a:data) + call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data) + let s:lines += len(a:data) + call s:update_statusline() + endfunction + + function! s:on_stderr(job_id, data, event) abort + let s:status.has_errors = 1 + call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data) + let s:lines += len(a:data) + call s:update_statusline() + endfunction +endif function! s:on_exit(job_id, data, event) abort let s:end_time = reltime(s:start_time) From 37aeed6b40c4fd2f6a4cb18c37c43d7a543e254b Mon Sep 17 00:00:00 2001 From: Arith Xu Date: Sat, 2 Dec 2017 02:13:17 +0800 Subject: [PATCH 23/89] fix a syntax error of markdown table in documentation. --- docs/documentation.md | 284 +++++++++++++++++++++--------------------- 1 file changed, 142 insertions(+), 142 deletions(-) diff --git a/docs/documentation.md b/docs/documentation.md index 88cd59b14..321125e89 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -7,136 +7,136 @@ description: "General documentation about how to using SpaceVim, including the q -- [Core Pillars](#core-pillars) - - [Mnemonic](#mnemonic) - - [Discoverable](#discoverable) - - [Consistent](#consistent) - - [Crowd-Configured](#crowd-configured) -- [Highlighted features](#highlighted-features) -- [Screenshots](#screenshots) - - [welcome page](#welcome-page) - - [working flow](#working-flow) -- [Who can benefit from this?](#who-can-benefit-from-this) -- [Update and Rollback](#update-and-rollback) - - [Update SpaceVim itself](#update-spacevim-itself) - - [Automatic Updates](#automatic-updates) - - [Updating from the SpaceVim Buffer](#updating-from-the-spacevim-buffer) - - [Updating Manually with git](#updating-manually-with-git) - - [Update plugins](#update-plugins) - - [Get SpaceVim log](#get-spacevim-log) -- [Configuration layers](#configuration-layers) -- [Custom Configuration](#custom-configuration) - - [Automatic Generation](#automatic-generation) - - [Alternative directory](#alternative-directory) -- [Concepts](#concepts) - - [Transient-states](#transient-states) -- [Awesome ui](#awesome-ui) - - [Colorschemes](#colorschemes) - - [Font](#font) - - [UI Toggles](#ui-toggles) - - [Statusline && tabline](#statusline--tabline) - - [statusline](#statusline) - - [tabline](#tabline) -- [Manual](#manual) - - [Completion](#completion) - - [Unite/Denite](#unitedenite) - - [Mappings within unite/denite buffer](#mappings-within-unitedenite-buffer) - - [Discovering](#discovering) - - [Mappings](#mappings) - - [Mappings guide](#mappings-guide) - - [Unide/Denite describe key bindings](#unidedenite-describe-key-bindings) - - [Getting help](#getting-help) - - [Available layers](#available-layers) - - [Available plugins in SpaceVim](#available-plugins-in-spacevim) - - [New packages from ELPA repositories](#new-packages-from-elpa-repositories) - - [Toggles](#toggles) - - [Navigating](#navigating) - - [Point/Cursor](#pointcursor) - - [Vim motions with vim-easymotion](#vim-motions-with-vim-easymotion) - - [quick-jump-link mode (TODO)](#quick-jump-link-mode-todo) - - [Unimpaired bindings](#unimpaired-bindings) - - [Jumping, Joining and Splitting](#jumping-joining-and-splitting) - - [Jumping](#jumping) - - [Joining and splitting](#joining-and-splitting) - - [Window manipulation](#window-manipulation) - - [Window manipulation key bindings](#window-manipulation-key-bindings) - - [Buffers and Files](#buffers-and-files) - - [Buffers manipulation key bindings](#buffers-manipulation-key-bindings) - - [Create a new empty buffer](#create-a-new-empty-buffer) - - [Special Buffers](#special-buffers) - - [Files manipulations key bindings](#files-manipulations-key-bindings) - - [Vim and SpaceVim files](#vim-and-spacevim-files) - - [File tree](#file-tree) - - [File tree navigation](#file-tree-navigation) - - [Open file with file tree.](#open-file-with-file-tree) - - [Commands starting with `g`](#commands-starting-with-g) - - [Commands starting with `z`](#commands-starting-with-z) - - [Auto-saving](#auto-saving) - - [Searching](#searching) - - [With an external tool](#with-an-external-tool) - - [Useful key bindings](#useful-key-bindings) - - [Searching in current file](#searching-in-current-file) - - [Searching in all loaded buffers](#searching-in-all-loaded-buffers) - - [Searching in an arbitrary directory](#searching-in-an-arbitrary-directory) - - [Searching in a project](#searching-in-a-project) - - [Background searching in a project](#background-searching-in-a-project) - - [Searching the web](#searching-the-web) - - [Searching on the fly](#searching-on-the-fly) - - [Persistent highlighting](#persistent-highlighting) - - [Editing](#editing) - - [Paste text](#paste-text) - - [Auto-indent pasted text](#auto-indent-pasted-text) - - [Text manipulation commands](#text-manipulation-commands) - - [Text insertion commands](#text-insertion-commands) - - [Commenting](#commenting) - - [Multi-Encodings](#multi-encodings) - - [Errors handling](#errors-handling) - - [Managing projects](#managing-projects) -- [EditorConfig](#editorconfig) -- [Vim Server](#vim-server) - - [Connecting to the Vim server](#connecting-to-the-vim-server) -- [Achievements](#achievements) - - [issues](#issues) - - [Stars, forks and watchers](#stars-forks-and-watchers) -- [Features](#features) - - [Awesome ui](#awesome-ui-1) - - [Mnemonic key bindings](#mnemonic-key-bindings) -- [Language specific mode](#language-specific-mode) -- [Key Mapping](#key-mapping) - - [c/c++ support](#cc-support) - - [go support](#go-support) - - [python support](#python-support) -- [Neovim centric - Dark powered mode of SpaceVim.](#neovim-centric---dark-powered-mode-of-spacevim) -- [Modular configuration](#modular-configuration) -- [Multiple leader mode](#multiple-leader-mode) - - [Global origin vim leader](#global-origin-vim-leader) - - [Local origin vim leader](#local-origin-vim-leader) - - [Windows function leader](#windows-function-leader) - - [Unite work flow leader](#unite-work-flow-leader) -- [Unite centric work-flow](#unite-centric-work-flow) - - [Plugin Highlights](#plugin-highlights) - - [Non Lazy-Loaded Plugins](#non-lazy-loaded-plugins) - - [Lazy-Loaded Plugins](#lazy-loaded-plugins) - - [Language](#language) - - [Commands](#commands) - - [Commands](#commands-1) - - [Completion](#completion-1) - - [Unite](#unite) - - [Operators & Text Objects](#operators--text-objects) - - [Custom Key bindings](#custom-key-bindings) - - [File Operations](#file-operations) - - [Editor UI](#editor-ui) - - [Window Management](#window-management) - - [Native functions](#native-functions) - - [Plugin: Unite](#plugin-unite) - - [Plugin: neocomplete](#plugin-neocomplete) - - [Plugin: NERD Commenter](#plugin-nerd-commenter) - - [Plugin: Goyo and Limelight](#plugin-goyo-and-limelight) - - [Plugin: ChooseWin](#plugin-choosewin) - - [Plugin: Bookmarks](#plugin-bookmarks) - - [Plugin: Gina/Gita](#plugin-ginagita) - - [Plugin: vim-signify](#plugin-vim-signify) - - [Misc Plugins](#misc-plugins) +* [Core Pillars](#core-pillars) + * [Mnemonic](#mnemonic) + * [Discoverable](#discoverable) + * [Consistent](#consistent) + * [Crowd-Configured](#crowd-configured) +* [Highlighted features](#highlighted-features) +* [Screenshots](#screenshots) + * [welcome page](#welcome-page) + * [working flow](#working-flow) +* [Who can benefit from this?](#who-can-benefit-from-this) +* [Update and Rollback](#update-and-rollback) + * [Update SpaceVim itself](#update-spacevim-itself) + * [Automatic Updates](#automatic-updates) + * [Updating from the SpaceVim Buffer](#updating-from-the-spacevim-buffer) + * [Updating Manually with git](#updating-manually-with-git) + * [Update plugins](#update-plugins) + * [Get SpaceVim log](#get-spacevim-log) +* [Configuration layers](#configuration-layers) +* [Custom Configuration](#custom-configuration) + * [Automatic Generation](#automatic-generation) + * [Alternative directory](#alternative-directory) +* [Concepts](#concepts) + * [Transient-states](#transient-states) +* [Awesome ui](#awesome-ui) + * [Colorschemes](#colorschemes) + * [Font](#font) + * [UI Toggles](#ui-toggles) + * [Statusline && tabline](#statusline--tabline) + * [statusline](#statusline) + * [tabline](#tabline) +* [Manual](#manual) + * [Completion](#completion) + * [Unite/Denite](#unitedenite) + * [Mappings within unite/denite buffer](#mappings-within-unitedenite-buffer) + * [Discovering](#discovering) + * [Mappings](#mappings) + * [Mappings guide](#mappings-guide) + * [Unide/Denite describe key bindings](#unidedenite-describe-key-bindings) + * [Getting help](#getting-help) + * [Available layers](#available-layers) + * [Available plugins in SpaceVim](#available-plugins-in-spacevim) + * [New packages from ELPA repositories](#new-packages-from-elpa-repositories) + * [Toggles](#toggles) + * [Navigating](#navigating) + * [Point/Cursor](#pointcursor) + * [Vim motions with vim-easymotion](#vim-motions-with-vim-easymotion) + * [quick-jump-link mode (TODO)](#quick-jump-link-mode-todo) + * [Unimpaired bindings](#unimpaired-bindings) + * [Jumping, Joining and Splitting](#jumping-joining-and-splitting) + * [Jumping](#jumping) + * [Joining and splitting](#joining-and-splitting) + * [Window manipulation](#window-manipulation) + * [Window manipulation key bindings](#window-manipulation-key-bindings) + * [Buffers and Files](#buffers-and-files) + * [Buffers manipulation key bindings](#buffers-manipulation-key-bindings) + * [Create a new empty buffer](#create-a-new-empty-buffer) + * [Special Buffers](#special-buffers) + * [Files manipulations key bindings](#files-manipulations-key-bindings) + * [Vim and SpaceVim files](#vim-and-spacevim-files) + * [File tree](#file-tree) + * [File tree navigation](#file-tree-navigation) + * [Open file with file tree.](#open-file-with-file-tree) + * [Commands starting with `g`](#commands-starting-with-g) + * [Commands starting with `z`](#commands-starting-with-z) + * [Auto-saving](#auto-saving) + * [Searching](#searching) + * [With an external tool](#with-an-external-tool) + * [Useful key bindings](#useful-key-bindings) + * [Searching in current file](#searching-in-current-file) + * [Searching in all loaded buffers](#searching-in-all-loaded-buffers) + * [Searching in an arbitrary directory](#searching-in-an-arbitrary-directory) + * [Searching in a project](#searching-in-a-project) + * [Background searching in a project](#background-searching-in-a-project) + * [Searching the web](#searching-the-web) + * [Searching on the fly](#searching-on-the-fly) + * [Persistent highlighting](#persistent-highlighting) + * [Editing](#editing) + * [Paste text](#paste-text) + * [Auto-indent pasted text](#auto-indent-pasted-text) + * [Text manipulation commands](#text-manipulation-commands) + * [Text insertion commands](#text-insertion-commands) + * [Commenting](#commenting) + * [Multi-Encodings](#multi-encodings) + * [Errors handling](#errors-handling) + * [Managing projects](#managing-projects) +* [EditorConfig](#editorconfig) +* [Vim Server](#vim-server) + * [Connecting to the Vim server](#connecting-to-the-vim-server) +* [Achievements](#achievements) + * [issues](#issues) + * [Stars, forks and watchers](#stars-forks-and-watchers) +* [Features](#features) + * [Awesome ui](#awesome-ui-1) + * [Mnemonic key bindings](#mnemonic-key-bindings) +* [Language specific mode](#language-specific-mode) +* [Key Mapping](#key-mapping) + * [c/c++ support](#cc-support) + * [go support](#go-support) + * [python support](#python-support) +* [Neovim centric - Dark powered mode of SpaceVim.](#neovim-centric---dark-powered-mode-of-spacevim) +* [Modular configuration](#modular-configuration) +* [Multiple leader mode](#multiple-leader-mode) + * [Global origin vim leader](#global-origin-vim-leader) + * [Local origin vim leader](#local-origin-vim-leader) + * [Windows function leader](#windows-function-leader) + * [Unite work flow leader](#unite-work-flow-leader) +* [Unite centric work-flow](#unite-centric-work-flow) + * [Plugin Highlights](#plugin-highlights) + * [Non Lazy-Loaded Plugins](#non-lazy-loaded-plugins) + * [Lazy-Loaded Plugins](#lazy-loaded-plugins) + * [Language](#language) + * [Commands](#commands) + * [Commands](#commands-1) + * [Completion](#completion-1) + * [Unite](#unite) + * [Operators & Text Objects](#operators--text-objects) + * [Custom Key bindings](#custom-key-bindings) + * [File Operations](#file-operations) + * [Editor UI](#editor-ui) + * [Window Management](#window-management) + * [Native functions](#native-functions) + * [Plugin: Unite](#plugin-unite) + * [Plugin: neocomplete](#plugin-neocomplete) + * [Plugin: NERD Commenter](#plugin-nerd-commenter) + * [Plugin: Goyo and Limelight](#plugin-goyo-and-limelight) + * [Plugin: ChooseWin](#plugin-choosewin) + * [Plugin: Bookmarks](#plugin-bookmarks) + * [Plugin: Gina/Gita](#plugin-ginagita) + * [Plugin: vim-signify](#plugin-vim-signify) + * [Misc Plugins](#misc-plugins) @@ -1177,18 +1177,18 @@ Background search keyword in a project, when searching done, the count will be s key binding in FlyGrep buffer: -Key Binding Description -\-----------\| ----------- -`` | close FlyGrep buffer -`` | open file at the cursor line -`` | move cursor line down -`` | move cursor line up -`` | remove last character -`` | remove the Word before the cursor -`` | remove the Line before the cursor -`` | remove the Line after the cursor -``/`` | Go to the beginning of the line -``/`` | Go to the end of the line +| Key Binding | Description | +| ----------------- | --------------------------------- | +| `` | close FlyGrep buffer | +| `` | open file at the cursor line | +| `` | move cursor line down | +| `` | move cursor line up | +| `` | remove last character | +| `` | remove the Word before the cursor | +| `` | remove the Line before the cursor | +| `` | remove the Line after the cursor | +| ``/`` | Go to the beginning of the line | +| ``/`` | Go to the end of the line | #### Persistent highlighting From 02797ac3a5ba084b5e86ab673d6a47431f555f38 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 2 Dec 2017 19:36:56 +0800 Subject: [PATCH 24/89] Add mapping desc for SPC n - --- autoload/SpaceVim/layers/default.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim index 4c9a65bb9..c2090b631 100644 --- a/autoload/SpaceVim/layers/default.vim +++ b/autoload/SpaceVim/layers/default.vim @@ -166,9 +166,18 @@ function! SpaceVim#layers#default#config() abort let g:_spacevim_mappings_space.f.v = {'name' : '+Vim(SpaceVim)'} call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'v'], 'let @+=g:spacevim_version | echo g:spacevim_version', 'display-and-copy-version', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'd'], 'SPConfig', 'open-custom-configuration', 1) + let lnum = expand('') + s:lnum - 1 call SpaceVim#mapping#space#def('nnoremap', ['n', '-'], 'call call(' \ . string(s:_function('s:number_transient_state')) . ', ["-"])', - \ 'Decrease number under cursor', 0) + \ ['Decrease number under cursor', + \ [ + \ '[SPC n -] is to decrease the number under the cursor, and open', + \ 'the number translate state buffer', + \ '', + \ 'Definition: ' . s:filename . ':' . lnum, + \ ] + \ ] + \ , 0) call SpaceVim#mapping#space#def('nnoremap', ['n', '+'], 'call call(' \ . string(s:_function('s:number_transient_state')) . ', ["+"])', \ 'Increase number under cursor', 0) From 2437fd0b3a4be48b79bfa3e211fe7840ca2a2fef Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 2 Dec 2017 19:53:07 +0800 Subject: [PATCH 25/89] Add mapping desc for SPC n + --- autoload/SpaceVim/layers/default.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim index c2090b631..f987d90c4 100644 --- a/autoload/SpaceVim/layers/default.vim +++ b/autoload/SpaceVim/layers/default.vim @@ -178,9 +178,18 @@ function! SpaceVim#layers#default#config() abort \ ] \ ] \ , 0) + let lnum = expand('') + s:lnum - 1 call SpaceVim#mapping#space#def('nnoremap', ['n', '+'], 'call call(' \ . string(s:_function('s:number_transient_state')) . ', ["+"])', - \ 'Increase number under cursor', 0) + \ ['Increase number under cursor', + \ [ + \ '[SPC n +] is to increase the number under the cursor, and open', + \ 'the number translate state buffer', + \ '', + \ 'Definition: ' . s:filename . ':' . lnum, + \ ] + \ ] + \ , 0) endfunction function! s:number_transient_state(n) abort From 631a743bdafb9f61165e722f0e6a712c70d5a75c Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 2 Dec 2017 20:07:03 +0800 Subject: [PATCH 26/89] Fix mappings --- autoload/SpaceVim/layers/default.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/default.vim b/autoload/SpaceVim/layers/default.vim index f987d90c4..61b3cf4a4 100644 --- a/autoload/SpaceVim/layers/default.vim +++ b/autoload/SpaceVim/layers/default.vim @@ -177,7 +177,7 @@ function! SpaceVim#layers#default#config() abort \ 'Definition: ' . s:filename . ':' . lnum, \ ] \ ] - \ , 0) + \ , 1) let lnum = expand('') + s:lnum - 1 call SpaceVim#mapping#space#def('nnoremap', ['n', '+'], 'call call(' \ . string(s:_function('s:number_transient_state')) . ', ["+"])', @@ -189,7 +189,7 @@ function! SpaceVim#layers#default#config() abort \ 'Definition: ' . s:filename . ':' . lnum, \ ] \ ] - \ , 0) + \ , 1) endfunction function! s:number_transient_state(n) abort From cf24e88925b99b94a9cc0c998fa048323a0740e6 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 2 Dec 2017 23:23:58 +0800 Subject: [PATCH 27/89] Fix Duplicate meta descriptions --- docs/layers/autocomplete.md | 1 + docs/layers/checkers.md | 1 + docs/layers/colorscheme.md | 8 +++++++- docs/layers/git.md | 1 + docs/layers/lang/java.md | 18 ++++++++++-------- docs/layers/lang/php.md | 8 +++++--- docs/layers/lang/python.md | 6 ++++-- docs/layers/lang/typescript.md | 1 + docs/layers/shell.md | 14 ++++++++------ docs/sponsors.md | 19 ++++++++++--------- 10 files changed, 48 insertions(+), 29 deletions(-) diff --git a/docs/layers/autocomplete.md b/docs/layers/autocomplete.md index 1bb545b2a..f3f0be8b6 100644 --- a/docs/layers/autocomplete.md +++ b/docs/layers/autocomplete.md @@ -1,5 +1,6 @@ --- title: "SpaceVim autocomplete layer" +description: "This layer provides auto-completion to SpaceVim" --- # [SpaceVim Layers:](https://spacevim.org/layers) autocomplete diff --git a/docs/layers/checkers.md b/docs/layers/checkers.md index a72642cff..923b9c9ea 100644 --- a/docs/layers/checkers.md +++ b/docs/layers/checkers.md @@ -1,5 +1,6 @@ --- title: "SpaceVim checkers layer" +description: "This layer provides syntax checking feature" --- # [SpaceVim Layers:](https://spacevim.org/layers) checkers diff --git a/docs/layers/colorscheme.md b/docs/layers/colorscheme.md index 75b193b77..78cc297fb 100644 --- a/docs/layers/colorscheme.md +++ b/docs/layers/colorscheme.md @@ -1,8 +1,14 @@ -# [Layers](https://spacevim.org/layers) > colorscheme +--- +title: "SpaceVim colorscheme layer" +description: "This layers adds extensive support for git" +--- + +# [SpaceVim Layers:](https://spacevim.org/layers) colorscheme This layer provides many Vim colorschemes for SpaceVim, the default colorscheme is gruvbox. To change the colorscheme: + ```vim let g:spacevim_colorscheme = 'onedark' ``` diff --git a/docs/layers/git.md b/docs/layers/git.md index 06abb5061..ac6244196 100644 --- a/docs/layers/git.md +++ b/docs/layers/git.md @@ -1,5 +1,6 @@ --- title: "SpaceVim git layer" +description: "This layers adds extensive support for git" --- # [SpaceVim Layers:](https://spacevim.org/layers) git diff --git a/docs/layers/lang/java.md b/docs/layers/lang/java.md index 939dad2ea..98098e25a 100644 --- a/docs/layers/lang/java.md +++ b/docs/layers/lang/java.md @@ -1,18 +1,20 @@ --- title: "SpaceVim lang#java layer" +description: "This layer is for Java development" --- # [SpaceVim Layers:](https://spacevim.org/layers) lang#java -* [Description](#description) -* [Layer Installation](#layer-installation) -* [Key bindings](#key-bindings) - * [Java language specified key bindings](#java-language-specified-key-bindings) - * [Maven](#maven) - * [Jump](#jump) - * [Problems buffer](#problems-buffer) - * [Project buffer](#project-buffer) + +- [Description](#description) +- [Layer Installation](#layer-installation) +- [Key bindings](#key-bindings) + - [Java language specified key bindings](#java-language-specified-key-bindings) + - [Maven](#maven) + - [Jump](#jump) + - [Problems buffer](#problems-buffer) + - [Project buffer](#project-buffer) diff --git a/docs/layers/lang/php.md b/docs/layers/lang/php.md index 6a31233f6..58ddedbbb 100644 --- a/docs/layers/lang/php.md +++ b/docs/layers/lang/php.md @@ -1,13 +1,15 @@ --- title: "SpaceVim lang#php layer" +description: "This layer adds PHP language support to SpaceVim" --- # [SpaceVim Layers:](https://spacevim.org/layers) lang#php -* [Description](#description) -* [Layer Installation](#layer-installation) - * [Requirement](#requirement) + +- [Description](#description) +- [Layer Installation](#layer-installation) + - [Requirement](#requirement) diff --git a/docs/layers/lang/python.md b/docs/layers/lang/python.md index 8f209ad9a..737745eea 100644 --- a/docs/layers/lang/python.md +++ b/docs/layers/lang/python.md @@ -1,12 +1,14 @@ --- title: "SpaceVim lang#python layer" +description: "This layer is for Python development" --- # [SpaceVim Layers:](https://spacevim.org/layers) lang#python -* [Description](#description) -* [Features](#features) + +- [Description](#description) +- [Features](#features) diff --git a/docs/layers/lang/typescript.md b/docs/layers/lang/typescript.md index c5b11958e..4ef8c5080 100644 --- a/docs/layers/lang/typescript.md +++ b/docs/layers/lang/typescript.md @@ -1,5 +1,6 @@ --- title: "SpaceVim lang#typescript layer" +description: "This layer is for TypeScript development" --- # [SpaceVim Layers:](https://spacevim.org/layers) lang#typescript diff --git a/docs/layers/shell.md b/docs/layers/shell.md index 1e3ed3f04..501e8aee1 100644 --- a/docs/layers/shell.md +++ b/docs/layers/shell.md @@ -1,16 +1,18 @@ --- title: "SpaceVim shell layer" +description: "This layer provide shell support in SpaceVim" --- # [SpaceVim Layers:](https://spacevim.org/layers) shell -* [Description](#description) -* [Install](#install) -* [Configuration](#configuration) - * [Default shell](#default-shell) - * [Default shell position and height](#default-shell-position-and-height) -* [Key bindings](#key-bindings) + +- [Description](#description) +- [Install](#install) +- [Configuration](#configuration) + - [Default shell](#default-shell) + - [Default shell position and height](#default-shell-position-and-height) +- [Key bindings](#key-bindings) diff --git a/docs/sponsors.md b/docs/sponsors.md index d1198afc0..95b279fdf 100644 --- a/docs/sponsors.md +++ b/docs/sponsors.md @@ -1,5 +1,6 @@ --- title: "Sponsors" +description: "sponsors page for spacevim" --- ![Bountysource](https://spacevim.org/img/bountysource.png) @@ -8,20 +9,20 @@ If you want to support SpaceVim, please check out our [Bountysource campaign](ht Also, you can buy me a coffee: -Buy Me a Coffee at ko-fi.com +Buy Me a Coffee at ko-fi.com -if you are a chinese, It will be more easy in wechat. +| wechat | alipay | +| ------------------------------------------------------------------------ | -------------------------------------------------------------------------- | +| | | -![Buy me a coffee](https://spacevim.org/img/buy_me_a_coffee.png) +Bitcoin: 1DtuVeg81c2L9NEhDaVTAAbrCR3pN5xPFv # Current Sponsors These are the companies or individuals contributing a monthly amount to help sustain SpaceVim's development. See the [Bountysource campaign](https://www.bountysource.com/teams/spacevim) for more details. -Date | Description --------------- | ---------------------- -2017-2-23 | user from wechat contributed ¥40 to SpaceVim -2017-2-14 | user from wechat contributed ¥100 to SpaceVim - - +| Date | Description | +| --------- | --------------------------------------------- | +| 2017-2-23 | user from wechat contributed ¥40 to SpaceVim | +| 2017-2-14 | user from wechat contributed ¥100 to SpaceVim | From e170ace6e37f90972f1c8f2b6a747665f849355f Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 3 Dec 2017 14:13:56 +0800 Subject: [PATCH 28/89] Update statusline After updating a buffer's signs --- autoload/SpaceVim/layers/git.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/SpaceVim/layers/git.vim b/autoload/SpaceVim/layers/git.vim index 124f43a05..a1069b554 100644 --- a/autoload/SpaceVim/layers/git.vim +++ b/autoload/SpaceVim/layers/git.vim @@ -42,6 +42,7 @@ function! SpaceVim#layers#git#config() abort autocmd! autocmd FileType diff nnoremap q :bd! autocmd FileType gitcommit setl omnifunc=SpaceVim#plugins#gitcommit#complete + autocmd User GitGutter let &l:statusline = SpaceVim#layers#core#statusline#get(1) augroup END call SpaceVim#mapping#space#def('nnoremap', ['g', 'M'], 'call call(' \ . string(function('s:display_last_commit_of_current_line')) . ', [])', From 5d56018b130003ebcd1660690f8c3ebe9c737d0b Mon Sep 17 00:00:00 2001 From: tracyone Date: Sun, 3 Dec 2017 14:21:20 +0800 Subject: [PATCH 29/89] bashcomplete: can not trigger omnicomplete in some pos Solution:improve regex. --- autoload/SpaceVim/api/bash/complete.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/api/bash/complete.vim b/autoload/SpaceVim/api/bash/complete.vim index 816586861..a52f02137 100644 --- a/autoload/SpaceVim/api/bash/complete.vim +++ b/autoload/SpaceVim/api/bash/complete.vim @@ -7,7 +7,7 @@ let s:COP = SpaceVim#api#import('vim#compatible') " this is for vim command completion function! s:self.complete(ArgLead, CmdLine, CursorPos) abort - if a:CmdLine =~ '^[^ ]*$' + if a:CmdLine =~ '^\s\{0,\}\w\+$' return s:COP.systemlist('compgen -c ' . a:CmdLine) endif let result = s:COP.systemlist([s:completer, a:CmdLine]) @@ -18,7 +18,7 @@ endfunction " this is for vim input() function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort - if a:CmdLine =~ '^[^ ]*$' + if a:CmdLine =~ '^\s\{0,\}\w\+$' return s:COP.systemlist('compgen -c ' . a:CmdLine) endif let result = s:COP.systemlist([s:completer, a:CmdLine]) From 431ed7627a5467a5ac255da29d8b5ddf3a530397 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 1 Dec 2017 10:58:30 +0800 Subject: [PATCH 30/89] Add hunks summary --- autoload/SpaceVim.vim | 2 +- autoload/SpaceVim/layers/core/statusline.vim | 22 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 5d2c303d1..dd045c3e8 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -195,7 +195,7 @@ let g:spacevim_statusline_inactive_separator = 'arrow' " \ 'version control info' " \ ] " < -let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters', 'version control info'] +let g:spacevim_statusline_left_sections = ['winnr', 'filename', 'major mode', 'syntax checking', 'minor mode lighters', 'version control info', 'hunks'] "" " Define the right section of statusline in active windows. By default: " > diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 754275e3e..bd8ff225e 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -222,6 +222,25 @@ else endfunction endif +function! s:hunks() abort + let hunks = [0,0,0] + try + let hunks = GitGutterGetHunkSummary() + catch + endtry + let rst = '' + if hunks[0] > 0 + let rst .= hunks[0] . '+ ' + endif + if hunks[1] > 0 + let rst .= hunks[1] . '~ ' + endif + if hunks[2] > 0 + let rst .= hunks[2] . '- ' + endif + return empty(rst) ? '' : ' ' . rst +endfunction + let s:registed_sections = { \ 'winnr' : function('s:winnr'), \ 'syntax checking' : function('s:syntax_checking'), @@ -230,6 +249,7 @@ let s:registed_sections = { \ 'major mode' : function('s:major_mode'), \ 'minor mode lighters' : function('s:modes'), \ 'version control info' : function('s:git_branch'), + \ 'hunks' : function('s:hunks'), \ 'cursorpos' : function('s:cursorpos'), \ 'percentage' : function('s:percentage'), \ 'time' : function('s:time'), @@ -474,6 +494,8 @@ function! SpaceVim#layers#core#statusline#config() abort \ 'toggle the cursor position', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'T'], 'if &laststatus == 2 | let &laststatus = 0 | else | let &laststatus = 2 | endif', \ 'toggle the statuline itself', 1) + call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'h'], 'call SpaceVim#layers#core#statusline#toggle_section("hunks")', + \ 'toggle the hunks summary', 1) function! TagbarStatusline(...) abort let name = (strwidth(a:3) > (g:spacevim_sidebar_width - 15)) ? a:3[:g:spacevim_sidebar_width - 20] . '..' : a:3 return s:STATUSLINE.build([s:winnr(),' Tagbar ', ' ' . name . ' '], [], s:lsep, s:rsep, '', From a4f84234627dca480d720dd0d9ee1671d5b3e06c Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 3 Dec 2017 14:13:56 +0800 Subject: [PATCH 31/89] Update statusline After updating a buffer's signs --- autoload/SpaceVim/layers/git.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/SpaceVim/layers/git.vim b/autoload/SpaceVim/layers/git.vim index 124f43a05..a1069b554 100644 --- a/autoload/SpaceVim/layers/git.vim +++ b/autoload/SpaceVim/layers/git.vim @@ -42,6 +42,7 @@ function! SpaceVim#layers#git#config() abort autocmd! autocmd FileType diff nnoremap q :bd! autocmd FileType gitcommit setl omnifunc=SpaceVim#plugins#gitcommit#complete + autocmd User GitGutter let &l:statusline = SpaceVim#layers#core#statusline#get(1) augroup END call SpaceVim#mapping#space#def('nnoremap', ['g', 'M'], 'call call(' \ . string(function('s:display_last_commit_of_current_line')) . ', [])', From ea6d0e11dfaf5a45188577d9234dabb5f20cbaed Mon Sep 17 00:00:00 2001 From: tracyone Date: Sun, 3 Dec 2017 15:03:07 +0800 Subject: [PATCH 32/89] YCM: autotrigger bash complete --- config/plugins_before/YouCompleteMe.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/config/plugins_before/YouCompleteMe.vim b/config/plugins_before/YouCompleteMe.vim index fc2178c9a..0835ed177 100644 --- a/config/plugins_before/YouCompleteMe.vim +++ b/config/plugins_before/YouCompleteMe.vim @@ -19,4 +19,5 @@ let g:ycm_semantic_triggers = { \ 'ruby' : ['.', '::'], \ 'lua' : ['.', ':'], \ 'erlang' : [':'], + \ 'sh' : ['re!\w{2}', '/', '-'], \ } From 6cd5a4478a5c2cea76a55849783e529dab5735b2 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 3 Dec 2017 20:07:16 +0800 Subject: [PATCH 33/89] Update script --- .ci/after_success.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.ci/after_success.sh b/.ci/after_success.sh index e69de29bb..81a07a868 100755 --- a/.ci/after_success.sh +++ b/.ci/after_success.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then + if [ "$LINT" = "vimlint-errors" ] ; then + VIMLINT_LOG="" + git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim + docker run -it --rm \ + -v $PWD/.ci:/.ci \ + -v $PWD/build:/build \ + spacevim/vims neovim-stable -u .ci/common/github_commenter.vim + elif [ "$LINT" = "vint-errors" ] ; then + VIMLINT_LOG="" + git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim + docker run -it --rm \ + -v $PWD/.ci:/.ci \ + -v $PWD/build:/build \ + spacevim/vims neovim-stable -u .ci/common/github_commenter.vim + elif [ "$LINT" = "vader" ] ; then + echo "" + fi +fi From 43eba7895afecd1ba4cd7cbeece9e79366d64f0e Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 3 Dec 2017 20:37:11 +0800 Subject: [PATCH 34/89] Fix bot --- .ci/after_failure.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/after_failure.sh b/.ci/after_failure.sh index ca758e464..7d8fee20c 100755 --- a/.ci/after_failure.sh +++ b/.ci/after_failure.sh @@ -12,7 +12,7 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then docker run -it --rm \ -v $PWD/.ci:/.ci \ -v $PWD/build:/build \ - spacevim/vims neovim-stable -u .ci/common/github_commenter.vim + spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim rm build_log fi elif [ "$LINT" = "vint-errors" ] ; then @@ -26,7 +26,7 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then docker run -it --rm \ -v $PWD/.ci:/.ci \ -v $PWD/build:/build \ - spacevim/vims neovim-stable -u .ci/common/github_commenter.vim + spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim rm build_log fi elif [ "$LINT" = "vader" ] ; then From afd94396bea9d07af145631df5f6b7eb9a06107e Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 3 Dec 2017 20:47:05 +0800 Subject: [PATCH 35/89] Fixup --- .ci/after_success.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/after_success.sh b/.ci/after_success.sh index 81a07a868..f7d1ee7d8 100755 --- a/.ci/after_success.sh +++ b/.ci/after_success.sh @@ -7,14 +7,14 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then docker run -it --rm \ -v $PWD/.ci:/.ci \ -v $PWD/build:/build \ - spacevim/vims neovim-stable -u .ci/common/github_commenter.vim + spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim elif [ "$LINT" = "vint-errors" ] ; then VIMLINT_LOG="" git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim docker run -it --rm \ -v $PWD/.ci:/.ci \ -v $PWD/build:/build \ - spacevim/vims neovim-stable -u .ci/common/github_commenter.vim + spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim elif [ "$LINT" = "vader" ] ; then echo "" fi From 8880cf355b6c0a8888f8a22ae00afeae00153f3c Mon Sep 17 00:00:00 2001 From: tracyone Date: Sun, 3 Dec 2017 20:47:47 +0800 Subject: [PATCH 36/89] zsh:support autocomplete 1. autotrigger in YCM and deoplete. 2. press ^x^o in other case --- autoload/SpaceVim/layers/lang/sh.vim | 13 +++++++++---- config/plugins_before/YouCompleteMe.vim | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/sh.vim b/autoload/SpaceVim/layers/lang/sh.vim index db7bf155e..3fab71c25 100644 --- a/autoload/SpaceVim/layers/lang/sh.vim +++ b/autoload/SpaceVim/layers/lang/sh.vim @@ -1,7 +1,12 @@ -function! SpaceVim#layers#lang#javascript#plugins() abort - return [ - \ ['chrisbra/vim-zsh', { 'on_ft' : 'zsh' }] - \ ] +function! SpaceVim#layers#lang#sh#plugins() abort + let l:plugins = [] + call add(l:plugins, ['chrisbra/vim-zsh', { 'on_ft' : 'zsh' }]) + if get(g:, 'spacevim_enable_ycm') == 1 + call add(l:plugins, ['Valodim/vim-zsh-completion', { 'on_ft' : 'zsh' }]) + else + call add(l:plugins, ['zchee/deoplete-zsh', { 'on_ft' : 'zsh' }]) + endif + return l:plugins endfunction function! SpaceVim#layers#lang#sh#config() diff --git a/config/plugins_before/YouCompleteMe.vim b/config/plugins_before/YouCompleteMe.vim index 0835ed177..615861ddd 100644 --- a/config/plugins_before/YouCompleteMe.vim +++ b/config/plugins_before/YouCompleteMe.vim @@ -19,5 +19,6 @@ let g:ycm_semantic_triggers = { \ 'ruby' : ['.', '::'], \ 'lua' : ['.', ':'], \ 'erlang' : [':'], - \ 'sh' : ['re!\w{2}', '/', '-'], + \ 'sh' : ['re![\w-]{2}', '/', '-'], + \ 'zsh' : ['re![\w-]{2}', '/', '-'], \ } From 713df46b80beea8ae2f2378a48b06345fa2a7ef3 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 3 Dec 2017 22:18:42 +0800 Subject: [PATCH 37/89] Add replace for list api --- .ci/common/github_commenter.vim | 7 +++++-- autoload/SpaceVim/api/data/list.vim | 9 +++++++++ test/api/data/list.vader | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.ci/common/github_commenter.vim b/.ci/common/github_commenter.vim index 0885e967d..539131b9d 100644 --- a/.ci/common/github_commenter.vim +++ b/.ci/common/github_commenter.vim @@ -16,8 +16,11 @@ function! s:update_log(log, summary, new_log) abort let end = i endif endfor - return a:log . "\n" . a:new_log - + if begin != -1 && end != -1 + else + return a:log . "\n" . a:new_log + endif + endfunction if !empty(s:log) if $LINT == 'vader' diff --git a/autoload/SpaceVim/api/data/list.vim b/autoload/SpaceVim/api/data/list.vim index dfe247a40..888948978 100644 --- a/autoload/SpaceVim/api/data/list.vim +++ b/autoload/SpaceVim/api/data/list.vim @@ -10,6 +10,7 @@ function! SpaceVim#api#data#list#get() abort \ 'has' : '', \ 'has_index' : '', \ 'listpart' : '', + \ 'replace' : '', \ }, \ "function('s:' . v:key)" \ ) @@ -101,4 +102,12 @@ function! s:has_index(list, index) abort return 0 <= a:index && a:index < len(a:list) endfunction +function! s:replace(list, begin, end, re_list) + if a:begin <= a:end && a:begin >= 0 && a:end < len(a:list) + return a:list[:a:begin - 1] + a:re_list + a:list[a:end + 1:] + else + return a:list + endif +endf + " vim:set et sw=2 cc=80: diff --git a/test/api/data/list.vader b/test/api/data/list.vader index 219e0bc85..8b8cf19e1 100644 --- a/test/api/data/list.vader +++ b/test/api/data/list.vader @@ -11,3 +11,4 @@ Execute ( SpaceVim api: data#list ): AssertEqual list.char_range('a', 'c'), ['a', 'b', 'c'] AssertEqual list.has(['a', 'c'], 'a'), 1 AssertEqual list.has_index(['a', 'c'], 1), 1 + AssertEqual list.replace([1, 2, 3, 4, 5, 6, 7], 3, 5, [0, 0, 0, 0]), [1, 2, 3, 0, 0, 0, 0, 7] From 4ea9d1a0af7638ca1a1765b35c2383987a6a81e7 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 3 Dec 2017 22:34:37 +0800 Subject: [PATCH 38/89] Fix test --- .ci/after_failure.sh | 4 ++++ .ci/after_success.sh | 4 ++++ .ci/common/github_commenter.vim | 24 ++++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/.ci/after_failure.sh b/.ci/after_failure.sh index 7d8fee20c..19cc7786e 100755 --- a/.ci/after_failure.sh +++ b/.ci/after_failure.sh @@ -11,6 +11,8 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim docker run -it --rm \ -v $PWD/.ci:/.ci \ + -v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \ + -v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \ -v $PWD/build:/build \ spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim rm build_log @@ -25,6 +27,8 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim docker run -it --rm \ -v $PWD/.ci:/.ci \ + -v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \ + -v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \ -v $PWD/build:/build \ spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim rm build_log diff --git a/.ci/after_success.sh b/.ci/after_success.sh index f7d1ee7d8..91f5dfa2a 100755 --- a/.ci/after_success.sh +++ b/.ci/after_success.sh @@ -6,6 +6,8 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim docker run -it --rm \ -v $PWD/.ci:/.ci \ + -v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \ + -v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \ -v $PWD/build:/build \ spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim elif [ "$LINT" = "vint-errors" ] ; then @@ -13,6 +15,8 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim docker run -it --rm \ -v $PWD/.ci:/.ci \ + -v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \ + -v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \ -v $PWD/build:/build \ spacevim/vims neovim-stable -u /.ci/common/github_commenter.vim elif [ "$LINT" = "vader" ] ; then diff --git a/.ci/common/github_commenter.vim b/.ci/common/github_commenter.vim index 539131b9d..02d78b20c 100644 --- a/.ci/common/github_commenter.vim +++ b/.ci/common/github_commenter.vim @@ -1,8 +1,10 @@ exe 'set nocp' set rtp+=build/GitHub.vim +set rtp+=/API/ so build/GitHub.vim/plugin/github.vim so build/GitHub.vim/autoload/github/api/issues.vim so build/GitHub.vim/autoload/github/api/util.vim +let s:LIST = SpaceVim#api#import('data#list') let s:log = filereadable('build_log') ? system('cat build_log') : '' function! s:update_log(log, summary, new_log) abort let log = split(a:log, "\n") @@ -17,6 +19,7 @@ function! s:update_log(log, summary, new_log) abort endif endfor if begin != -1 && end != -1 + return s:LIST.replace(log, begin, end, split(a:new_log, "\n")) else return a:log . "\n" . a:new_log endif @@ -47,5 +50,26 @@ if !empty(s:log) \ {'body': s:update_log(s:comment.body, s:summary, s:log)}, 'SpaceVimBot', $BOTSECRET) endif endif +else + if $LINT == 'vader' + let s:summary = $VIM . ' ' . $LINT . ' build log' + else + let s:summary = $LINT . ' build log' + endif + let s:log = '
' . s:summary . "\n" . s:log . "\n
" + let s:comments = github#api#issues#List_comments('SpaceVim', 'SpaceVim',$TRAVIS_PULL_REQUEST ,'') + if !empty(s:comments) + let s:nr = 0 + for s:comment in s:comments + if s:comment.user.login ==# 'SpaceVimBot' + let s:nr = s:comment.id + break + endif + endfor + if s:nr != 0 + call github#api#issues#Edit_comment('SpaceVim','SpaceVim', s:nr, + \ {'body': s:update_log(s:comment.body, s:summary, s:log)}, 'SpaceVimBot', $BOTSECRET) + endif + endif endif quit From 4a4b5e8fb6487353cd9e53b5e04286eb264b6700 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 3 Dec 2017 23:21:00 +0800 Subject: [PATCH 39/89] Update lang#c layer --- autoload/SpaceVim/layers/lang/c.vim | 15 ++++++++++++++- docs/layers/lang/c.md | 26 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 docs/layers/lang/c.md diff --git a/autoload/SpaceVim/layers/lang/c.vim b/autoload/SpaceVim/layers/lang/c.vim index 652c891bb..d0103ac9c 100644 --- a/autoload/SpaceVim/layers/lang/c.vim +++ b/autoload/SpaceVim/layers/lang/c.vim @@ -40,10 +40,16 @@ +let s:use_libclang = 0 + function! SpaceVim#layers#lang#c#plugins() abort let plugins = [] if has('nvim') - call add(plugins, ['tweekmonster/deoplete-clang2']) + if s:use_libclang + call add(plugins, ['zchee/deoplete-clang']) + else + call add(plugins, ['tweekmonster/deoplete-clang2']) + endif else call add(plugins, ['Rip-Rip/clang_complete']) endif @@ -56,6 +62,13 @@ function! SpaceVim#layers#lang#c#config() abort call SpaceVim#mapping#space#regesit_lang_mappings('c', funcref('s:language_specified_mappings')) endfunction +function! SpaceVim#layers#lang#c#set_variable(var) abort + " use clang or libclang + let s:use_libclang = get(a:var, + \ 'use_libclang', + \ 'clang') +endfunction + function! s:language_specified_mappings() abort call SpaceVim#mapping#space#langSPC('nmap', ['l','r'], diff --git a/docs/layers/lang/c.md b/docs/layers/lang/c.md new file mode 100644 index 000000000..91a8ef9dd --- /dev/null +++ b/docs/layers/lang/c.md @@ -0,0 +1,26 @@ +--- +title: "SpaceVim lang#c layer" +description: "This layer is for c/c++/object-c development" +--- + +# [Layers](https://spacevim.org/layers) > lang#c + + + + +- [Description](#description) +- [Layer Installation](#layer-installation) +- [Key bindings](#key-bindings) + + + +## Description + +This layer is for c/c++/object-c development. + +## Layer Installation + +To use this configuration layer, add `SPLayer 'lang#java'` to your custom configuration file. + +## Key bindings + From e6c36a21466a01124fd2b6cbb288db0794271c5f Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 3 Dec 2017 23:42:37 +0800 Subject: [PATCH 40/89] Update doc --- docs/layers/lang/c.md | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/docs/layers/lang/c.md b/docs/layers/lang/c.md index 91a8ef9dd..c839c6211 100644 --- a/docs/layers/lang/c.md +++ b/docs/layers/lang/c.md @@ -10,7 +10,7 @@ description: "This layer is for c/c++/object-c development" - [Description](#description) - [Layer Installation](#layer-installation) -- [Key bindings](#key-bindings) +- [Configuration](#configuration) @@ -20,7 +20,39 @@ This layer is for c/c++/object-c development. ## Layer Installation -To use this configuration layer, add `SPLayer 'lang#java'` to your custom configuration file. +To use this configuration layer, add `SPLayer 'lang#c'` to your custom configuration file or load layer with custom options. -## Key bindings +```vim +call SpaceVim#layers#load('lang#c', + \ { + \ 'enable_libclang' : 1, + \ } + \ ) +``` +## Configuration + +- `clang_executable` (string) + +set the path to the clang executable + +- `enable_libclang` (boolean) + +use libclang instead of `clang -cc1`, by default it is 0. + +- `libclang_path` (string) + +The libclang shared object (dynamic library) file path. by default it is empty. + +- `clang_std` (dict) + +```json +{ + "c": "c11", + "cpp": "c++1z", + "objc": "c11", + "objcpp": "c++1z", +} +``` + +- `clang_flag` From 148649b669f8666807cdcfd4d2a570290e16c429 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 00:28:21 +0800 Subject: [PATCH 41/89] Update doc --- docs/layers/lang/c.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/layers/lang/c.md b/docs/layers/lang/c.md index c839c6211..97025cb40 100644 --- a/docs/layers/lang/c.md +++ b/docs/layers/lang/c.md @@ -56,3 +56,5 @@ The libclang shared object (dynamic library) file path. by default it is empty. ``` - `clang_flag` + +Create a `.clang` file at your project root. You should be able to just paste most of your compile flags in there. You can also use a list ['-Iwhatever', ...] when loadding this layer. From cb3e340ec7c12fb8fef47006ef7f69ae591883f0 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 00:32:46 +0800 Subject: [PATCH 42/89] Add config for completor and clang2 --- autoload/SpaceVim/layers/lang/c.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/autoload/SpaceVim/layers/lang/c.vim b/autoload/SpaceVim/layers/lang/c.vim index d0103ac9c..f37595254 100644 --- a/autoload/SpaceVim/layers/lang/c.vim +++ b/autoload/SpaceVim/layers/lang/c.vim @@ -67,6 +67,11 @@ function! SpaceVim#layers#lang#c#set_variable(var) abort let s:use_libclang = get(a:var, \ 'use_libclang', \ 'clang') + + if has_key(a:var, 'clang_executable') + let g:completor_clang_binary = a:var.clang_executable + let g:deoplete#sources#clang#executable = a:var.clang_executable + endif endfunction function! s:language_specified_mappings() abort From 19db671adbf95cf0b2e1bdf565c0bae130ab2124 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 07:54:03 +0800 Subject: [PATCH 43/89] Add highlight for modifid buffer --- autoload/SpaceVim/layers/core/tabline.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoload/SpaceVim/layers/core/tabline.vim b/autoload/SpaceVim/layers/core/tabline.vim index fa93cfffe..1548773d2 100644 --- a/autoload/SpaceVim/layers/core/tabline.vim +++ b/autoload/SpaceVim/layers/core/tabline.vim @@ -205,5 +205,7 @@ function! SpaceVim#layers#core#tabline#def_colors() abort endif exe 'hi! SpaceVim_tabline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] exe 'hi! SpaceVim_tabline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0] + " SpaceVim_tabline_c is for modified buffers + exe 'hi! SpaceVim_tabline_m ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] call s:HI.hi_separator('SpaceVim_tabline_a', 'SpaceVim_tabline_b') endfunction From fa88ae54976dcce047627040298b4ac71f9a3646 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 08:40:57 +0800 Subject: [PATCH 44/89] Add modified checker --- autoload/SpaceVim/layers/core/tabline.vim | 350 ++++++++++++---------- 1 file changed, 185 insertions(+), 165 deletions(-) diff --git a/autoload/SpaceVim/layers/core/tabline.vim b/autoload/SpaceVim/layers/core/tabline.vim index 1548773d2..8cb2d0da9 100644 --- a/autoload/SpaceVim/layers/core/tabline.vim +++ b/autoload/SpaceVim/layers/core/tabline.vim @@ -22,190 +22,210 @@ let s:buffers = s:BUFFER.listed_buffers() " init let s:separators = { - \ 'arrow' : ["\ue0b0", "\ue0b2"], - \ 'curve' : ["\ue0b4", "\ue0b6"], - \ 'slant' : ["\ue0b8", "\ue0ba"], - \ 'brace' : ["\ue0d2", "\ue0d4"], - \ 'fire' : ["\ue0c0", "\ue0c2"], - \ 'nil' : ['', ''], - \ } + \ 'arrow' : ["\ue0b0", "\ue0b2"], + \ 'curve' : ["\ue0b4", "\ue0b6"], + \ 'slant' : ["\ue0b8", "\ue0ba"], + \ 'brace' : ["\ue0d2", "\ue0d4"], + \ 'fire' : ["\ue0c0", "\ue0c2"], + \ 'nil' : ['', ''], + \ } let s:i_separators = { - \ 'arrow' : ["\ue0b1", "\ue0b3"], - \ 'bar' : ["|", "|"], - \ 'nil' : ['', ''], - \ } + \ 'arrow' : ["\ue0b1", "\ue0b3"], + \ 'bar' : ["|", "|"], + \ 'nil' : ['', ''], + \ } function! s:tabname(id) abort - if g:spacevim_buffer_index_type == 3 - let id = s:messletters.index_num(a:id) - elseif g:spacevim_buffer_index_type == 4 - let id = a:id - else - let id = s:messletters.bubble_num(a:id, g:spacevim_buffer_index_type) . ' ' - endif - let fn = fnamemodify(bufname(a:id), ':t') - if g:spacevim_enable_tabline_filetype_icon - let icon = s:file.fticon(fn) - if !empty(icon) - let fn = icon . ' ' . fn - endif - endif - if empty(fn) - return 'No Name' - else - return id . fn + if g:spacevim_buffer_index_type == 3 + let id = s:messletters.index_num(a:id) + elseif g:spacevim_buffer_index_type == 4 + let id = a:id + else + let id = s:messletters.bubble_num(a:id, g:spacevim_buffer_index_type) . ' ' + endif + let fn = fnamemodify(bufname(a:id), ':t') + if g:spacevim_enable_tabline_filetype_icon + let icon = s:file.fticon(fn) + if !empty(icon) + let fn = icon . ' ' . fn endif + endif + if empty(fn) + return 'No Name' + else + return id . fn + endif endfunction function! s:need_show_bfname(stack, nr) abort - let dupbufs = filter(a:stack, "fnamemodify(bufname(v:val), ':t') ==# fnamemodify(bufname(a:nr), ':t')") - if len(dupbufs) >= 2 - for i in dupbufs - call setbufvar(i, '_spacevim_statusline_showbfname', 1) - endfor - endif + let dupbufs = filter(a:stack, "fnamemodify(bufname(v:val), ':t') ==# fnamemodify(bufname(a:nr), ':t')") + if len(dupbufs) >= 2 + for i in dupbufs + call setbufvar(i, '_spacevim_statusline_showbfname', 1) + endfor + endif endfunction function! SpaceVim#layers#core#tabline#get() abort - let nr = tabpagenr('$') - let t = '' - " the stack should be the bufnr stack of tabline - let stack = [] - if nr > 1 - let ct = tabpagenr() - if ct == 1 - let t = '%#SpaceVim_tabline_a# ' - else - let t = '%#SpaceVim_tabline_b# ' - endif - for i in range(1, nr) - if i == ct - let t .= '%#SpaceVim_tabline_a#' - endif - let buflist = tabpagebuflist(i) - let winnr = tabpagewinnr(i) - let name = fnamemodify(bufname(buflist[winnr - 1]), ':t') - if empty(name) - let name = 'No Name' - endif - call add(stack, buflist[winnr - 1]) - call s:need_show_bfname(stack, buflist[winnr - 1]) - if g:spacevim_buffer_index_type == 3 - let id = s:messletters.index_num(i) - elseif g:spacevim_buffer_index_type == 4 - let id = i - else - let id = s:messletters.circled_num(i, g:spacevim_buffer_index_type) - endif - if g:spacevim_enable_tabline_filetype_icon - let icon = s:file.fticon(name) - if !empty(icon) - let name = icon . ' ' . name - endif - endif - let t .= id . ' ' . name - if i == ct - 1 - let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' ' - elseif i == ct - let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' ' - else - let t .= ' ' . s:ilsep . ' ' - endif - endfor - let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep - let t .= '%#SpaceVim_tabline_a# Tabs ' + let nr = tabpagenr('$') + let t = '' + " the stack should be the bufnr stack of tabline + let stack = [] + if nr > 1 + let ct = tabpagenr() + if ct == 1 + let t = '%#SpaceVim_tabline_a# ' else - let s:buffers = s:BUFFER.listed_buffers() - let g:_spacevim_list_buffers = s:buffers - if len(s:buffers) == 0 - return '' - endif - let ct = bufnr('%') - let pt = index(s:buffers, ct) > 0 ? s:buffers[index(s:buffers, ct) - 1] : -1 - if ct == get(s:buffers, 0, -1) - let t = '%#SpaceVim_tabline_a# ' - else - let t = '%#SpaceVim_tabline_b# ' - endif - for i in s:buffers - if i == ct - let t .= '%#SpaceVim_tabline_a#' - endif - let name = fnamemodify(bufname(i), ':t') - if empty(name) - let name = 'No Name' - endif - call add(stack, i) - call s:need_show_bfname(stack, i) - if g:spacevim_buffer_index_type == 3 - let id = s:messletters.index_num(index(s:buffers, i) + 1) - elseif g:spacevim_buffer_index_type == 4 - let id = index(s:buffers, i) + 1 - else - let id = s:messletters.circled_num(index(s:buffers, i) + 1, g:spacevim_buffer_index_type) - endif - if g:spacevim_enable_tabline_filetype_icon - let icon = s:file.fticon(name) - if !empty(icon) - let name = icon . ' ' . name - endif - endif - let t .= id . ' ' . name - if i == ct - let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' ' - elseif i == pt - let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' ' - else - let t .= ' ' . s:ilsep . ' ' - endif - endfor - let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep - let t .= '%#SpaceVim_tabline_a# Buffers ' + let t = '%#SpaceVim_tabline_b# ' endif - return t + for i in range(1, nr) + if i == ct + let t .= '%#SpaceVim_tabline_a#' + endif + let buflist = tabpagebuflist(i) + let winnr = tabpagewinnr(i) + let name = fnamemodify(bufname(buflist[winnr - 1]), ':t') + if empty(name) + let name = 'No Name' + endif + call add(stack, buflist[winnr - 1]) + call s:need_show_bfname(stack, buflist[winnr - 1]) + if g:spacevim_buffer_index_type == 3 + let id = s:messletters.index_num(i) + elseif g:spacevim_buffer_index_type == 4 + let id = i + else + let id = s:messletters.circled_num(i, g:spacevim_buffer_index_type) + endif + if g:spacevim_enable_tabline_filetype_icon + let icon = s:file.fticon(name) + if !empty(icon) + let name = icon . ' ' . name + endif + endif + let t .= id . ' ' . name + if i == ct - 1 + let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' ' + elseif i == ct + let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' ' + else + let t .= ' ' . s:ilsep . ' ' + endif + endfor + let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep + let t .= '%#SpaceVim_tabline_a# Tabs ' + else + let s:buffers = s:BUFFER.listed_buffers() + let g:_spacevim_list_buffers = s:buffers + if len(s:buffers) == 0 + return '' + endif + let ct = bufnr('%') + let pt = index(s:buffers, ct) > 0 ? s:buffers[index(s:buffers, ct) - 1] : -1 + let m_flag = 0 + if ct == get(s:buffers, 0, -1) + if getbufvar(ct, '&modified', 0) + let t = '%#SpaceVim_tabline_m# ' + let m_flag = 1 + else + let t = '%#SpaceVim_tabline_a# ' + endif + else + let t = '%#SpaceVim_tabline_b# ' + endif + for i in s:buffers + if getbufvar(i, '&modified', 0) + let t .= '%#SpaceVim_tabline_m#' + elseif i == ct + let t .= '%#SpaceVim_tabline_a#' + else + let t .= '%#SpaceVim_tabline_b#' + endif + let name = fnamemodify(bufname(i), ':t') + if empty(name) + let name = 'No Name' + endif + call add(stack, i) + call s:need_show_bfname(stack, i) + if g:spacevim_buffer_index_type == 3 + let id = s:messletters.index_num(index(s:buffers, i) + 1) + elseif g:spacevim_buffer_index_type == 4 + let id = index(s:buffers, i) + 1 + else + let id = s:messletters.circled_num(index(s:buffers, i) + 1, g:spacevim_buffer_index_type) + endif + if g:spacevim_enable_tabline_filetype_icon + let icon = s:file.fticon(name) + if !empty(icon) + let name = icon . ' ' . name + endif + endif + let t .= id . ' ' . name + if i == ct + if m_flag + let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_b#' . s:lsep . ' ' + else + let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_b#' . s:lsep . ' ' + endif + elseif i == pt + if getbufvar(ct, '&modified', 0) + let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_a#' . s:lsep . ' ' + else + let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' ' + endif + else + let t .= ' ' . s:ilsep . ' ' + endif + endfor + let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep + let t .= '%#SpaceVim_tabline_a# Buffers ' + endif + return t endfunction function! SpaceVim#layers#core#tabline#config() abort - let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s:separators['arrow']) - let [s:ilsep , s:irsep] = get(s:i_separators, g:spacevim_statusline_inactive_separator, s:separators['arrow']) - set tabline=%!SpaceVim#layers#core#tabline#get() - augroup SpaceVim_tabline - autocmd! - autocmd ColorScheme * call SpaceVim#layers#core#tabline#def_colors() - augroup END - for i in range(1, 9) - exe "call SpaceVim#mapping#def('nmap ', '" . i - \ . "', ':call SpaceVim#layers#core#tabline#jump(" - \ . i . ")', 'Switch to airline tab " . i - \ . "', '', 'tabline index " . i . "')" - endfor - call SpaceVim#mapping#def('nmap', '-', ':bprevious', 'Switch to previous airline tag', '', 'window previous') - call SpaceVim#mapping#def('nmap', '+', ':bnext', 'Switch to next airline tag', '', 'window next') - "call SpaceVim#mapping#space#def('nmap', ['-'], 'bprevious', 'window previous', 1) - "call SpaceVim#mapping#space#def('nmap', ['+'], 'bnext', 'window next', 1) + let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s:separators['arrow']) + let [s:ilsep , s:irsep] = get(s:i_separators, g:spacevim_statusline_inactive_separator, s:separators['arrow']) + set tabline=%!SpaceVim#layers#core#tabline#get() + augroup SpaceVim_tabline + autocmd! + autocmd ColorScheme * call SpaceVim#layers#core#tabline#def_colors() + augroup END + for i in range(1, 9) + exe "call SpaceVim#mapping#def('nmap ', '" . i + \ . "', ':call SpaceVim#layers#core#tabline#jump(" + \ . i . ")', 'Switch to airline tab " . i + \ . "', '', 'tabline index " . i . "')" + endfor + call SpaceVim#mapping#def('nmap', '-', ':bprevious', 'Switch to previous airline tag', '', 'window previous') + call SpaceVim#mapping#def('nmap', '+', ':bnext', 'Switch to next airline tag', '', 'window next') + "call SpaceVim#mapping#space#def('nmap', ['-'], 'bprevious', 'window previous', 1) + "call SpaceVim#mapping#space#def('nmap', ['+'], 'bnext', 'window next', 1) endfunction function! SpaceVim#layers#core#tabline#jump(id) abort - if len(s:buffers) >= a:id - let bid = s:buffers[a:id - 1] - exe 'silent b' . bid - endif + if len(s:buffers) >= a:id + let bid = s:buffers[a:id - 1] + exe 'silent b' . bid + endif endfunction function! SpaceVim#layers#core#tabline#def_colors() abort - if !empty(g:spacevim_custom_color_palette) - let t = g:spacevim_custom_color_palette - else - let name = get(g:, 'colors_name', 'gruvbox') - try - let t = SpaceVim#mapping#guide#theme#{name}#palette() - catch /^Vim\%((\a\+)\)\=:E117/ - let t = SpaceVim#mapping#guide#theme#gruvbox#palette() - endtry - endif - exe 'hi! SpaceVim_tabline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] - exe 'hi! SpaceVim_tabline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0] - " SpaceVim_tabline_c is for modified buffers - exe 'hi! SpaceVim_tabline_m ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] - call s:HI.hi_separator('SpaceVim_tabline_a', 'SpaceVim_tabline_b') + if !empty(g:spacevim_custom_color_palette) + let t = g:spacevim_custom_color_palette + else + let name = get(g:, 'colors_name', 'gruvbox') + try + let t = SpaceVim#mapping#guide#theme#{name}#palette() + catch /^Vim\%((\a\+)\)\=:E117/ + let t = SpaceVim#mapping#guide#theme#gruvbox#palette() + endtry + endif + exe 'hi! SpaceVim_tabline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] + exe 'hi! SpaceVim_tabline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0] + " SpaceVim_tabline_c is for modified buffers + exe 'hi! SpaceVim_tabline_m ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] + call s:HI.hi_separator('SpaceVim_tabline_a', 'SpaceVim_tabline_b') + call s:HI.hi_separator('SpaceVim_tabline_m', 'SpaceVim_tabline_b') + call s:HI.hi_separator('SpaceVim_tabline_m', 'SpaceVim_tabline_a') endfunction From e3f710158b7faf7ac578edd124fe4033229689c2 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 09:08:45 +0800 Subject: [PATCH 45/89] Use inactive highligt group --- autoload/SpaceVim/layers/core/tabline.vim | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/autoload/SpaceVim/layers/core/tabline.vim b/autoload/SpaceVim/layers/core/tabline.vim index 8cb2d0da9..8522755d5 100644 --- a/autoload/SpaceVim/layers/core/tabline.vim +++ b/autoload/SpaceVim/layers/core/tabline.vim @@ -67,6 +67,10 @@ function! s:need_show_bfname(stack, nr) abort endif endfunction +function! s:is_modified(nr) abort + return getbufvar(a:nr, '&modified', 0) +endfunction + function! SpaceVim#layers#core#tabline#get() abort let nr = tabpagenr('$') let t = '' @@ -135,10 +139,14 @@ function! SpaceVim#layers#core#tabline#get() abort let t = '%#SpaceVim_tabline_b# ' endif for i in s:buffers - if getbufvar(i, '&modified', 0) - let t .= '%#SpaceVim_tabline_m#' + if getbufvar(i, '&modified', 0) && i != ct + let t .= '%#SpaceVim_tabline_m_i#' elseif i == ct - let t .= '%#SpaceVim_tabline_a#' + if s:is_modified(i) + let t .= '%#SpaceVim_tabline_m#' + else + let t .= '%#SpaceVim_tabline_a#' + endif else let t .= '%#SpaceVim_tabline_b#' endif @@ -166,7 +174,7 @@ function! SpaceVim#layers#core#tabline#get() abort if m_flag let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_b#' . s:lsep . ' ' else - let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_b#' . s:lsep . ' ' + let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' ' endif elseif i == pt if getbufvar(ct, '&modified', 0) @@ -225,6 +233,7 @@ function! SpaceVim#layers#core#tabline#def_colors() abort exe 'hi! SpaceVim_tabline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0] " SpaceVim_tabline_c is for modified buffers exe 'hi! SpaceVim_tabline_m ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] + exe 'hi! SpaceVim_tabline_m_i ctermbg=' . t[1][2] . ' ctermfg=' . t[4][3] . ' guibg=' . t[1][1] . ' guifg=' . t[4][1] call s:HI.hi_separator('SpaceVim_tabline_a', 'SpaceVim_tabline_b') call s:HI.hi_separator('SpaceVim_tabline_m', 'SpaceVim_tabline_b') call s:HI.hi_separator('SpaceVim_tabline_m', 'SpaceVim_tabline_a') From 23e7f10560b9f4716242afe1efc358c52ffcb86a Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 09:23:58 +0800 Subject: [PATCH 46/89] Fix up --- autoload/SpaceVim/layers/core/tabline.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/core/tabline.vim b/autoload/SpaceVim/layers/core/tabline.vim index 8522755d5..e0a4f1119 100644 --- a/autoload/SpaceVim/layers/core/tabline.vim +++ b/autoload/SpaceVim/layers/core/tabline.vim @@ -178,7 +178,7 @@ function! SpaceVim#layers#core#tabline#get() abort endif elseif i == pt if getbufvar(ct, '&modified', 0) - let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_a#' . s:lsep . ' ' + let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_m#' . s:lsep . ' ' else let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' ' endif From ca05f862e37d624ad368d51b9d8d6d587ffca164 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 09:31:11 +0800 Subject: [PATCH 47/89] Fix tabline --- autoload/SpaceVim/layers/core/tabline.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/core/tabline.vim b/autoload/SpaceVim/layers/core/tabline.vim index e0a4f1119..29ea10b9b 100644 --- a/autoload/SpaceVim/layers/core/tabline.vim +++ b/autoload/SpaceVim/layers/core/tabline.vim @@ -171,7 +171,7 @@ function! SpaceVim#layers#core#tabline#get() abort endif let t .= id . ' ' . name if i == ct - if m_flag + if s:is_modified(i) let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_b#' . s:lsep . ' ' else let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:lsep . ' ' @@ -183,7 +183,7 @@ function! SpaceVim#layers#core#tabline#get() abort let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a#' . s:lsep . ' ' endif else - let t .= ' ' . s:ilsep . ' ' + let t .= ' %#SpaceVim_tabline_b#' . s:ilsep . ' ' endif endfor let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep From ff9837c0734c38e0b77d33ee1a7be6e522ead44f Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 10:30:47 +0800 Subject: [PATCH 48/89] Add runner syntax file --- syntax/SpaceVimRunner.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 syntax/SpaceVimRunner.vim diff --git a/syntax/SpaceVimRunner.vim b/syntax/SpaceVimRunner.vim new file mode 100644 index 000000000..e073e71ee --- /dev/null +++ b/syntax/SpaceVimRunner.vim @@ -0,0 +1,14 @@ +if exists("b:current_syntax") + finish +endif +let b:current_syntax = "SpaceVimRunner" +syntax case ignore +syn match RunnerCmd /\(\[Running\]\ \)\@<=.*/ +syn match KeyBindings /\[Running\]/ +syn match DoneSucceeded /\[Done]\(\ exited\ with\ code=0\)\@=/ +syn match DoneFailed /\[Done]\(\ exited\ with\ code=[^0]\)\@=/ + +hi def link RunnerCmd Comment +hi def link KeyBindings String +hi def link DoneSucceeded String +hi def link DoneFailed WarningMsg From 9128f24fd2e3a427227f5945f07e59f385ec6f17 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 11:15:46 +0800 Subject: [PATCH 49/89] Update syntax file --- autoload/SpaceVim/plugins/runner.vim | 6 ++++++ syntax/SpaceVimRunner.vim | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/plugins/runner.vim b/autoload/SpaceVim/plugins/runner.vim index 53bec2e89..8dcaef35a 100644 --- a/autoload/SpaceVim/plugins/runner.vim +++ b/autoload/SpaceVim/plugins/runner.vim @@ -45,6 +45,12 @@ function! s:async_run(runner) abort elseif type(a:runner) == type([]) let s:target = tempname() let compile_cmd = substitute(printf(a:runner[0], bufname('%')), '#TEMP#', s:target, 'g') + call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 3, 0, [ + \ '[Compile] ' . compile_cmd, + \ '[Running] ' . s:target, + \ '', + \ repeat('-', 20)]) + let s:lines += 4 let s:start_time = reltime() let s:job_id = s:JOB.start(compile_cmd,{ \ 'on_stdout' : function('s:on_stdout'), diff --git a/syntax/SpaceVimRunner.vim b/syntax/SpaceVimRunner.vim index e073e71ee..ece6832f0 100644 --- a/syntax/SpaceVimRunner.vim +++ b/syntax/SpaceVimRunner.vim @@ -3,8 +3,10 @@ if exists("b:current_syntax") endif let b:current_syntax = "SpaceVimRunner" syntax case ignore -syn match RunnerCmd /\(\[Running\]\ \)\@<=.*/ syn match KeyBindings /\[Running\]/ +syn match KeyBindings /\[Compile\]/ +syn match RunnerCmd /\(\[Running\]\ \)\@<=.*/ +syn match RunnerCmd /\(\[Compile\]\ \)\@<=.*/ syn match DoneSucceeded /\[Done]\(\ exited\ with\ code=0\)\@=/ syn match DoneFailed /\[Done]\(\ exited\ with\ code=[^0]\)\@=/ From 4fa20f8a1013b6a63e74484d53c2e5cdd3b33e1c Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 20:24:41 +0800 Subject: [PATCH 50/89] Update syntax file for runner --- autoload/SpaceVim/plugins/runner.vim | 24 +++++++++++++++++++++--- syntax/SpaceVimRunner.vim | 4 ++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/autoload/SpaceVim/plugins/runner.vim b/autoload/SpaceVim/plugins/runner.vim index 8dcaef35a..3bd344d41 100644 --- a/autoload/SpaceVim/plugins/runner.vim +++ b/autoload/SpaceVim/plugins/runner.vim @@ -67,6 +67,13 @@ function! s:on_compile_exit(id, data, event) abort \ 'on_stderr' : function('s:on_stderr'), \ 'on_exit' : function('s:on_exit'), \ }) + else + let s:end_time = reltime(s:start_time) + let s:status.is_exit = 1 + let s:status.exit_code = a:data + let done = ['', '[Done] exited with code=' . a:data . ' in ' . s:STRING.trim(reltimestr(s:end_time)) . ' seconds'] + call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, done) + call s:update_statusline() endif endfunction @@ -120,9 +127,20 @@ if has('nvim') && exists('*chanclose') let s:_err_data = [''] function! s:on_stderr(job_id, data, event) abort - let s:status.has_errors = 1 - call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data) - let s:lines += len(a:data) + let s:_out_data[-1] .= a:data[0] + call extend(s:_out_data, a:data[1:]) + if s:_out_data[-1] == '' + call remove(s:_out_data, -1) + let lines = s:_out_data + else + let lines = s:_out_data + endif + if !empty(lines) + call add(g:wsd, lines) + call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines) + endif + let s:lines += len(lines) + let s:_out_data = [''] call s:update_statusline() endfunction else diff --git a/syntax/SpaceVimRunner.vim b/syntax/SpaceVimRunner.vim index ece6832f0..35365714f 100644 --- a/syntax/SpaceVimRunner.vim +++ b/syntax/SpaceVimRunner.vim @@ -9,8 +9,12 @@ syn match RunnerCmd /\(\[Running\]\ \)\@<=.*/ syn match RunnerCmd /\(\[Compile\]\ \)\@<=.*/ syn match DoneSucceeded /\[Done]\(\ exited\ with\ code=0\)\@=/ syn match DoneFailed /\[Done]\(\ exited\ with\ code=[^0]\)\@=/ +syn match ExitCode /\(\[Done\]\ exited\ with \)\@<=code=0/ +syn match ExitCodeFailed /\(\[Done\]\ exited\ with \)\@<=code=[^0]/ hi def link RunnerCmd Comment hi def link KeyBindings String hi def link DoneSucceeded String hi def link DoneFailed WarningMsg +hi def link ExitCode MoreMsg +hi def link ExitCodeFailed WarningMsg From a366d0c91a70cb85a97dec614f21fee97535ae35 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 20:55:33 +0800 Subject: [PATCH 51/89] Add support for mouse click --- autoload/SpaceVim/layers/core/tabline.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/autoload/SpaceVim/layers/core/tabline.vim b/autoload/SpaceVim/layers/core/tabline.vim index 29ea10b9b..26d5cf977 100644 --- a/autoload/SpaceVim/layers/core/tabline.vim +++ b/autoload/SpaceVim/layers/core/tabline.vim @@ -127,17 +127,16 @@ function! SpaceVim#layers#core#tabline#get() abort endif let ct = bufnr('%') let pt = index(s:buffers, ct) > 0 ? s:buffers[index(s:buffers, ct) - 1] : -1 - let m_flag = 0 if ct == get(s:buffers, 0, -1) if getbufvar(ct, '&modified', 0) let t = '%#SpaceVim_tabline_m# ' - let m_flag = 1 else let t = '%#SpaceVim_tabline_a# ' endif else let t = '%#SpaceVim_tabline_b# ' endif + let index = 1 for i in s:buffers if getbufvar(i, '&modified', 0) && i != ct let t .= '%#SpaceVim_tabline_m_i#' @@ -156,6 +155,8 @@ function! SpaceVim#layers#core#tabline#get() abort endif call add(stack, i) call s:need_show_bfname(stack, i) + " here is the begin of a tab name + let t .= '%' . index . '@SpaceVim#layers#core#tabline#jump@' if g:spacevim_buffer_index_type == 3 let id = s:messletters.index_num(index(s:buffers, i) + 1) elseif g:spacevim_buffer_index_type == 4 @@ -170,6 +171,8 @@ function! SpaceVim#layers#core#tabline#get() abort endif endif let t .= id . ' ' . name + " here is the end of a tabname + let t .= '%X' if i == ct if s:is_modified(i) let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_b#' . s:lsep . ' ' @@ -185,6 +188,7 @@ function! SpaceVim#layers#core#tabline#get() abort else let t .= ' %#SpaceVim_tabline_b#' . s:ilsep . ' ' endif + let index += 1 endfor let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#' . s:rsep let t .= '%#SpaceVim_tabline_a# Buffers ' @@ -211,7 +215,7 @@ function! SpaceVim#layers#core#tabline#config() abort "call SpaceVim#mapping#space#def('nmap', ['+'], 'bnext', 'window next', 1) endfunction -function! SpaceVim#layers#core#tabline#jump(id) abort +function! SpaceVim#layers#core#tabline#jump(id, ...) abort if len(s:buffers) >= a:id let bid = s:buffers[a:id - 1] exe 'silent b' . bid From 79b19402271344a1ea4b4d0635074550bf27dc20 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 21:12:55 +0800 Subject: [PATCH 52/89] Update doc --- autoload/SpaceVim/layers/core/tabline.vim | 19 ++++++++++++++++--- docs/documentation.md | 7 +++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/autoload/SpaceVim/layers/core/tabline.vim b/autoload/SpaceVim/layers/core/tabline.vim index 26d5cf977..da5111f83 100644 --- a/autoload/SpaceVim/layers/core/tabline.vim +++ b/autoload/SpaceVim/layers/core/tabline.vim @@ -216,9 +216,22 @@ function! SpaceVim#layers#core#tabline#config() abort endfunction function! SpaceVim#layers#core#tabline#jump(id, ...) abort - if len(s:buffers) >= a:id - let bid = s:buffers[a:id - 1] - exe 'silent b' . bid + if get(a:000, 2, '') == 'm' + if len(s:buffers) >= a:id + let bid = s:buffers[a:id - 1] + exe 'silent b' . bid + bd + endif + elseif get(a:000, 2, '') == 'l' + if len(s:buffers) >= a:id + let bid = s:buffers[a:id - 1] + exe 'silent b' . bid + endif + else + if len(s:buffers) >= a:id + let bid = s:buffers[a:id - 1] + exe 'silent b' . bid + endif endif endfunction diff --git a/docs/documentation.md b/docs/documentation.md index 4db3eda20..131349493 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -531,6 +531,13 @@ Buffers will be listed on tabline if there is only one tab, each item contains t | ` 8` | jump to index 8 on tabline | | ` 9` | jump to index 9 on tabline | +SpaceVim tabline also support mouse click, left mouse button will switch to buffer, middle button will delete the buffer. + +| Key Binding | Description | +| ---------------- | ------------------ | +| `` | jump to the buffer | +| `` | delete the buffer | + ## Manual ### Completion From 421f5a60532cd41cdadb59343f3f6cacd5a25f45 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 21:19:15 +0800 Subject: [PATCH 53/89] check +tablineat support --- autoload/SpaceVim/layers/core/tabline.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/core/tabline.vim b/autoload/SpaceVim/layers/core/tabline.vim index da5111f83..51a0b2d5d 100644 --- a/autoload/SpaceVim/layers/core/tabline.vim +++ b/autoload/SpaceVim/layers/core/tabline.vim @@ -156,7 +156,9 @@ function! SpaceVim#layers#core#tabline#get() abort call add(stack, i) call s:need_show_bfname(stack, i) " here is the begin of a tab name - let t .= '%' . index . '@SpaceVim#layers#core#tabline#jump@' + if has('tablineat') + let t .= '%' . index . '@SpaceVim#layers#core#tabline#jump@' + endif if g:spacevim_buffer_index_type == 3 let id = s:messletters.index_num(index(s:buffers, i) + 1) elseif g:spacevim_buffer_index_type == 4 @@ -172,7 +174,9 @@ function! SpaceVim#layers#core#tabline#get() abort endif let t .= id . ' ' . name " here is the end of a tabname - let t .= '%X' + if has('tablineat') + let t .= '%X' + endif if i == ct if s:is_modified(i) let t .= ' %#SpaceVim_tabline_m_SpaceVim_tabline_b#' . s:lsep . ' ' From 30516367715aa1a88b7f64477a1aa851954c6379 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 21:21:19 +0800 Subject: [PATCH 54/89] Fix doc for mouse support in tabline --- docs/documentation.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/documentation.md b/docs/documentation.md index 131349493..0e334f4cd 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -533,6 +533,8 @@ Buffers will be listed on tabline if there is only one tab, each item contains t SpaceVim tabline also support mouse click, left mouse button will switch to buffer, middle button will delete the buffer. +**NOTE:** this feature is only supported in neovim with `has('tablineat')`. + | Key Binding | Description | | ---------------- | ------------------ | | `` | jump to the buffer | From f58a62eeb251c8b54128b441afb078dac8782c3a Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 4 Dec 2017 23:10:51 +0800 Subject: [PATCH 55/89] Fix #1070 --- autoload/SpaceVim/plugins/manager.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index cf312f871..28813fb61 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -232,6 +232,7 @@ endfunction " here if a:data == 0, git pull succeed function! s:on_pull_exit(id, data, event) abort + call SpaceVim#logger#info(string(a:data)) if a:id == -1 let id = s:jobpid else @@ -287,6 +288,7 @@ endfunction " @vimlint(EVL103, 1, a:event) function! s:on_install_stdout(id, data, event) abort + call SpaceVim#logger#info(string(a:data)) if a:id == -1 let id = s:jobpid else @@ -356,7 +358,8 @@ endfunction function! s:pull(repo) abort let s:pct += 1 let s:ui_buf[a:repo.name] = s:pct - let argv = ['git', '--git-dir', a:repo.path . '/.git', 'pull', '--progress'] + let argv = ['git', '--git-dir', a:repo.path . '/.git', '--work-tree', a:repo.path, 'pull', '--progress'] + call SpaceVim#logger#info('plugin manager cmd: ' . string(argv)) if s:JOB.vim_job || s:JOB.nvim_job let jobid = s:JOB.start(argv,{ \ 'on_stderr' : function('s:on_install_stdout'), From d3931cd67334c91c17f3e8922924f9b199608913 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 08:54:32 +0800 Subject: [PATCH 56/89] Fix ycm config --- config/plugins_before/YouCompleteMe.vim | 59 ++++++++++++++++--------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/config/plugins_before/YouCompleteMe.vim b/config/plugins_before/YouCompleteMe.vim index 615861ddd..d41834b82 100644 --- a/config/plugins_before/YouCompleteMe.vim +++ b/config/plugins_before/YouCompleteMe.vim @@ -1,24 +1,39 @@ "let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' "let g:ycm_confirm_extra_conf = 0 -let g:ycm_collect_identifiers_from_tags_files = 1 -let g:ycm_collect_identifiers_from_comments_and_strings = 1 -let g:ycm_key_list_select_completion = ['', ''] -let g:ycm_key_list_previous_completion = ['',''] -let g:ycm_seed_identifiers_with_syntax = 1 -let g:ycm_key_invoke_completion = '' -let g:ycm_semantic_triggers = { - \ 'c' : ['->', '.'], - \ 'objc' : ['->', '.'], - \ 'ocaml' : ['.', '#'], - \ 'cpp,objcpp' : ['->', '.', '::'], - \ 'perl' : ['->'], - \ 'php' : ['->', '::'], - \ 'cs,javascript,d,python,perl6,scala,vb,elixir,go' : ['.'], - \ 'java,jsp' : ['.'], - \ 'vim' : ['re![_a-zA-Z]+[_\w]*\.'], - \ 'ruby' : ['.', '::'], - \ 'lua' : ['.', ':'], - \ 'erlang' : [':'], - \ 'sh' : ['re![\w-]{2}', '/', '-'], - \ 'zsh' : ['re![\w-]{2}', '/', '-'], - \ } +let g:ycm_collect_identifiers_from_tags_files = + \ get(g:, 'ycm_collect_identifiers_from_tags_files', 1) +let g:ycm_collect_identifiers_from_comments_and_strings = + \ get(g:, 'ycm_collect_identifiers_from_comments_and_strings', 1) +let g:ycm_key_list_select_completion = + \ get(g:, 'ycm_key_list_select_completion', ['', '']) +let g:ycm_key_list_previous_completion = + \ get(g:, 'ycm_key_list_previous_completion', ['','']) +let g:ycm_seed_identifiers_with_syntax = + \ get(g:, 'ycm_seed_identifiers_with_syntax', 1) +let g:ycm_key_invoke_completion = + \ get(g:, 'ycm_key_invoke_completion', '') + +let g:ycm_semantic_triggers = get(g:, 'ycm_semantic_triggers', {}) + +function! s:set_ft_triggers(ft, expr, override) abort + if a:override + let g:ycm_semantic_triggers[a:ft] = a:expr + elseif !has_key(g:ycm_semantic_triggers, a:ft) + let g:ycm_semantic_triggers[a:ft] = a:expr + endif +endfunction + +call s:set_ft_triggers('c', ['->', '.'], 0) +call s:set_ft_triggers('objc', ['->', '.'], 0) +call s:set_ft_triggers('ocaml', ['.', '#'], 0) +call s:set_ft_triggers('cpp,objcpp', ['->', '.', '::'], 0) +call s:set_ft_triggers('perl', ['->'], 0) +call s:set_ft_triggers('php', ['->', '::'], 0) +call s:set_ft_triggers('cs,javascript,d,python,perl6,scala,vb,elixir,go', ['.'], 0) +call s:set_ft_triggers('java,jsp', ['.'], 0) +call s:set_ft_triggers('vim', ['re![_a-zA-Z]+[_\w]*\.'], 0) +call s:set_ft_triggers('ruby', ['.', '::'], 0) +call s:set_ft_triggers('lua', ['.', ':'], 0) +call s:set_ft_triggers('erlang', [':'], 0) +call s:set_ft_triggers('sh', ['re![\w-]{2}', '/', '-'], 0) +call s:set_ft_triggers('zsh', ['re![\w-]{2}', '/', '-'], 0) From 54ec968bc9e2816477afc2063f6c8f7eb6140f52 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 10:00:05 +0800 Subject: [PATCH 57/89] Fix ycm mappings --- autoload/SpaceVim/layers/autocomplete.vim | 20 +++++++++++++------- autoload/SpaceVim/mapping.vim | 12 +++++++++--- autoload/SpaceVim/mapping/tab.vim | 16 +++++++++++++++- config/plugins_before/ultisnips.vim | 6 +++--- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/autoload/SpaceVim/layers/autocomplete.vim b/autoload/SpaceVim/layers/autocomplete.vim index 802446238..ab7798b3c 100644 --- a/autoload/SpaceVim/layers/autocomplete.vim +++ b/autoload/SpaceVim/layers/autocomplete.vim @@ -110,13 +110,19 @@ function! SpaceVim#layers#autocomplete#config() abort if s:tab_key_behavior ==# 'smart' if has('patch-7.4.774') imap SpaceVim#mapping#tab() - smap - \ neosnippet#expandable_or_jumpable() ? - \ "\(neosnippet_expand_or_jump)" : - \ (complete_parameter#jumpable(1) ? - \ "\(complete_parameter#goto_next_parameter)" : - \ "\") - imap SpaceVim#mapping#shift_tab() + if g:spacevim_snippet_engine ==# 'neosnippet' + smap + \ neosnippet#expandable_or_jumpable() ? + \ "\(neosnippet_expand_or_jump)" : + \ (complete_parameter#jumpable(1) ? + \ "\(complete_parameter#goto_next_parameter)" : + \ "\") + imap SpaceVim#mapping#shift_tab() + elseif g:spacevim_snippet_engine ==# 'ultisnips' + imap SpaceVim#mapping#tab() + imap SpaceVim#mapping#shift_tab() + else + endif else call SpaceVim#logger#warn('smart tab in autocomplete layer need patch 7.4.774') endif diff --git a/autoload/SpaceVim/mapping.vim b/autoload/SpaceVim/mapping.vim index f64b91d61..0d7e49978 100644 --- a/autoload/SpaceVim/mapping.vim +++ b/autoload/SpaceVim/mapping.vim @@ -79,9 +79,15 @@ function! SpaceVim#mapping#def(type, key, value, ...) abort endif endfunction -function! SpaceVim#mapping#shift_tab() abort - return pumvisible() ? "\" : "\delimitMateS-Tab" -endfunction +if g:spacevim_snippet_engine ==# 'neosnippet' + function! SpaceVim#mapping#shift_tab() abort + return pumvisible() ? "\" : "\delimitMateS-Tab" + endfunction +elseif g:spacevim_snippet_engine ==# 'ultisnips' + function! SpaceVim#mapping#shift_tab() abort + return pumvisible() ? "\" : "\=UltiSnips#JumpForwards()\\=cmp#ultisnips#JumpForward()\" + endfunction +endif function! SpaceVim#mapping#tab() abort return SpaceVim#mapping#tab#i_tab() diff --git a/autoload/SpaceVim/mapping/tab.vim b/autoload/SpaceVim/mapping/tab.vim index cd3112099..7d7bbb3d2 100644 --- a/autoload/SpaceVim/mapping/tab.vim +++ b/autoload/SpaceVim/mapping/tab.vim @@ -20,9 +20,23 @@ if g:spacevim_snippet_engine ==# 'neosnippet' endif endfunction elseif g:spacevim_snippet_engine ==# 'ultisnips' + function! SpaceVim#mapping#tab#expandable() + let snippet = UltiSnips#ExpandSnippetOrJump() + if g:ulti_expand_or_jump_res > 0 + return snippet + elseif pumvisible() + return "\" + else + return "\" + endif + endfunction function! SpaceVim#mapping#tab#i_tab() abort - return "\" + if getline('.')[col('.')-2] ==# '{'&& pumvisible() + return "\" + endif + return "\=SpaceVim#mapping#tab#expandable()\" endfunction endif + " vim:set et sw=2 cc=80: diff --git a/config/plugins_before/ultisnips.vim b/config/plugins_before/ultisnips.vim index 74dfcb0f1..c31149706 100644 --- a/config/plugins_before/ultisnips.vim +++ b/config/plugins_before/ultisnips.vim @@ -1,6 +1,6 @@ " If you want :UltiSnipsEdit to split your window. let g:UltiSnipsEditSplit="vertical" -let g:UltiSnipsExpandTrigger='' -let g:UltiSnipsJumpBackwardTrigger="" -let g:UltiSnipsJumpForwardTrigger='' +let g:UltiSnipsExpandTrigger='' +let g:UltiSnipsJumpBackwardTrigger='' +let g:UltiSnipsJumpForwardTrigger='' let g:UltiSnipsSnippetsDir = '~/.SpaceVim.d/UltiSnips' From 802e57bcb28d9275488ad15e2eabd531b29fe276 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 10:08:10 +0800 Subject: [PATCH 58/89] Fix 1075 --- config/plugins/vimfiler.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index 513b6c9f2..e9bc7c529 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -18,7 +18,8 @@ let g:vimfiler_ignore_pattern = get(g:, 'vimfiler_ignore_pattern', [ \ '^\.DS_Store$', \ '^\.init\.vim-rplugin\~$', \ '^\.netrwhist$', - \ '\.class$' + \ '\.class$', + \ '^\.' \]) if has('mac') From 83568afc5f43b9bf62af808f8edb6302adf2926f Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 10:17:43 +0800 Subject: [PATCH 59/89] Fix up --- autoload/SpaceVim/layers/autocomplete.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/SpaceVim/layers/autocomplete.vim b/autoload/SpaceVim/layers/autocomplete.vim index ab7798b3c..590318b40 100644 --- a/autoload/SpaceVim/layers/autocomplete.vim +++ b/autoload/SpaceVim/layers/autocomplete.vim @@ -121,6 +121,10 @@ function! SpaceVim#layers#autocomplete#config() abort elseif g:spacevim_snippet_engine ==# 'ultisnips' imap SpaceVim#mapping#tab() imap SpaceVim#mapping#shift_tab() + snoremap + \ :call UltiSnips#JumpForwards() + snoremap + \ :call UltiSnips#JumpBackwards() else endif else From 6d37fa6b36e541e937b0858bbf2d2ad66df5d1be Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 10:37:20 +0800 Subject: [PATCH 60/89] Disable tag source when edit vim file --- config/plugins/deoplete.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/plugins/deoplete.vim b/config/plugins/deoplete.vim index 40b1a2eb8..2098bd8d5 100644 --- a/config/plugins/deoplete.vim +++ b/config/plugins/deoplete.vim @@ -85,6 +85,9 @@ let g:deoplete#ignore_sources.c = get(g:deoplete#ignore_sources, 'c', ['omni']) let g:deoplete#ignore_sources.rust = get(g:deoplete#ignore_sources, 'rust', ['omni']) call deoplete#custom#set('racer', 'mark', '') +" vim +let g:deoplete#ignore_sources.vim = get(g:deoplete#ignore_sources, 'vim', ['tag']) + " clojure let g:deoplete#keyword_patterns.clojure = '[\w!$%&*+/:<=>?@\^_~\-\.#]*' From ce0308cdbd3e8036147cecacc5928a6bf532d63f Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 13:46:49 +0800 Subject: [PATCH 61/89] Add support for check winwidth --- autoload/SpaceVim/api/vim/statusline.vim | 2 +- autoload/SpaceVim/layers/core/statusline.vim | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/SpaceVim/api/vim/statusline.vim b/autoload/SpaceVim/api/vim/statusline.vim index 019da8572..17d3f8a40 100644 --- a/autoload/SpaceVim/api/vim/statusline.vim +++ b/autoload/SpaceVim/api/vim/statusline.vim @@ -1,7 +1,7 @@ let s:self = {} -function! s:self.build(left_sections, right_sections, lsep, rsep, fname, hi_a, hi_b, hi_c, hi_z) abort +function! s:self.build(left_sections, right_sections, lsep, rsep, fname, hi_a, hi_b, hi_c, hi_z, winwidth) abort let l = '%#' . a:hi_a . '#' . a:left_sections[0] let l .= '%#' . a:hi_a . '_' . a:hi_b . '#' . a:lsep let flag = 1 diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index bd8ff225e..034895343 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -375,7 +375,7 @@ function! s:active() abort endfor let fname = s:buffer_name() return s:STATUSLINE.build(lsec, rsec, s:lsep, s:rsep, fname, - \ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') + \ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z', winwidth(winnr())) endfunction function! s:inactive() abort @@ -499,7 +499,7 @@ function! SpaceVim#layers#core#statusline#config() abort function! TagbarStatusline(...) abort let name = (strwidth(a:3) > (g:spacevim_sidebar_width - 15)) ? a:3[:g:spacevim_sidebar_width - 20] . '..' : a:3 return s:STATUSLINE.build([s:winnr(),' Tagbar ', ' ' . name . ' '], [], s:lsep, s:rsep, '', - \ 'SpaceVim_statusline_ia', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') + \ 'SpaceVim_statusline_ia', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z', g:spacevim_sidebar_width) endfunction let g:tagbar_status_func = 'TagbarStatusline' let g:unite_force_overwrite_statusline = 0 @@ -531,7 +531,7 @@ endfunction function! SpaceVim#layers#core#statusline#ctrlp(focus, byfname, regex, prev, item, next, marked) abort return s:STATUSLINE.build([' Ctrlp ', ' ' . a:prev . ' ', ' ' . a:item . ' ', ' ' . a:next . ' '], \ [' ' . a:focus . ' ', ' ' . a:byfname . ' ', ' ' . getcwd() . ' '], s:lsep, s:rsep, '', - \ 'SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') + \ 'SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z', winwidth(winnr())) endfunction " @vimlint(EVL103, 0, a:regex) " @vimlint(EVL103, 0, a:marked) @@ -541,7 +541,7 @@ endfunction function! SpaceVim#layers#core#statusline#ctrlp_status(str) abort return s:STATUSLINE.build([' Ctrlp ', ' ' . a:str . ' '], \ [' ' . getcwd() . ' '], s:lsep, s:rsep, '', - \ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z') + \ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z', winwidth(winnr())) endfunction function! SpaceVim#layers#core#statusline#jump(i) abort @@ -623,4 +623,4 @@ function! SpaceVim#layers#core#statusline#register_sections(name, func) endfunction -" vim:set et sw=2 cc=80: +" vim:set et sw=2 cc=80 nowrap: From 9d4fcd6bccf3d7bf171b8923be02f488b697c730 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 14:06:28 +0800 Subject: [PATCH 62/89] Check statuslien len --- autoload/SpaceVim/api/vim/statusline.vim | 99 +++++++++++++++--------- 1 file changed, 63 insertions(+), 36 deletions(-) diff --git a/autoload/SpaceVim/api/vim/statusline.vim b/autoload/SpaceVim/api/vim/statusline.vim index 17d3f8a40..9ed16c7b4 100644 --- a/autoload/SpaceVim/api/vim/statusline.vim +++ b/autoload/SpaceVim/api/vim/statusline.vim @@ -1,48 +1,75 @@ let s:self = {} +function! s:self.check_width(len, sec, winwidth) abort + return a:len + self.len(a:sec) < a:winwidth +endfunction + +function! s:self.len(sec) abort + return len(substitute(a:sec, '%{.*}', '', 'g')) +endfunction + + function! s:self.build(left_sections, right_sections, lsep, rsep, fname, hi_a, hi_b, hi_c, hi_z, winwidth) abort - let l = '%#' . a:hi_a . '#' . a:left_sections[0] - let l .= '%#' . a:hi_a . '_' . a:hi_b . '#' . a:lsep - let flag = 1 - for sec in filter(a:left_sections[1:], '!empty(v:val)') - if flag == 1 - let l .= '%#' . a:hi_b . '#' . sec - let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:lsep - else - let l .= '%#' . a:hi_c . '#' . sec - let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:lsep - endif - let flag = flag * -1 - endfor - let l = l[:len(a:lsep) * -1 - 1] - if empty(a:right_sections) - if flag == 1 - return l . '%#' . a:hi_c . '#' - else - return l . '%#' . a:hi_b . '#' - endif + let l = '%#' . a:hi_a . '#' . a:left_sections[0] + let l .= '%#' . a:hi_a . '_' . a:hi_b . '#' . a:lsep + let flag = 1 + let len = 0 + for sec in filter(a:left_sections[1:], '!empty(v:val)') + if self.check_width(len, sec, a:winwidth) + let len += self.len(sec) + if flag == 1 + let l .= '%#' . a:hi_b . '#' . sec + let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:lsep + else + let l .= '%#' . a:hi_c . '#' . sec + let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:lsep + endif + let flag = flag * -1 endif + endfor + let l = l[:len(a:lsep) * -1 - 1] + if empty(a:right_sections) if flag == 1 - let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . a:fname . '%=' + return l . '%#' . a:hi_c . '#' else - let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . a:fname . '%=' + return l . '%#' . a:hi_b . '#' endif - let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:rsep - let flag = 1 - for sec in filter(a:right_sections, '!empty(v:val)') - if flag == 1 - let l .= '%#' . a:hi_b . '#' . sec - let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:rsep - else - let l .= '%#' . a:hi_c . '#' . sec - let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:rsep - endif - let flag = flag * -1 - endfor - return l[:-4] + endif + if self.check_width(len, a:fname, a:winwidth) + let len += self.len(a:fname) + if flag == 1 + let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . a:fname . '%=' + else + let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . a:fname . '%=' + endif + else + if flag == 1 + let l .= '%#' . a:hi_c . '_' . a:hi_z . '#' . a:lsep . '%=' + else + let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:lsep . '%=' + endif + endif + let l .= '%#' . a:hi_b . '_' . a:hi_z . '#' . a:rsep + let flag = 1 + for sec in filter(a:right_sections, '!empty(v:val)') + if self.check_width(len, sec, a:winwidth) + let len += self.len(sec) + if flag == 1 + let l .= '%#' . a:hi_b . '#' . sec + let l .= '%#' . a:hi_c . '_' . a:hi_b . '#' . a:rsep + else + let l .= '%#' . a:hi_c . '#' . sec + let l .= '%#' . a:hi_b . '_' . a:hi_c . '#' . a:rsep + endif + let flag = flag * -1 + endif + endfor + return l[:-4] endfunction function! SpaceVim#api#vim#statusline#get() abort - return deepcopy(s:self) + return deepcopy(s:self) endfunction + +" vim:set et sw=2 cc=80 nowrap: From 6ea0aa04ddb3cef295115ac4450c3b0f098ad33d Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 19:24:56 +0800 Subject: [PATCH 63/89] Fix stausline for small windows --- autoload/SpaceVim/api/vim/statusline.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/api/vim/statusline.vim b/autoload/SpaceVim/api/vim/statusline.vim index 9ed16c7b4..6712ed541 100644 --- a/autoload/SpaceVim/api/vim/statusline.vim +++ b/autoload/SpaceVim/api/vim/statusline.vim @@ -5,8 +5,14 @@ function! s:self.check_width(len, sec, winwidth) abort return a:len + self.len(a:sec) < a:winwidth endfunction +let g:wsd = '%{" " . g:_spacevim_statusline_fileformat . " | " . (&fenc!=""?&fenc:&enc) . " "}' function! s:self.len(sec) abort - return len(substitute(a:sec, '%{.*}', '', 'g')) + let str = matchstr(a:sec, '%{.*}') + if !empty(str) + return len(a:sec) - len(str) + len(eval(str[2:-2])) + 4 + else + return len(a:sec) + 4 + endif endfunction From d8774f488e3b85af708b99380b6513b75419d33e Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 19:52:44 +0800 Subject: [PATCH 64/89] Fix inactive window statusline --- autoload/SpaceVim/layers/core/statusline.vim | 23 +++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 034895343..66c9e1cab 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -379,14 +379,21 @@ function! s:active() abort endfunction function! s:inactive() abort - return '%#SpaceVim_statusline_ia#' . s:winnr() . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep - \ . '%#SpaceVim_statusline_b#' . s:filename() . s:ilsep - \ . ' ' . &filetype . ' ' . s:ilsep - \ . s:modes() . s:ilsep - \ . s:git_branch() . s:ilsep - \ . ' %=' - \ . s:irsep . '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}' - \ . s:irsep . ' %P ' + let l = '%#SpaceVim_statusline_ia#' . s:winnr() . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep . '%#SpaceVim_statusline_b#' + let lsec = [s:filename(), &filetype, s:modes(), s:git_branch(),] + let rsec = ['%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}', ' %P '] + let len = s:STATUSLINE.len(s:winnr()) + 5 + let lt = [] + let winwidth = winwidth(winnr()) + for sec in lsec + if len + s:STATUSLINE.len(sec) < winwidth + call add(lt, sec) + let len = len + s:STATUSLINE.len(sec) + else + break + endif + endfor + return l . join(lt, s:ilsep) . s:ilsep . ' %='. s:irsep . join(rsec, s:irsep) endfunction function! s:gitgutter() abort if exists('b:gitgutter_summary') From dc812ae0c71321757682176498141298d876acdc Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 20:49:16 +0800 Subject: [PATCH 65/89] Fix mouse wheel in flygrep --- autoload/SpaceVim/plugins/flygrep.vim | 255 ++++++++++++++------------ 1 file changed, 135 insertions(+), 120 deletions(-) diff --git a/autoload/SpaceVim/plugins/flygrep.vim b/autoload/SpaceVim/plugins/flygrep.vim index 21b56a8ba..785b89ca5 100644 --- a/autoload/SpaceVim/plugins/flygrep.vim +++ b/autoload/SpaceVim/plugins/flygrep.vim @@ -5,15 +5,15 @@ let s:grepid = 0 function! SpaceVim#plugins#flygrep#open() abort - rightbelow split __flygrep__ - setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber - let save_tve = &t_ve - setlocal t_ve= - " setlocal nomodifiable - setf SpaceVimFlyGrep - redraw! - call s:MPT.open() - let &t_ve = save_tve + rightbelow split __flygrep__ + setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber + let save_tve = &t_ve + setlocal t_ve= + " setlocal nomodifiable + setf SpaceVimFlyGrep + redraw! + call s:MPT.open() + let &t_ve = save_tve endfunction let s:grep_expr = '' @@ -22,53 +22,53 @@ let s:grep_timer_id = 0 " @vimlint(EVL103, 1, a:timer) function! s:grep_timer(timer) abort - let s:grepid = s:JOB.start(s:get_search_cmd(s:grep_exe, s:grep_expr), { - \ 'on_stdout' : function('s:grep_stdout'), - \ 'in_io' : 'null', - \ 'on_exit' : function('s:grep_exit'), - \ }) + let s:grepid = s:JOB.start(s:get_search_cmd(s:grep_exe, s:grep_expr), { + \ 'on_stdout' : function('s:grep_stdout'), + \ 'in_io' : 'null', + \ 'on_exit' : function('s:grep_exit'), + \ }) endfunction " @vimlint(EVL103, 0, a:timer) function! s:flygrep(expr) abort - call s:MPT._build_prompt() - if a:expr ==# '' - redrawstatus - return - endif - try - syn clear FileNames - catch - endtr - exe 'syn match FileNames /' . substitute(a:expr, '\([/\\]\)', '\\\1', 'g') . '/' - hi def link FileNames MoreMsg - let s:grep_expr = a:expr - let s:grep_timer_id = timer_start(500, funcref('s:grep_timer'), {'repeat' : 1}) + call s:MPT._build_prompt() + if a:expr ==# '' + redrawstatus + return + endif + try + syn clear FileNames + catch + endtr + exe 'syn match FileNames /' . substitute(a:expr, '\([/\\]\)', '\\\1', 'g') . '/' + hi def link FileNames MoreMsg + let s:grep_expr = a:expr + let s:grep_timer_id = timer_start(500, funcref('s:grep_timer'), {'repeat' : 1}) endfunction let s:MPT._handle_fly = function('s:flygrep') function! s:close_buffer() abort - if s:grepid != 0 - call s:JOB.stop(s:grepid) - endif - if s:grep_timer_id != 0 - call timer_stop(s:grep_timer_id) - endif - q + if s:grepid != 0 + call s:JOB.stop(s:grepid) + endif + if s:grep_timer_id != 0 + call timer_stop(s:grep_timer_id) + endif + q endfunction let s:MPT._onclose = function('s:close_buffer') function! s:close_grep_job() abort - if s:grepid != 0 - call s:JOB.stop(s:grepid) - endif - if s:grep_timer_id != 0 - call timer_stop(s:grep_timer_id) - endif - normal! "_ggdG + if s:grepid != 0 + call s:JOB.stop(s:grepid) + endif + if s:grep_timer_id != 0 + call timer_stop(s:grep_timer_id) + endif + normal! "_ggdG endfunction let s:MPT._oninputpro = function('s:close_grep_job') @@ -77,18 +77,18 @@ let s:MPT._oninputpro = function('s:close_grep_job') " @vimlint(EVL103, 1, a:id) " @vimlint(EVL103, 1, a:event) function! s:grep_stdout(id, data, event) abort - let datas =filter(a:data, '!empty(v:val)') - if getline(1) ==# '' - call setline(1, datas) - else - call append('$', datas) - endif - call s:MPT._build_prompt() + let datas =filter(a:data, '!empty(v:val)') + if getline(1) ==# '' + call setline(1, datas) + else + call append('$', datas) + endif + call s:MPT._build_prompt() endfunction function! s:grep_exit(id, data, event) abort - redrawstatus - let s:grepid = 0 + redrawstatus + let s:grepid = 0 endfunction " @vimlint(EVL103, 0, a:data) @@ -96,98 +96,113 @@ endfunction " @vimlint(EVL103, 0, a:event) function! s:get_search_cmd(exe, expr) abort - if a:exe ==# 'grep' - return ['grep', '-inHR', '--exclude-dir', '.git', a:expr, '.'] - elseif a:exe ==# 'rg' - return ['rg', '-n', '-i', a:expr] - else - return [a:exe, a:expr] - endif + if a:exe ==# 'grep' + return ['grep', '-inHR', '--exclude-dir', '.git', a:expr, '.'] + elseif a:exe ==# 'rg' + return ['rg', '-n', '-i', a:expr] + else + return [a:exe, a:expr] + endif endfunction function! s:next_item() abort - if line('.') == line('$') - normal! gg - else - normal! j - endif - redrawstatus - call s:MPT._build_prompt() + if line('.') == line('$') + normal! gg + else + normal! j + endif + redrawstatus + call s:MPT._build_prompt() endfunction function! s:previous_item() abort - if line('.') == 1 - normal! G - else - normal! k - endif - redrawstatus - call s:MPT._build_prompt() + if line('.') == 1 + normal! G + else + normal! k + endif + redrawstatus + call s:MPT._build_prompt() endfunction function! s:open_item() abort - if getline('.') !=# '' - if s:grepid != 0 - call s:JOB.stop(s:grepid) - endif - call s:MPT._clear_prompt() - let s:MPT._quit = 1 - let line = getline('.') - let filename = fnameescape(split(line, ':\d\+:')[0]) - let linenr = matchstr(line, ':\d\+:')[1:-2] - q - exe 'e ' . filename - exe linenr + if getline('.') !=# '' + if s:grepid != 0 + call s:JOB.stop(s:grepid) endif + call s:MPT._clear_prompt() + let s:MPT._quit = 1 + let line = getline('.') + let filename = fnameescape(split(line, ':\d\+:')[0]) + let linenr = matchstr(line, ':\d\+:')[1:-2] + q + exe 'e ' . filename + exe linenr + endif endfunction function! s:double_click() abort - if line('.') !=# '' - if s:grepid != 0 - call s:JOB.stop(s:grepid) - endif - call s:MPT._clear_prompt() - let s:MPT._quit = 1 - let isfname = &isfname - if s:SYS.isWindows - set isfname-=: - endif - normal! gF - let nr = bufnr('%') - q - exe 'silent b' . nr - normal! : - let &isfname = isfname + if line('.') !=# '' + if s:grepid != 0 + call s:JOB.stop(s:grepid) endif + call s:MPT._clear_prompt() + let s:MPT._quit = 1 + let isfname = &isfname + if s:SYS.isWindows + set isfname-=: + endif + normal! gF + let nr = bufnr('%') + q + exe 'silent b' . nr + normal! : + let &isfname = isfname + endif endfunction function! s:move_cursor() abort - if v:mouse_win == winnr() - let cl = line('.') - if cl < v:mouse_lnum - exe 'normal! ' . (v:mouse_lnum - cl) . 'j' - elseif cl > v:mouse_lnum - exe 'normal! ' . (cl - v:mouse_lnum) . 'k' - endif + if v:mouse_win == winnr() + let cl = line('.') + if cl < v:mouse_lnum + exe 'normal! ' . (v:mouse_lnum - cl) . 'j' + elseif cl > v:mouse_lnum + exe 'normal! ' . (cl - v:mouse_lnum) . 'k' endif - call s:MPT._build_prompt() + endif + call s:MPT._build_prompt() endfunction let s:MPT._function_key = { - \ "\" : function('s:next_item'), - \ "\" : function('s:next_item'), - \ "\" : function('s:previous_item'), - \ "\" : function('s:previous_item'), - \ "\" : function('s:open_item'), - \ "\" : function('s:move_cursor'), - \ "\<2-LeftMouse>" : function('s:double_click'), - \ } + \ "\" : function('s:next_item'), + \ "\" : function('s:next_item'), + \ "\" : function('s:previous_item'), + \ "\" : function('s:previous_item'), + \ "\" : function('s:open_item'), + \ "\" : function('s:move_cursor'), + \ "\<2-LeftMouse>" : function('s:double_click'), + \ } + +if has('nvim') + call extend(s:MPT._function_key, + \ { + \ "\x80\xfdJ" : function('s:previous_item'), + \ "\x80\xfc \x80\xfdJ" : function('s:previous_item'), + \ "\x80\xfc@\x80\xfdJ" : function('s:previous_item'), + \ "\x80\xfc`\x80\xfdJ" : function('s:previous_item'), + \ "\x80\xfdK" : function('s:next_item'), + \ "\x80\xfc \x80\xfdK" : function('s:next_item'), + \ "\x80\xfc@\x80\xfdK" : function('s:next_item'), + \ "\x80\xfc`\x80\xfdK" : function('s:next_item'), + \ } + \ ) +endif " statusline api function! SpaceVim#plugins#flygrep#lineNr() abort - if getline(1) ==# '' - return '' - else - return line('.') . '/' . line('$') - endif + if getline(1) ==# '' + return '' + else + return line('.') . '/' . line('$') + endif endfunction From e9826e3faed5df1e93962a3ab883ee50c5523c68 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 21:14:36 +0800 Subject: [PATCH 66/89] Fix flygrep --- autoload/SpaceVim/plugins/flygrep.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/plugins/flygrep.vim b/autoload/SpaceVim/plugins/flygrep.vim index 785b89ca5..f3cdb7d0b 100644 --- a/autoload/SpaceVim/plugins/flygrep.vim +++ b/autoload/SpaceVim/plugins/flygrep.vim @@ -40,8 +40,8 @@ function! s:flygrep(expr) abort syn clear FileNames catch endtr - exe 'syn match FileNames /' . substitute(a:expr, '\([/\\]\)', '\\\1', 'g') . '/' hi def link FileNames MoreMsg + call matchadd('FileNames', a:expr) let s:grep_expr = a:expr let s:grep_timer_id = timer_start(500, funcref('s:grep_timer'), {'repeat' : 1}) endfunction From 3673b17a7d5f8d6463ccc01011263828e72f5de9 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 5 Dec 2017 21:53:36 +0800 Subject: [PATCH 67/89] Fix: Flygrep match pattern override FileName --- autoload/SpaceVim/plugins/flygrep.vim | 2 +- syntax/SpaceVimFlyGrep.vim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/SpaceVim/plugins/flygrep.vim b/autoload/SpaceVim/plugins/flygrep.vim index f3cdb7d0b..7b49ab8ea 100644 --- a/autoload/SpaceVim/plugins/flygrep.vim +++ b/autoload/SpaceVim/plugins/flygrep.vim @@ -41,7 +41,7 @@ function! s:flygrep(expr) abort catch endtr hi def link FileNames MoreMsg - call matchadd('FileNames', a:expr) + call matchadd('FileNames', a:expr, 1) let s:grep_expr = a:expr let s:grep_timer_id = timer_start(500, funcref('s:grep_timer'), {'repeat' : 1}) endfunction diff --git a/syntax/SpaceVimFlyGrep.vim b/syntax/SpaceVimFlyGrep.vim index bb5782fe3..ba7f9bf1d 100644 --- a/syntax/SpaceVimFlyGrep.vim +++ b/syntax/SpaceVimFlyGrep.vim @@ -1,8 +1,8 @@ if exists("b:current_syntax") - finish + finish endif let b:current_syntax = "SpaceVimFlyGrep" syntax case ignore -syn match FileName /[^:]*:\d\+:/ hi def link FileName Comment +call matchadd('FileName', '[^:]*:\d\+:', 2) From 8faf056d4d50eed37c199ba8955637309d7d5ee4 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 6 Dec 2017 00:08:08 +0800 Subject: [PATCH 68/89] Clear highlight after insert char --- autoload/SpaceVim/plugins/flygrep.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/plugins/flygrep.vim b/autoload/SpaceVim/plugins/flygrep.vim index 7b49ab8ea..68f88fbde 100644 --- a/autoload/SpaceVim/plugins/flygrep.vim +++ b/autoload/SpaceVim/plugins/flygrep.vim @@ -37,11 +37,11 @@ function! s:flygrep(expr) abort return endif try - syn clear FileNames + call matchdelete(s:hi_id) catch endtr hi def link FileNames MoreMsg - call matchadd('FileNames', a:expr, 1) + let s:hi_id = matchadd('FileNames', a:expr, 1) let s:grep_expr = a:expr let s:grep_timer_id = timer_start(500, funcref('s:grep_timer'), {'repeat' : 1}) endfunction From a12d2aae6370e13976ccd8de78623eb603ad53d6 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 6 Dec 2017 10:53:21 +0800 Subject: [PATCH 69/89] Fix statusline for inactive window --- autoload/SpaceVim/api/vim/statusline.vim | 3 ++ autoload/SpaceVim/layers/core/statusline.vim | 40 ++++++++++---------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/autoload/SpaceVim/api/vim/statusline.vim b/autoload/SpaceVim/api/vim/statusline.vim index 6712ed541..e75f8abe2 100644 --- a/autoload/SpaceVim/api/vim/statusline.vim +++ b/autoload/SpaceVim/api/vim/statusline.vim @@ -15,6 +15,9 @@ function! s:self.len(sec) abort endif endfunction +function! s:self.eval(sec) abort + return substitute(a:sec, '%{.*}', '', 'g') +endfunction function! s:self.build(left_sections, right_sections, lsep, rsep, fname, hi_a, hi_b, hi_c, hi_z, winwidth) abort let l = '%#' . a:hi_a . '#' . a:left_sections[0] diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 66c9e1cab..98b09f1ea 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -151,7 +151,7 @@ endfunction function! s:date() abort return ' ' . s:TIME.current_date() . ' ' - + endfunction function! s:whitespace() abort @@ -313,6 +313,9 @@ function! s:filesize() abort endfunction function! SpaceVim#layers#core#statusline#get(...) abort + for nr in range(1, winnr('$')) + call setwinvar(nr, 'winwidth', winwidth(nr)) + endfor if &filetype ==# 'vimfiler' return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep \ . '%#SpaceVim_statusline_b# vimfiler %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep @@ -380,21 +383,18 @@ endfunction function! s:inactive() abort let l = '%#SpaceVim_statusline_ia#' . s:winnr() . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep . '%#SpaceVim_statusline_b#' - let lsec = [s:filename(), &filetype, s:modes(), s:git_branch(),] - let rsec = ['%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}', ' %P '] - let len = s:STATUSLINE.len(s:winnr()) + 5 - let lt = [] - let winwidth = winwidth(winnr()) - for sec in lsec - if len + s:STATUSLINE.len(sec) < winwidth - call add(lt, sec) - let len = len + s:STATUSLINE.len(sec) - else - break - endif + let secs = [s:filename(), &filetype, s:modes(), s:git_branch()] + let base = 30 + for sec in secs + let len = s:STATUSLINE.len(sec) + let base += len + let l .= '%{ get(w:, "winwidth", 150) < ' . base . ' ? "" : (" ' . s:STATUSLINE.eval(sec) . ' ' . s:ilsep . '")}' endfor - return l . join(lt, s:ilsep) . s:ilsep . ' %='. s:irsep . join(rsec, s:irsep) + let l .= join(['%=', '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}', ' %P '], s:irsep) + return l endfunction + + function! s:gitgutter() abort if exists('b:gitgutter_summary') let l:summary = get(b:, 'gitgutter_summary') @@ -620,12 +620,12 @@ endfunction function! SpaceVim#layers#core#statusline#register_sections(name, func) - if has_key(s:registed_sections, a:name) - call SpaceVim#logger#info('statusline build-in section ' . a:name . ' has been changed!') - call extend(s:registed_sections, {a:name : a:func}) - else - call extend(s:registed_sections, {a:name : a:func}) - endif + if has_key(s:registed_sections, a:name) + call SpaceVim#logger#info('statusline build-in section ' . a:name . ' has been changed!') + call extend(s:registed_sections, {a:name : a:func}) + else + call extend(s:registed_sections, {a:name : a:func}) + endif endfunction From b36df096f50dd6bbd12b4de3b2197fc48c0e674d Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 6 Dec 2017 10:59:48 +0800 Subject: [PATCH 70/89] Fix statusline for inactive window --- autoload/SpaceVim/layers/core/statusline.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 98b09f1ea..2266f7f8f 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -384,13 +384,15 @@ endfunction function! s:inactive() abort let l = '%#SpaceVim_statusline_ia#' . s:winnr() . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep . '%#SpaceVim_statusline_b#' let secs = [s:filename(), &filetype, s:modes(), s:git_branch()] - let base = 30 + let base = 10 for sec in secs let len = s:STATUSLINE.len(sec) let base += len let l .= '%{ get(w:, "winwidth", 150) < ' . base . ' ? "" : (" ' . s:STATUSLINE.eval(sec) . ' ' . s:ilsep . '")}' endfor - let l .= join(['%=', '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}', ' %P '], s:irsep) + if get(w:, 'winwidth', 150) > base + 10 + let l .= join(['%=', '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}', ' %P '], s:irsep) + endif return l endfunction From a7d7831bd15cf0e6c1564ff7bf3756c056cf8513 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 6 Dec 2017 16:15:18 +0800 Subject: [PATCH 71/89] Fix 1056 --- autoload/SpaceVim/layers/edit.vim | 796 +++++++++++++++--------------- 1 file changed, 401 insertions(+), 395 deletions(-) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index f308eaa71..e71a92e96 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -4,406 +4,412 @@ let s:NUMBER = SpaceVim#api#import('data#number') let s:LIST = SpaceVim#api#import('data#list') function! SpaceVim#layers#edit#plugins() abort - let plugins = [ - \ ['tpope/vim-surround'], - \ ['tpope/vim-repeat'], - \ ['junegunn/vim-emoji'], - \ ['terryma/vim-multiple-cursors', { 'loadconf' : 1}], - \ ['terryma/vim-expand-region', { 'loadconf' : 1}], - \ ['kana/vim-textobj-user'], - \ ['kana/vim-textobj-indent'], - \ ['kana/vim-textobj-line'], - \ ['kana/vim-textobj-entire'], - \ ['scrooloose/nerdcommenter', { 'loadconf' : 1}], - \ ['mattn/emmet-vim', { 'on_cmd' : 'EmmetInstall'}], - \ ['gcmt/wildfire.vim',{'on_map' : '(wildfire-'}], - \ ['easymotion/vim-easymotion'], - \ ['haya14busa/vim-easyoperator-line'], - \ ['editorconfig/editorconfig-vim', { 'merged' : 0}], - \ ['floobits/floobits-neovim', { 'on_cmd' : ['FlooJoinWorkspace','FlooShareDirPublic','FlooShareDirPrivate']}], - \ ['osyo-manga/vim-jplus', { 'on_map' : '(jplus' }], - \ ] - if executable('fcitx') - call add(plugins,['lilydjwg/fcitx.vim', { 'on_event' : 'InsertEnter'}]) - endif - return plugins + let plugins = [ + \ ['tpope/vim-surround'], + \ ['tpope/vim-repeat'], + \ ['junegunn/vim-emoji'], + \ ['terryma/vim-multiple-cursors', { 'loadconf' : 1}], + \ ['terryma/vim-expand-region', { 'loadconf' : 1}], + \ ['kana/vim-textobj-user'], + \ ['kana/vim-textobj-indent'], + \ ['kana/vim-textobj-line'], + \ ['kana/vim-textobj-entire'], + \ ['scrooloose/nerdcommenter', { 'loadconf' : 1}], + \ ['mattn/emmet-vim', { 'on_cmd' : 'EmmetInstall'}], + \ ['gcmt/wildfire.vim',{'on_map' : '(wildfire-'}], + \ ['easymotion/vim-easymotion'], + \ ['haya14busa/vim-easyoperator-line'], + \ ['editorconfig/editorconfig-vim', { 'merged' : 0}], + \ ['floobits/floobits-neovim', { 'on_cmd' : ['FlooJoinWorkspace','FlooShareDirPublic','FlooShareDirPrivate']}], + \ ['osyo-manga/vim-jplus', { 'on_map' : '(jplus' }], + \ ] + if executable('fcitx') + call add(plugins,['lilydjwg/fcitx.vim', { 'on_event' : 'InsertEnter'}]) + endif + return plugins endfunction function! SpaceVim#layers#edit#config() abort - let g:multi_cursor_next_key=get(g:, 'multi_cursor_next_key', '') - let g:multi_cursor_prev_key=get(g:, 'multi_cursor_prev_key', '') - let g:multi_cursor_skip_key=get(g:, 'multi_cursor_skip_key', '') - let g:multi_cursor_quit_key=get(g:, 'multi_cursor_quit_key', '') - let g:user_emmet_install_global = 0 - let g:user_emmet_leader_key=get(g:, 'user_emmet_leader_key', '') - let g:user_emmet_mode='a' - let g:user_emmet_settings = { - \ 'jsp' : { - \ 'extends' : 'html', - \ }, - \} - "noremap (wildfire-fuel) - vnoremap (wildfire-water) - let g:wildfire_objects = ["i'", 'i"', 'i)', 'i]', 'i}', 'ip', 'it'] + let g:multi_cursor_next_key=get(g:, 'multi_cursor_next_key', '') + let g:multi_cursor_prev_key=get(g:, 'multi_cursor_prev_key', '') + let g:multi_cursor_skip_key=get(g:, 'multi_cursor_skip_key', '') + let g:multi_cursor_quit_key=get(g:, 'multi_cursor_quit_key', '') + let g:user_emmet_install_global = 0 + let g:user_emmet_leader_key=get(g:, 'user_emmet_leader_key', '') + let g:user_emmet_mode='a' + let g:user_emmet_settings = { + \ 'jsp' : { + \ 'extends' : 'html', + \ }, + \} + "noremap (wildfire-fuel) + vnoremap (wildfire-water) + let g:wildfire_objects = ["i'", 'i"', 'i)', 'i]', 'i}', 'ip', 'it'] " osyo-manga/vim-jplus {{{ nmap J (jplus) vmap J (jplus) " }}} - let g:_spacevim_mappings_space.x = {'name' : '+Text'} - let g:_spacevim_mappings_space.x.a = {'name' : '+align'} - let g:_spacevim_mappings_space.x.d = {'name' : '+delete'} - let g:_spacevim_mappings_space.x.i = {'name' : '+change symbol style'} - nnoremap CountSelectionRegion :call count_selection_region() - xnoremap CountSelectionRegion :call count_selection_region() - call SpaceVim#mapping#space#def('nmap', ['x', 'c'], 'CountSelectionRegion', 'count in the selection region', 0, 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '&'], 'Tabularize /&', 'align region at &', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '('], 'Tabularize /(', 'align region at (', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ')'], 'Tabularize /)', 'align region at )', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '['], 'Tabularize /[', 'align region at [', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ']'], 'Tabularize /]', 'align region at ]', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '{'], 'Tabularize /{', 'align region at {', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '}'], 'Tabularize /}', 'align region at }', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ','], 'Tabularize /,', 'align region at ,', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '.'], 'Tabularize /.', 'align region at .', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ':'], 'Tabularize /:', 'align region at :', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ';'], 'Tabularize /;', 'align region at ;', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '='], 'Tabularize /=', 'align region at =', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '¦'], 'Tabularize /¦', 'align region at ¦', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'd', 'w'], 'StripWhitespace', 'delete trailing whitespaces', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'd', '[SPC]'], 'silent call call(' - \ . string(s:_function('s:delete_extra_space')) . ', [])', - \ 'delete extra space arround cursor', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'c'], 'silent call call(' - \ . string(s:_function('s:lowerCamelCase')) . ', [])', - \ 'change symbol style to lowerCamelCase', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'C'], 'silent call call(' - \ . string(s:_function('s:UpperCamelCase')) . ', [])', - \ 'change symbol style to UpperCamelCase', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', '_'], 'silent call call(' - \ . string(s:_function('s:under_score')) . ', [])', - \ 'change symbol style to under_score', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'u'], 'silent call call(' - \ . string(s:_function('s:under_score')) . ', [])', - \ 'change symbol style to under_score', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'U'], 'silent call call(' - \ . string(s:_function('s:up_case')) . ', [])', - \ 'change symbol style to UP_CACE', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'k'], 'silent call call(' - \ . string(s:_function('s:kebab_case')) . ', [])', - \ 'change symbol style to kebab-case', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', '-'], 'silent call call(' - \ . string(s:_function('s:kebab_case')) . ', [])', - \ 'change symbol style to kebab-case', 1) + let g:_spacevim_mappings_space.x = {'name' : '+Text'} + let g:_spacevim_mappings_space.x.a = {'name' : '+align'} + let g:_spacevim_mappings_space.x.d = {'name' : '+delete'} + let g:_spacevim_mappings_space.x.i = {'name' : '+change symbol style'} + nnoremap CountSelectionRegion :call count_selection_region() + xnoremap CountSelectionRegion :call count_selection_region() + call SpaceVim#mapping#space#def('nmap', ['x', 'c'], 'CountSelectionRegion', 'count in the selection region', 0, 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '&'], 'Tabularize /&', 'align region at &', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '('], 'Tabularize /(', 'align region at (', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ')'], 'Tabularize /)', 'align region at )', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '['], 'Tabularize /[', 'align region at [', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ']'], 'Tabularize /]', 'align region at ]', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '{'], 'Tabularize /{', 'align region at {', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '}'], 'Tabularize /}', 'align region at }', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ','], 'Tabularize /,', 'align region at ,', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '.'], 'Tabularize /.', 'align region at .', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ':'], 'Tabularize /:', 'align region at :', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', ';'], 'Tabularize /;', 'align region at ;', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '='], 'Tabularize /=', 'align region at =', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'a', '¦'], 'Tabularize /¦', 'align region at ¦', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'd', 'w'], 'StripWhitespace', 'delete trailing whitespaces', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'd', '[SPC]'], 'silent call call(' + \ . string(s:_function('s:delete_extra_space')) . ', [])', + \ 'delete extra space arround cursor', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'c'], 'silent call call(' + \ . string(s:_function('s:lowerCamelCase')) . ', [])', + \ 'change symbol style to lowerCamelCase', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'C'], 'silent call call(' + \ . string(s:_function('s:UpperCamelCase')) . ', [])', + \ 'change symbol style to UpperCamelCase', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', '_'], 'silent call call(' + \ . string(s:_function('s:under_score')) . ', [])', + \ 'change symbol style to under_score', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'u'], 'silent call call(' + \ . string(s:_function('s:under_score')) . ', [])', + \ 'change symbol style to under_score', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'U'], 'silent call call(' + \ . string(s:_function('s:up_case')) . ', [])', + \ 'change symbol style to UP_CACE', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', 'k'], 'silent call call(' + \ . string(s:_function('s:kebab_case')) . ', [])', + \ 'change symbol style to kebab-case', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'i', '-'], 'silent call call(' + \ . string(s:_function('s:kebab_case')) . ', [])', + \ 'change symbol style to kebab-case', 1) - let g:_spacevim_mappings_space.i = {'name' : '+Insertion'} - let g:_spacevim_mappings_space.i.l = {'name' : '+Lorem-ipsum'} - let g:_spacevim_mappings_space.i.p = {'name' : '+Passwords'} - let g:_spacevim_mappings_space.i.U = {'name' : '+UUID'} - call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 1], 'call call(' - \ . string(s:_function('s:insert_simple_password')) . ', [])', - \ 'insert simple password', 1) - call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 2], 'call call(' - \ . string(s:_function('s:insert_stronger_password')) . ', [])', - \ 'insert stronger password', 1) - call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 3], 'call call(' - \ . string(s:_function('s:insert_paranoid_password')) . ', [])', - \ 'insert password for paranoids', 1) - call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 'p'], 'call call(' - \ . string(s:_function('s:insert_phonetically_password')) . ', [])', - \ 'insert a phonetically easy password', 1) - call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 'n'], 'call call(' - \ . string(s:_function('s:insert_numerical_password')) . ', [])', - \ 'insert a numerical password', 1) - call SpaceVim#mapping#space#def('nnoremap', ['i', 'u'], 'Unite unicode', 'search and insert unicode', 1) - call SpaceVim#mapping#space#def('nnoremap', ['i', 'U', 'U'], 'call call(' - \ . string(s:_function('s:uuidgen_U')) . ', [])', - \ 'uuidgen-4', 1) - call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 'l'], 'call call(' - \ . string(s:_function('s:insert_lorem_ipsum_list')) . ', [])', - \ 'insert lorem-ipsum list', 1) - call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 'p'], 'call call(' - \ . string(s:_function('s:insert_lorem_ipsum_paragraph')) . ', [])', - \ 'insert lorem-ipsum paragraph', 1) - call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 's'], 'call call(' - \ . string(s:_function('s:insert_lorem_ipsum_sentence')) . ', [])', - \ 'insert lorem-ipsum sentence', 1) - let g:_spacevim_mappings_space.x.g = {'name' : '+translate'} - call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Ydc', 'translate current word', 1) + let g:_spacevim_mappings_space.i = {'name' : '+Insertion'} + let g:_spacevim_mappings_space.i.l = {'name' : '+Lorem-ipsum'} + let g:_spacevim_mappings_space.i.p = {'name' : '+Passwords'} + let g:_spacevim_mappings_space.i.U = {'name' : '+UUID'} + call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 1], 'call call(' + \ . string(s:_function('s:insert_simple_password')) . ', [])', + \ 'insert simple password', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 2], 'call call(' + \ . string(s:_function('s:insert_stronger_password')) . ', [])', + \ 'insert stronger password', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 3], 'call call(' + \ . string(s:_function('s:insert_paranoid_password')) . ', [])', + \ 'insert password for paranoids', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 'p'], 'call call(' + \ . string(s:_function('s:insert_phonetically_password')) . ', [])', + \ 'insert a phonetically easy password', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 'p', 'n'], 'call call(' + \ . string(s:_function('s:insert_numerical_password')) . ', [])', + \ 'insert a numerical password', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 'u'], 'Unite unicode', 'search and insert unicode', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 'U', 'U'], 'call call(' + \ . string(s:_function('s:uuidgen_U')) . ', [])', + \ 'uuidgen-4', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 'l'], 'call call(' + \ . string(s:_function('s:insert_lorem_ipsum_list')) . ', [])', + \ 'insert lorem-ipsum list', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 'p'], 'call call(' + \ . string(s:_function('s:insert_lorem_ipsum_paragraph')) . ', [])', + \ 'insert lorem-ipsum paragraph', 1) + call SpaceVim#mapping#space#def('nnoremap', ['i', 'l', 's'], 'call call(' + \ . string(s:_function('s:insert_lorem_ipsum_sentence')) . ', [])', + \ 'insert lorem-ipsum sentence', 1) + let g:_spacevim_mappings_space.x.g = {'name' : '+translate'} + call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Ydc', 'translate current word', 1) - " move line - call SpaceVim#mapping#space#def('nnoremap', ['x', 'J'], 'call call(' - \ . string(s:_function('s:move_text_down_transient_state')) . ', [])', - \ 'move text down(enter transient state)', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 'K'], 'call call(' - \ . string(s:_function('s:move_text_up_transient_state')) . ', [])', - \ 'move text up(enter transient state)', 1) + " move line + call SpaceVim#mapping#space#def('nnoremap', ['x', 'J'], 'call call(' + \ . string(s:_function('s:move_text_down_transient_state')) . ', [])', + \ 'move text down(enter transient state)', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'K'], 'call call(' + \ . string(s:_function('s:move_text_up_transient_state')) . ', [])', + \ 'move text up(enter transient state)', 1) - " transpose - let g:_spacevim_mappings_space.x.t = {'name' : '+transpose'} - call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'c'], 'call call(' - \ . string(s:_function('s:transpose_with_previous')) . ', ["character"])', - \ 'swap current character with previous one', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'w'], 'call call(' - \ . string(s:_function('s:transpose_with_previous')) . ', ["word"])', - \ 'swap current word with previous one', 1) - call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'l'], 'call call(' - \ . string(s:_function('s:transpose_with_previous')) . ', ["line"])', - \ 'swap current line with previous one', 1) + " transpose + let g:_spacevim_mappings_space.x.t = {'name' : '+transpose'} + call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'c'], 'call call(' + \ . string(s:_function('s:transpose_with_previous')) . ', ["character"])', + \ 'swap current character with previous one', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'w'], 'call call(' + \ . string(s:_function('s:transpose_with_previous')) . ', ["word"])', + \ 'swap current word with previous one', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'l'], 'call call(' + \ . string(s:_function('s:transpose_with_previous')) . ', ["line"])', + \ 'swap current line with previous one', 1) endfunction function! s:transpose_with_previous(type) abort - if a:type ==# 'line' - if line('.') > 1 - normal! kddp - endif - elseif a:type ==# 'word' - let save_register = @k - normal! "kyiw - let cw = @k - normal! ge"kyiw - let tw = @k - if cw !=# tw - let @k = cw - normal! viw"kp - let @k = tw - normal! eviw"kp - endif - let @k =save_register - elseif a:type ==# 'character' - if col('.') > 1 - let save_register_k = @k - let save_register_m = @m - normal! v"kyhv"myv"kplv"mp - let @k =save_register_k - let @m =save_register_m - endif + if a:type ==# 'line' + if line('.') > 1 + normal! kddp endif + elseif a:type ==# 'word' + let save_register = @k + normal! "kyiw + let cw = @k + normal! ge"kyiw + let tw = @k + if cw !=# tw + let @k = cw + normal! viw"kp + let @k = tw + normal! eviw"kp + endif + let @k =save_register + elseif a:type ==# 'character' + if col('.') > 1 + let save_register_k = @k + let save_register_m = @m + normal! v"kyhv"myv"kplv"mp + let @k =save_register_k + let @m =save_register_m + endif + endif endfunction function! s:move_text_down_transient_state() abort + if line('.') == line('$') + else normal! ddp - call s:text_transient_state() + endif + call s:text_transient_state() endfunction function! s:move_text_up_transient_state() abort + if line('.') == 1 + else normal! ddkP - call s:text_transient_state() + endif + call s:text_transient_state() endfunction function! s:text_transient_state() abort - let state = SpaceVim#api#import('transient_state') - call state.set_title('Move Text Transient State') - call state.defind_keys( - \ { - \ 'layout' : 'vertical split', - \ 'left' : [ - \ { - \ 'key' : 'J', - \ 'desc' : 'move text down', - \ 'func' : '', - \ 'cmd' : 'normal! "_ddp', - \ 'exit' : 0, - \ }, - \ ], - \ 'right' : [ - \ { - \ 'key' : 'K', - \ 'desc' : 'move text up', - \ 'func' : '', - \ 'cmd' : 'normal! "_ddkP', - \ 'exit' : 0, - \ }, - \ ], - \ } - \ ) - call state.open() + let state = SpaceVim#api#import('transient_state') + call state.set_title('Move Text Transient State') + call state.defind_keys( + \ { + \ 'layout' : 'vertical split', + \ 'left' : [ + \ { + \ 'key' : 'J', + \ 'desc' : 'move text down', + \ 'func' : '', + \ 'cmd' : 'normal! "_ddp', + \ 'exit' : 0, + \ }, + \ ], + \ 'right' : [ + \ { + \ 'key' : 'K', + \ 'func' : '', + \ 'desc' : 'move text up', + \ 'cmd' : 'exe line(".") == 1 ? "" : "normal! \"_ddkP"', + \ 'exit' : 0, + \ }, + \ ], + \ } + \ ) + call state.open() endfunction function! s:lowerCamelCase() abort - " fooFzz - let cword = s:parse_symbol(expand('')) - if !empty(cword) - let rst = [cword[0]] - if len(cword) > 1 - let rst += map(cword[1:], "substitute(v:val, '^.', '\\u&', 'g')") - endif - let save_register = @k - let save_cursor = getcurpos() - let @k = join(rst, '') - normal! viw"kp - call setpos('.', save_cursor) - let @k = save_register + " fooFzz + let cword = s:parse_symbol(expand('')) + if !empty(cword) + let rst = [cword[0]] + if len(cword) > 1 + let rst += map(cword[1:], "substitute(v:val, '^.', '\\u&', 'g')") endif + let save_register = @k + let save_cursor = getcurpos() + let @k = join(rst, '') + normal! viw"kp + call setpos('.', save_cursor) + let @k = save_register + endif endfunction function! s:UpperCamelCase() abort - " FooFzz - let cword = s:parse_symbol(expand('')) - if !empty(cword) - let rst = map(cword, "substitute(v:val, '^.', '\\u&', 'g')") - let save_register = @k - let save_cursor = getcurpos() - let @k = join(rst, '') - normal! viw"kp - call setpos('.', save_cursor) - let @k = save_register - endif + " FooFzz + let cword = s:parse_symbol(expand('')) + if !empty(cword) + let rst = map(cword, "substitute(v:val, '^.', '\\u&', 'g')") + let save_register = @k + let save_cursor = getcurpos() + let @k = join(rst, '') + normal! viw"kp + call setpos('.', save_cursor) + let @k = save_register + endif endfunction function! s:kebab_case() abort - " foo-fzz - let cword = s:parse_symbol(expand('')) - if !empty(cword) - let save_register = @k - let save_cursor = getcurpos() - let @k = join(cword, '-') - normal! viw"kp - call setpos('.', save_cursor) - let @k = save_register - endif + " foo-fzz + let cword = s:parse_symbol(expand('')) + if !empty(cword) + let save_register = @k + let save_cursor = getcurpos() + let @k = join(cword, '-') + normal! viw"kp + call setpos('.', save_cursor) + let @k = save_register + endif endfunction function! s:under_score() abort - " foo_fzz - let cword = s:parse_symbol(expand('')) - if !empty(cword) - let save_register = @k - let save_cursor = getcurpos() - let @k = join(cword, '_') - normal! viw"kp - call setpos('.', save_cursor) - let @k = save_register - endif + " foo_fzz + let cword = s:parse_symbol(expand('')) + if !empty(cword) + let save_register = @k + let save_cursor = getcurpos() + let @k = join(cword, '_') + normal! viw"kp + call setpos('.', save_cursor) + let @k = save_register + endif endfunction function! s:up_case() abort - " FOO_FZZ - let cword =map(s:parse_symbol(expand('')), 'toupper(v:val)') - if !empty(cword) - let save_register = @k - let save_cursor = getcurpos() - let @k = join(cword, '_') - normal! viw"kp - call setpos('.', save_cursor) - let @k = save_register - endif + " FOO_FZZ + let cword =map(s:parse_symbol(expand('')), 'toupper(v:val)') + if !empty(cword) + let save_register = @k + let save_cursor = getcurpos() + let @k = join(cword, '_') + normal! viw"kp + call setpos('.', save_cursor) + let @k = save_register + endif endfunction let s:STRING = SpaceVim#api#import('data#string') function! s:parse_symbol(symbol) abort - if a:symbol =~# '^[a-z]\+\(-[a-zA-Z]\+\)*$' - return split(a:symbol, '-') - elseif a:symbol =~# '^[a-z]\+\(_[a-zA-Z]\+\)*$' - return split(a:symbol, '_') - elseif a:symbol =~# '^[a-z]\+\([A-Z][a-z]\+\)*$' - let chars = s:STRING.string2chars(a:symbol) - let rst = [] - let word = '' - for char in chars - if char =~# '[a-z]' - let word .= char - else - call add(rst, tolower(word)) - let word = char - endif - endfor + if a:symbol =~# '^[a-z]\+\(-[a-zA-Z]\+\)*$' + return split(a:symbol, '-') + elseif a:symbol =~# '^[a-z]\+\(_[a-zA-Z]\+\)*$' + return split(a:symbol, '_') + elseif a:symbol =~# '^[a-z]\+\([A-Z][a-z]\+\)*$' + let chars = s:STRING.string2chars(a:symbol) + let rst = [] + let word = '' + for char in chars + if char =~# '[a-z]' + let word .= char + else call add(rst, tolower(word)) - return rst - elseif a:symbol =~# '^[A-Z][a-z]\+\([A-Z][a-z]\+\)*$' - let chars = s:STRING.string2chars(a:symbol) - let rst = [] - let word = '' - for char in chars - if char =~# '[a-z]' - let word .= char - else - if !empty(word) - call add(rst, tolower(word)) - endif - let word = char - endif - endfor - call add(rst, tolower(word)) - return rst - else - return [a:symbol] - endif + let word = char + endif + endfor + call add(rst, tolower(word)) + return rst + elseif a:symbol =~# '^[A-Z][a-z]\+\([A-Z][a-z]\+\)*$' + let chars = s:STRING.string2chars(a:symbol) + let rst = [] + let word = '' + for char in chars + if char =~# '[a-z]' + let word .= char + else + if !empty(word) + call add(rst, tolower(word)) + endif + let word = char + endif + endfor + call add(rst, tolower(word)) + return rst + else + return [a:symbol] + endif endfunction function! s:count_selection_region() abort - call feedkeys("gvg\\", 'ti') + call feedkeys("gvg\\", 'ti') endfunction function! s:delete_extra_space() abort - if !empty(getline('.')) - if getline('.')[col('.')-1] ==# ' ' - exe "normal! viw\"_di\\" - endif + if !empty(getline('.')) + if getline('.')[col('.')-1] ==# ' ' + exe "normal! viw\"_di\\" endif + endif endfunction let s:local_lorem_ipsum = [ - \ 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.', - \ 'Donec hendrerit tempor tellus.', - \ 'Donec pretium posuere tellus.', - \ 'Proin quam nisl, tincidunt et, mattis eget, convallis nec, purus.', - \ 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.', - \ 'Nulla posuere.', - \ 'Donec vitae dolor.', - \ 'Nullam tristique diam non turpis.', - \ 'Cras placerat accumsan nulla.', - \ 'Nullam rutrum.', - \ 'Nam vestibulum accumsan nisl.', - \ 'Pellentesque dapibus suscipit ligula.', - \ 'Donec posuere augue in quam.', - \ 'Etiam vel tortor sodales tellus ultricies commodo.', - \ 'Suspendisse potenti.', - \ 'Aenean in sem ac leo mollis blandit.', - \ 'Donec neque quam, dignissim in, mollis nec, sagittis eu, wisi.', - \ 'Phasellus lacus.', - \ 'Etiam laoreet quam sed arcu.', - \ 'Phasellus at dui in ligula mollis ultricies.', - \ 'Integer placerat tristique nisl.', - \ 'Praesent augue.', - \ 'Fusce commodo.', - \ 'Vestibulum convallis, lorem a tempus semper, dui dui euismod elit, vitae placerat urna tortor vitae lacus.', - \ 'Nullam libero mauris, consequat quis, varius et, dictum id, arcu.', - \ 'Mauris mollis tincidunt felis.', - \ 'Aliquam feugiat tellus ut neque.', - \ 'Nulla facilisis, risus a rhoncus fermentum, tellus tellus lacinia purus, et dictum nunc justo sit amet elit.', - \ 'Aliquam erat volutpat.', - \ 'Nunc eleifend leo vitae magna.', - \ 'In id erat non orci commodo lobortis.', - \ 'Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus.', - \ 'Sed diam.', - \ 'Praesent fermentum tempor tellus.', - \ 'Nullam tempus.', - \ 'Mauris ac felis vel velit tristique imperdiet.', - \ 'Donec at pede.', - \ 'Etiam vel neque nec dui dignissim bibendum.', - \ 'Vivamus id enim.', - \ 'Phasellus neque orci, porta a, aliquet quis, semper a, massa.', - \ 'Phasellus purus.', - \ 'Pellentesque tristique imperdiet tortor.', - \ 'Nam euismod tellus id erat.', - \ 'Nullam eu ante vel est convallis dignissim.', - \ 'Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo, quis tempor ligula erat quis odio.', - \ 'Nunc porta vulputate tellus.', - \ 'Nunc rutrum turpis sed pede.', - \ 'Sed bibendum.', - \ 'Aliquam posuere.', - \ 'Nunc aliquet, augue nec adipiscing interdum, lacus tellus malesuada massa, quis varius mi purus non odio.', - \ 'Pellentesque condimentum, magna ut suscipit hendrerit, ipsum augue ornare nulla, non luctus diam neque sit amet urna.', - \ 'Curabitur vulputate vestibulum lorem.', - \ 'Fusce sagittis, libero non molestie mollis, magna orci ultrices dolor, at vulputate neque nulla lacinia eros.', - \ 'Sed id ligula quis est convallis tempor.', - \ 'Curabitur lacinia pulvinar nibh.', - \ 'Nam a sapien.', - \ ] + \ 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.', + \ 'Donec hendrerit tempor tellus.', + \ 'Donec pretium posuere tellus.', + \ 'Proin quam nisl, tincidunt et, mattis eget, convallis nec, purus.', + \ 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.', + \ 'Nulla posuere.', + \ 'Donec vitae dolor.', + \ 'Nullam tristique diam non turpis.', + \ 'Cras placerat accumsan nulla.', + \ 'Nullam rutrum.', + \ 'Nam vestibulum accumsan nisl.', + \ 'Pellentesque dapibus suscipit ligula.', + \ 'Donec posuere augue in quam.', + \ 'Etiam vel tortor sodales tellus ultricies commodo.', + \ 'Suspendisse potenti.', + \ 'Aenean in sem ac leo mollis blandit.', + \ 'Donec neque quam, dignissim in, mollis nec, sagittis eu, wisi.', + \ 'Phasellus lacus.', + \ 'Etiam laoreet quam sed arcu.', + \ 'Phasellus at dui in ligula mollis ultricies.', + \ 'Integer placerat tristique nisl.', + \ 'Praesent augue.', + \ 'Fusce commodo.', + \ 'Vestibulum convallis, lorem a tempus semper, dui dui euismod elit, vitae placerat urna tortor vitae lacus.', + \ 'Nullam libero mauris, consequat quis, varius et, dictum id, arcu.', + \ 'Mauris mollis tincidunt felis.', + \ 'Aliquam feugiat tellus ut neque.', + \ 'Nulla facilisis, risus a rhoncus fermentum, tellus tellus lacinia purus, et dictum nunc justo sit amet elit.', + \ 'Aliquam erat volutpat.', + \ 'Nunc eleifend leo vitae magna.', + \ 'In id erat non orci commodo lobortis.', + \ 'Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus.', + \ 'Sed diam.', + \ 'Praesent fermentum tempor tellus.', + \ 'Nullam tempus.', + \ 'Mauris ac felis vel velit tristique imperdiet.', + \ 'Donec at pede.', + \ 'Etiam vel neque nec dui dignissim bibendum.', + \ 'Vivamus id enim.', + \ 'Phasellus neque orci, porta a, aliquet quis, semper a, massa.', + \ 'Phasellus purus.', + \ 'Pellentesque tristique imperdiet tortor.', + \ 'Nam euismod tellus id erat.', + \ 'Nullam eu ante vel est convallis dignissim.', + \ 'Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo, quis tempor ligula erat quis odio.', + \ 'Nunc porta vulputate tellus.', + \ 'Nunc rutrum turpis sed pede.', + \ 'Sed bibendum.', + \ 'Aliquam posuere.', + \ 'Nunc aliquet, augue nec adipiscing interdum, lacus tellus malesuada massa, quis varius mi purus non odio.', + \ 'Pellentesque condimentum, magna ut suscipit hendrerit, ipsum augue ornare nulla, non luctus diam neque sit amet urna.', + \ 'Curabitur vulputate vestibulum lorem.', + \ 'Fusce sagittis, libero non molestie mollis, magna orci ultrices dolor, at vulputate neque nulla lacinia eros.', + \ 'Sed id ligula quis est convallis tempor.', + \ 'Curabitur lacinia pulvinar nibh.', + \ 'Nam a sapien.', + \ ] let s:lorem_ipsum_paragraph_separator = "\n\n" let s:lorem_ipsum_sentence_separator = ' ' @@ -413,93 +419,93 @@ let s:lorem_ipsum_list_item_end = "\n" let s:lorem_ipsum_list_end = '' function! s:insert_lorem_ipsum_list() abort - let save_register = @k - let @k = '* ' . s:local_lorem_ipsum[s:NUMBER.random(0, len(s:local_lorem_ipsum))] . "\n" - normal! "kgP - let @k = save_register + let save_register = @k + let @k = '* ' . s:local_lorem_ipsum[s:NUMBER.random(0, len(s:local_lorem_ipsum))] . "\n" + normal! "kgP + let @k = save_register endfunction function! s:insert_lorem_ipsum_paragraph() abort - let save_register = @k - let pids = len(s:local_lorem_ipsum) / 11 - let pid = s:NUMBER.random(0, pids) * 11 - let @k = join(s:LIST.listpart(s:local_lorem_ipsum, pid, 11), s:lorem_ipsum_sentence_separator) . s:lorem_ipsum_paragraph_separator - normal! "kgP - let @k = save_register + let save_register = @k + let pids = len(s:local_lorem_ipsum) / 11 + let pid = s:NUMBER.random(0, pids) * 11 + let @k = join(s:LIST.listpart(s:local_lorem_ipsum, pid, 11), s:lorem_ipsum_sentence_separator) . s:lorem_ipsum_paragraph_separator + normal! "kgP + let @k = save_register endfunction function! s:insert_lorem_ipsum_sentence() abort - let save_register = @k - let @k = s:local_lorem_ipsum[s:NUMBER.random(0, len(s:local_lorem_ipsum))] . s:lorem_ipsum_sentence_separator - normal! "kgP - let @k = save_register + let save_register = @k + let @k = s:local_lorem_ipsum[s:NUMBER.random(0, len(s:local_lorem_ipsum))] . s:lorem_ipsum_sentence_separator + normal! "kgP + let @k = save_register endfunction function! s:insert_simple_password() abort - let save_register = @k - let @k = s:PASSWORD.generate_simple(8) - normal! "kPl - let @k = save_register + let save_register = @k + let @k = s:PASSWORD.generate_simple(8) + normal! "kPl + let @k = save_register endfunction function! s:insert_stronger_password() abort - let save_register = @k - let @k = s:PASSWORD.generate_strong(12) - normal! "kPl - let @k = save_register + let save_register = @k + let @k = s:PASSWORD.generate_strong(12) + normal! "kPl + let @k = save_register endfunction function! s:insert_paranoid_password() abort - let save_register = @k - let @k = s:PASSWORD.generate_paranoid(20) - normal! "kPl - let @k = save_register + let save_register = @k + let @k = s:PASSWORD.generate_paranoid(20) + normal! "kPl + let @k = save_register endfunction function! s:insert_numerical_password() abort - let save_register = @k - let @k = s:PASSWORD.generate_numeric(4) - normal! "kPl - let @k = save_register + let save_register = @k + let @k = s:PASSWORD.generate_numeric(4) + normal! "kPl + let @k = save_register endfunction function! s:insert_phonetically_password() abort - let save_register = @k - let @k = s:PASSWORD.generate_phonetic(8) - normal! "kPl - let @k = save_register + let save_register = @k + let @k = s:PASSWORD.generate_phonetic(8) + normal! "kPl + let @k = save_register endfunction function! s:uuidgen_U() abort - let uuid = system('uuidgen') - let save_register = @k - let @k = uuid - normal! "kPl - let @k = save_register + let uuid = system('uuidgen') + let save_register = @k + let @k = uuid + normal! "kPl + let @k = save_register endfunction " function() wrapper if v:version > 703 || v:version == 703 && has('patch1170') - function! s:_function(fstr) abort - return function(a:fstr) - endfunction + function! s:_function(fstr) abort + return function(a:fstr) + endfunction else - function! s:_SID() abort - return matchstr(expand(''), '\zs\d\+\ze__SID$') - endfunction - let s:_s = '' . s:_SID() . '_' - function! s:_function(fstr) abort - return function(substitute(a:fstr, 's:', s:_s, 'g')) - endfunction + function! s:_SID() abort + return matchstr(expand(''), '\zs\d\+\ze__SID$') + endfunction + let s:_s = '' . s:_SID() . '_' + function! s:_function(fstr) abort + return function(substitute(a:fstr, 's:', s:_s, 'g')) + endfunction endif augroup spacevim_layer_edit - au! - autocmd BufNewFile *.py call add_buffer_head() + au! + autocmd BufNewFile *.py call add_buffer_head() augroup END let s:ft_head_tp = {} function! s:add_buffer_head() abort - if has_key(s:ft_head_tp, &ft) - call setline(1, s:ft_head_tp[&ft]) - endif + if has_key(s:ft_head_tp, &ft) + call setline(1, s:ft_head_tp[&ft]) + endif endfunction function! SpaceVim#layers#edit#add_ft_head_tamplate(ft, tamp) - call extend(s:ft_head_tp, {a:ft : a:tamp}) + call extend(s:ft_head_tp, {a:ft : a:tamp}) endfunction From db53bbf92ed02babed009639021dc336293be5ef Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 6 Dec 2017 18:14:15 +0800 Subject: [PATCH 72/89] Remove g:wsd --- autoload/SpaceVim/api/transient_state.vim | 1 - autoload/SpaceVim/api/vim/statusline.vim | 1 - autoload/SpaceVim/issue.vim | 1 - autoload/SpaceVim/plugins/runner.vim | 4 ---- 4 files changed, 7 deletions(-) diff --git a/autoload/SpaceVim/api/transient_state.vim b/autoload/SpaceVim/api/transient_state.vim index 10bda30f7..b708a5a51 100644 --- a/autoload/SpaceVim/api/transient_state.vim +++ b/autoload/SpaceVim/api/transient_state.vim @@ -120,7 +120,6 @@ function! s:self._update_content() abort if type(key.key) == 1 " is a string let right_max_key_len = max([len(key.key), right_max_key_len]) elseif type(key.key) == 3 " is a list - let g:wsd = key.key let right_max_key_len = max([len(join(key.key, '/')), right_max_key_len]) elseif type(key.key) == 4 " is a dict let right_max_key_len = max([len(key.key.name), right_max_key_len]) diff --git a/autoload/SpaceVim/api/vim/statusline.vim b/autoload/SpaceVim/api/vim/statusline.vim index e75f8abe2..f09628452 100644 --- a/autoload/SpaceVim/api/vim/statusline.vim +++ b/autoload/SpaceVim/api/vim/statusline.vim @@ -5,7 +5,6 @@ function! s:self.check_width(len, sec, winwidth) abort return a:len + self.len(a:sec) < a:winwidth endfunction -let g:wsd = '%{" " . g:_spacevim_statusline_fileformat . " | " . (&fenc!=""?&fenc:&enc) . " "}' function! s:self.len(sec) abort let str = matchstr(a:sec, '%{.*}') if !empty(str) diff --git a/autoload/SpaceVim/issue.vim b/autoload/SpaceVim/issue.vim index 4ba569065..812afbcf0 100644 --- a/autoload/SpaceVim/issue.vim +++ b/autoload/SpaceVim/issue.vim @@ -45,7 +45,6 @@ function! SpaceVim#issue#new() \ 'body' : join(getline(1, '$'), "\n"), \ } let response = github#api#issues#Create('SpaceVim', 'SpaceVim', username, password, issue) - let g:wsd = response if has_key(response, 'html_url') echo 'Issue created done: ' . response.html_url else diff --git a/autoload/SpaceVim/plugins/runner.vim b/autoload/SpaceVim/plugins/runner.vim index 3bd344d41..51c026ff7 100644 --- a/autoload/SpaceVim/plugins/runner.vim +++ b/autoload/SpaceVim/plugins/runner.vim @@ -104,7 +104,6 @@ endfunction " @vimlint(EVL103, 1, a:data) " @vimlint(EVL103, 1, a:event) -let g:wsd = [] if has('nvim') && exists('*chanclose') let s:_out_data = [''] function! s:on_stdout(job_id, data, event) abort @@ -117,7 +116,6 @@ if has('nvim') && exists('*chanclose') let lines = s:_out_data endif if !empty(lines) - call add(g:wsd, lines) call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines) endif let s:lines += len(lines) @@ -136,7 +134,6 @@ if has('nvim') && exists('*chanclose') let lines = s:_out_data endif if !empty(lines) - call add(g:wsd, lines) call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines) endif let s:lines += len(lines) @@ -145,7 +142,6 @@ if has('nvim') && exists('*chanclose') endfunction else function! s:on_stdout(job_id, data, event) abort - call add(g:wsd, a:data) call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, a:data) let s:lines += len(a:data) call s:update_statusline() From e07ad4d74ac6391a598856b6ed24ecdd0b0aa935 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 6 Dec 2017 18:15:55 +0800 Subject: [PATCH 73/89] Improve #1056 --- autoload/SpaceVim/layers/edit.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index e71a92e96..8d73a74fe 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -211,7 +211,7 @@ function! s:text_transient_state() abort \ 'key' : 'J', \ 'desc' : 'move text down', \ 'func' : '', - \ 'cmd' : 'normal! "_ddp', + \ 'cmd' : 'noautocmd normal! "_ddp', \ 'exit' : 0, \ }, \ ], @@ -220,7 +220,7 @@ function! s:text_transient_state() abort \ 'key' : 'K', \ 'func' : '', \ 'desc' : 'move text up', - \ 'cmd' : 'exe line(".") == 1 ? "" : "normal! \"_ddkP"', + \ 'cmd' : 'noautocmd exe line(".") == 1 ? "" : "normal! \"_ddkP"', \ 'exit' : 0, \ }, \ ], From 075210ae229020dadebba324134e55c0c9b7c109 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 6 Dec 2017 19:48:25 +0800 Subject: [PATCH 74/89] Fix website title --- docs/_layouts/default.html | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index b5dea63e3..ab18ab86c 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -40,7 +40,6 @@ - {{ page.title | default: Home }} - SpaceVim From e49787ecf0e6f34957d5dd5c7ed43fbe17f83558 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Wed, 6 Dec 2017 20:20:04 +0800 Subject: [PATCH 75/89] Update desc for colorscheme layer page --- docs/layers/colorscheme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/layers/colorscheme.md b/docs/layers/colorscheme.md index 78cc297fb..be8f6f66c 100644 --- a/docs/layers/colorscheme.md +++ b/docs/layers/colorscheme.md @@ -1,6 +1,6 @@ --- title: "SpaceVim colorscheme layer" -description: "This layers adds extensive support for git" +description: "colorscheme provides a list of colorscheme for SpaceVim, default colorscheme is gruvbox with dark theme." --- # [SpaceVim Layers:](https://spacevim.org/layers) colorscheme From 8b84e4959a542fba3aa7692e26d8fcc9ff4ae029 Mon Sep 17 00:00:00 2001 From: Fabio Gibson Date: Wed, 6 Dec 2017 11:58:33 -0200 Subject: [PATCH 76/89] eclosing ignore patterns for ag searcher --- autoload/zvim/util.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/zvim/util.vim b/autoload/zvim/util.vim index 7be33f3cb..abc0df5cc 100644 --- a/autoload/zvim/util.vim +++ b/autoload/zvim/util.vim @@ -277,7 +277,7 @@ fu! zvim#util#Generate_ignore(ignore,tool, ...) abort if a:tool ==# 'ag' for ig in split(a:ignore,',') call add(ignore, '--ignore') - call add(ignore, ig ) + call add(ignore, "'" . ig . "'") endfor elseif a:tool ==# 'rg' for ig in split(a:ignore,',') From 8ad33a19b84fe01593bb94c3c6aa8cd8cac754da Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Thu, 7 Dec 2017 20:54:47 +0800 Subject: [PATCH 77/89] Add chat config --- autoload/SpaceVim/layers/chat.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autoload/SpaceVim/layers/chat.vim b/autoload/SpaceVim/layers/chat.vim index 418ef14fb..d4c8d7f59 100644 --- a/autoload/SpaceVim/layers/chat.vim +++ b/autoload/SpaceVim/layers/chat.vim @@ -4,7 +4,14 @@ function! SpaceVim#layers#chat#plugins() abort \ ] endfunction +let s:BASE64 = SpaceVim#api#import('data#base64') function! SpaceVim#layers#chat#config() + let g:chatting_server_ip = s:BASE64.decode('NDUuNzYuMTAwLjQ5') + let g:chatting_server_port = 8989 + if !exists('g:chatting_server_lib') + let g:chatting_server_lib = '/home/wsdjeg/SpaceVim/Chatting-server/target/Chatting-1.0-SNAPSHOT.jar' + endif call SpaceVim#mapping#space#def('nnoremap', ['a', 'q'], 'call chat#qq#start()', 'Start QQ server', 1) + call SpaceVim#mapping#space#def('nnoremap', ['a', 'o'], 'call chat#chatting#OpenMsgWin()', 'open spacevim community', 1) endfunction From 7b4c00e65ab980d1edf39f941b080d631bb661bc Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Thu, 7 Dec 2017 23:19:13 +0800 Subject: [PATCH 78/89] Add post --- ...017-12-07-async-code-runner-in-SpaceVim.md | 15 +++++++++++ docs/about.md | 26 +++++++++++-------- docs/layers/lang/markdown.md | 11 ++++---- docs/layers/lang/python.md | 2 +- docs/sponsors.md | 2 +- 5 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 docs/_posts/2017-12-07-async-code-runner-in-SpaceVim.md diff --git a/docs/_posts/2017-12-07-async-code-runner-in-SpaceVim.md b/docs/_posts/2017-12-07-async-code-runner-in-SpaceVim.md new file mode 100644 index 000000000..cc6b57eaf --- /dev/null +++ b/docs/_posts/2017-12-07-async-code-runner-in-SpaceVim.md @@ -0,0 +1,15 @@ +--- +title: "An async code runner in SpaceVim" +categories: tutorials +excerpt: "A better way for running code with in vim, more info about the command status, will not move cursor from code buffer." +--- + +# [Blogs](https://spacevim.org/community#blogs) > An async code runner in SpaceVim + +when edit code, sometimes I want run current file. as we know vim's build-in feature `:!`, but it is not running asynchronously. + +here is an gif shown how we can run code within SpaceVim. the first line is showing the command, the last line is showing the exit code and the time that has been consumed. the default key binding is `SPC l r`, `SPC` means `` on your keyboard. + +![async code runner](https://user-images.githubusercontent.com/13142418/33722240-141ed716-db2f-11e7-9a4d-c99f05cc1d05.gif) + +as wrote in old blog, we can also use this feature for java, c, php, JavaScript, etc. diff --git a/docs/about.md b/docs/about.md index be6a2c881..e3359b17e 100644 --- a/docs/about.md +++ b/docs/about.md @@ -1,23 +1,27 @@ --- title: "About" -description: "Introduction about SpaceVim organization." +description: "SpaceVim is a communicate driven vim distribution that supports vim and neovim" --- -# About SpaceVim +## Version -[SpaceVim](https://github.com/SpaceVim/SpaceVim) is a Modular configuration, a bundle of custom settings and plugins for Vim, -here we call them layers, each layer has different plugins and config, users just need -to select the layers they need. It got inspired by [spacemacs](https://github.com/syl20bnr/spacemacs). If you use SpaceVim, -please star it on github. It's a great way of getting feedback and gives me the kick to -put more time into development. +[SpaceVim](https://github.com/SpaceVim/SpaceVim) is a community-driven vim distribution that supports vim and Neovim. SpaceVim manages collections of plugins in layers. Layers make it easy for you, the user, to enable a new language or feature by grouping all the related plugins together. It got inspired by spacemacs. -If you encounter any bugs or have feature requests, just open an issue -report on Github. +## Goals -For learning about Vim in general, read [vim-galore](https://github.com/mhinz/vim-galore). +- Provide a consistent user experience across platforms. +- Provide better default layer for defferent languages. -# Credits & Thanks +## Principles +- Do not regress from origin +- Decide outcomes by weighing cost and benefit +- prefer usability over tradition if the benefits are overwhelming +- Give usability a chance™ + +## Credits & Thanks + +- Current maintainer: [Wang Shidong](https://github.com/wsdjeg) - [![GitHub contributors](https://img.shields.io/github/contributors/SpaceVim/SpaceVim.svg)](https://github.com/SpaceVim/SpaceVim/graphs/contributors) - [vimdoc](https://github.com/google/vimdoc) generate doc file for SpaceVim - [Rafael Bodill](https://github.com/rafi) and his vim-config diff --git a/docs/layers/lang/markdown.md b/docs/layers/lang/markdown.md index 6d9e5b698..cd64d3e29 100644 --- a/docs/layers/lang/markdown.md +++ b/docs/layers/lang/markdown.md @@ -1,16 +1,17 @@ --- title: "SpaceVim lang#markdown layer" +description: "Edit markdown within vim, autopreview markdown in the default browser, with this layer you can also format markdown file." --- # [SpaceVim Layers:](https://spacevim.org/layers) lang#markdown -* [Description](#description) -* [Layer Installation](#layer-installation) -* [formatting](#formatting) - * [options](#options) -* [Key bindings](#key-bindings) +- [Description](#description) +- [Layer Installation](#layer-installation) +- [formatting](#formatting) + - [options](#options) +- [Key bindings](#key-bindings) diff --git a/docs/layers/lang/python.md b/docs/layers/lang/python.md index 737745eea..c7e8e40f1 100644 --- a/docs/layers/lang/python.md +++ b/docs/layers/lang/python.md @@ -1,6 +1,6 @@ --- title: "SpaceVim lang#python layer" -description: "This layer is for Python development" +description: "This layer is for Python development, provide autocompletion, syntax checking, code format for python file." --- # [SpaceVim Layers:](https://spacevim.org/layers) lang#python diff --git a/docs/sponsors.md b/docs/sponsors.md index 95b279fdf..b17a9098b 100644 --- a/docs/sponsors.md +++ b/docs/sponsors.md @@ -1,6 +1,6 @@ --- title: "Sponsors" -description: "sponsors page for spacevim" +description: "the companies or individuals contributing a monthly amount to help sustain SpaceVim's development." --- ![Bountysource](https://spacevim.org/img/bountysource.png) From ffcc55c73659c90852ea4c1e45480ace82e6db38 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Fri, 8 Dec 2017 12:47:05 +0800 Subject: [PATCH 79/89] Update default.html --- docs/_layouts/default.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index ab18ab86c..f0f1e82cc 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -9,6 +9,7 @@ enable_page_level_ads: true }); + {% seo %} - - - {% seo %} - - - - + - + - - - - - - - - - - - - + + + - - - - - + + Fork me on GitHub -
+
-
-
-

{{ site.title | default: site.github.repository_name }}

-

{{ site.description | default: site.github.project_tagline }}

-
-

- Home | - About | - Documentation | - Development | - Community | - Sponsors -

-
-
+
+
+

{{ site.title | default: site.github.repository_name }}

+

{{ site.description | default: site.github.project_tagline }}

+
+

+ Home | + About | + Documentation | + Development | + Community | + Sponsors +

+
+
- {{ content }} + {{ content }} -
+
-
+
- {% if site.google_analytics %} - - - {% endif %} - - - -

- Hosted on GitHub — Theme by mattgraham -

-
+ {% if site.google_analytics %} + + + {% endif %} + + + +

+ Hosted on GitHub — Theme by mattgraham +

+
From 194f5bf67e61cad1d58f79ff3fc1d06d1ee10161 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 8 Dec 2017 21:42:15 +0800 Subject: [PATCH 82/89] Fix font size --- docs/_sass/_variables.scss | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/_sass/_variables.scss b/docs/_sass/_variables.scss index 84c5de09e..07346ddee 100644 --- a/docs/_sass/_variables.scss +++ b/docs/_sass/_variables.scss @@ -1,7 +1,7 @@ -$h1-font-size: 3em; -$h2-font-size: 2.75em; -$h3-font-size: 2.5em; -$h4-font-size: 2.25em; -$h5-font-size: 2em; -$h6-font-size: 1.75em; +$h1-font-size: 2em; +$h2-font-size: 1.8em; +$h3-font-size: 1.6em; +$h4-font-size: 1.4em; +$h5-font-size: 1.2em; +$h6-font-size: 1em; From 4abb6c4722dfe975b05a34f19dd705c5fe5e571e Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 9 Dec 2017 13:33:16 +0800 Subject: [PATCH 83/89] Update documents about colorscheme --- docs/development.md | 70 ++++++++++++++---------- docs/development/conventions.md | 96 ++++++++++++++++++++++++--------- docs/documentation.md | 4 ++ 3 files changed, 119 insertions(+), 51 deletions(-) diff --git a/docs/development.md b/docs/development.md index 058bd5d7b..17b37f5aa 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,23 +1,37 @@ --- title: "Development" -description: "A guide for contributing to SpaceVim." +description: "Development information about SpaceVim, including contributing guidelines and changelog." --- # Development + + +- [Contribution guidelines](#contribution-guidelines) + - [Asking for help](#asking-for-help) + - [Reporting issues](#reporting-issues) + - [Contributing code](#contributing-code) + - [License](#license) + - [Conventions](#conventions) + - [Pull Request](#pull-request) + - [Ideally for simple PRs (most of them):](#ideally-for-simple-prs-most-of-them) + - [For complex PRs (big refactoring, etc):](#for-complex-prs-big-refactoring-etc) + - [Contributing a layer](#contributing-a-layer) + - [File header](#file-header) + - [Author of a new layer](#author-of-a-new-layer) + - [Contributor to an existing layer](#contributor-to-an-existing-layer) + - [Contributing a keybinding](#contributing-a-keybinding) + - [Contributing a banner](#contributing-a-banner) + - [Contributing a statusline theme](#contributing-a-statusline-theme) +- [Build with SpaceVim](#build-with-spacevim) +- [Changelog](#changelog) + + + Development happens in the GitHub repository. here is a throughput graph of the repository for the last few weeks: [![Throughput Graph](https://graphs.waffle.io/SpaceVim/SpaceVim/throughput.svg)](https://waffle.io/SpaceVim/SpaceVim/metrics/throughput) -## Content - -- [Contribution guidelines](#contribution-guidelines) - - [Asking for help](#asking-for-help) - - [Reporting issues](#reporting-issues) - - [Contributing code](#contributing-code) -- [Build with SpaceVim](#build-with-spacevim) -- [Changelog](#changelog) - ## Contribution guidelines SpaceVim is an effort of all the volunteers, we encourage you to pitch in. The community makes SpaceVim what it is. @@ -32,12 +46,14 @@ You can only consider reading the sections relevant to what you are going to do: ### Asking for help If you want to ask an usage question, be sure to look first into some places as it may hold the answers: + - :h SpaceVim-faq: Some of the most frequently asked questions are answered there. - [SpaceVim documentation](https://spacevim.org/documentation): It is the general documentation of SpaceVim. ### Reporting issues Issues have to be reported on [issues tracker](https://github.com/SpaceVim/SpaceVim/issues), Please: + - Check that there is no duplicate issue in the issues tracker, you can search for keywords in the issues tracker. - Check that the issue has not been fixed in latest version of SpaceVim, please update your SpaceVim, and try to reproduce the bug here. - Use a clear title and follow the issue template. @@ -50,6 +66,7 @@ Code contributions are welcome. Please read the following sections carefully. In #### License The license is MIT for all the parts of SpaceVim. this includes: + - The initialization and core files - All the layer files. @@ -94,29 +111,27 @@ Write commit messages according to adapted [Tim Pope’s guidelines](http://tbag This is a model commit message: -``` -Capitalized, short (72 chars or less) summary + Capitalized, short (72 chars or less) summary -More detailed explanatory text, if necessary. Wrap it to about 72 -characters or so. In some contexts, the first line is treated as the -subject of an email and the rest of the text as the body. The blank -line separating the summary from the body is critical (unless you omit -the body entirely); tools like rebase can get confused if you run the -two together. + More detailed explanatory text, if necessary. Wrap it to about 72 + characters or so. In some contexts, the first line is treated as the + subject of an email and the rest of the text as the body. The blank + line separating the summary from the body is critical (unless you omit + the body entirely); tools like rebase can get confused if you run the + two together. -Write your commit message in the imperative: "Fix bug" and not "Fixed bug" -or "Fixes bug." This convention matches up with commit messages generated -by commands like git merge and git revert. + Write your commit message in the imperative: "Fix bug" and not "Fixed bug" + or "Fixes bug." This convention matches up with commit messages generated + by commands like git merge and git revert. -Further paragraphs come after blank lines. + Further paragraphs come after blank lines. -- Bullet points are okay, too + - Bullet points are okay, too - - Typically a hyphen or asterisk is used for the bullet, followed by a - single space, with blank lines in between, but conventions vary here + - Typically a hyphen or asterisk is used for the bullet, followed by a + single space, with blank lines in between, but conventions vary here - - Use a hanging indent -``` + - Use a hanging indent [Gita] provide vim mode for Git commit messages, which helps you to comply to these guidelines. @@ -222,6 +237,7 @@ If you have some ASCII skills you can submit your artwork! You are free to choose a reasonable height size but the width size should be around 75 characters. +#### Contributing a statusline theme ## Build with SpaceVim diff --git a/docs/development/conventions.md b/docs/development/conventions.md index fd156defe..a32190572 100644 --- a/docs/development/conventions.md +++ b/docs/development/conventions.md @@ -1,16 +1,42 @@ --- title: "Conventions" -description: "conventions of contribute to SpaceVim, including the coding style guide about vim script and markdown" +description: "conventions of contributing to SpaceVim, including the coding style guides about vim script and markdown" permalink: "/conventions" --- # Conventions -## Content + -- [commit emoji convention](#commit-emoji-convention) -- [viml coding style guild](#viml-coding-style-guide) -- [markdown style guide](#markdown-style-guide) +- [Commit emoji convention](#commit-emoji-convention) +- [Viml coding style guide](#viml-coding-style-guide) + - [Portability](#portability) + - [Strings](#strings) + - [Matching Strings](#matching-strings) + - [Regular Expressions](#regular-expressions) + - [Dangerous commands](#dangerous-commands) + - [Fragile commands](#fragile-commands) + - [Catching Exceptions](#catching-exceptions) + - [General Guidelines](#general-guidelines) + - [Messaging](#messaging) + - [Type checking](#type-checking) + - [Python](#python) + - [Other Languages](#other-languages) + - [Plugin layout](#plugin-layout) + - [Functions](#functions) + - [Commands](#commands) + - [Autocommands](#autocommands) + - [Mappings](#mappings) + - [Errors](#errors) + - [Settings](#settings) + - [Style](#style) + - [Whitespace](#whitespace) + - [Line Continuations](#line-continuations) + - [Naming](#naming) +- [Markdown style guide](#markdown-style-guide) +- [Thanks:](#thanks) + + ## Commit emoji convention @@ -23,29 +49,35 @@ permalink: "/conventions" - :beer: I'm happy like reduced code complexity. ## Viml coding style guide + ### Portability + Vim is highly configurable. Users can change many of the default settings, including the case sensitivity, the regular expression rules, the substitution rules, and more. In order for your vimscript to work for all users, follow these guidelines: #### Strings + **Prefer single quoted strings** Double quoted strings are semantically different in vimscript, and you probably don't want them (they break regexes). -Use double quoted strings when you need an escape sequence (such as "\n") or if you know it doesn't matter and you need to embed single quotes. +Use double quoted strings when you need an escape sequence (such as "\\n") or if you know it doesn't matter and you need to embed single quotes. #### Matching Strings + **Use the =~# or =~? operator families over the =~ family.** The matching behavior depends upon the user's ignorecase and smartcase settings and on whether you compare them with the =~, =~#, or =~? family of operators. Use the =~# and =~? operator families explicitly when comparing strings unless you explicitly need to honor the user's case sensitivity settings. #### Regular Expressions -**Prefix all regexes with one of \m, \v, \M, or \V.** -In addition to the case sensitivity settings, regex behavior depends upon the user's nomagic setting. To make regexes act like nomagic and noignorecase are set, prepend all regexes with one of \m, \v, \M, or \V. +**Prefix all regexes with one of \\m, \\v, \\M, or \\V.** -You are welcome to use other magic levels (\v) and case sensitivities (\c) so long as they are intentional and explicit. +In addition to the case sensitivity settings, regex behavior depends upon the user's nomagic setting. To make regexes act like nomagic and noignorecase are set, prepend all regexes with one of \\m, \\v, \\M, or \\V. + +You are welcome to use other magic levels (\\v) and case sensitivities (\\c) so long as they are intentional and explicit. #### Dangerous commands + **Avoid commands with unintended side effects.** Avoid using :s[ubstitute] as it moves the cursor and prints error messages. Prefer functions (such as search()) better suited to scripts. @@ -55,6 +87,7 @@ The meaning of the g flag depends upon the gdefault setting. If you do use :subs For many vim commands, functions exist that do the same thing with fewer side effects. See :help functions() for a list of built-in functions. #### Fragile commands + **Avoid commands that rely on user settings.** Always use normal! instead of normal. The latter depends upon the user's key mappings and could do anything. @@ -64,12 +97,15 @@ Avoid :s[ubstitute], as its behavior depends upon a number of local settings. The same applies to other commands not listed here. #### Catching Exceptions + **Match error codes, not error text.** Error text may be locale dependant. ### General Guidelines + #### Messaging + **Message the user infrequently.** Loud scripts are annoying. Message the user only when: @@ -78,6 +114,7 @@ Loud scripts are annoying. Message the user only when: - An error has occurred. #### Type checking + **Use strict and explicit checks where possible.** Vimscript has unsafe, unintuitive behavior when dealing with some types. For instance, 0 == 'foo' evaluates to true. @@ -89,21 +126,25 @@ Check variable types explicitly before using them. Use functions from maktaba#en Use :unlet for variables that may change types, particularly those assigned inside loops. #### Python + **Use sparingly.** Use python only when it provides critical functionality, for example when writing threaded code. #### Other Languages + **Use vimscript instead.** Avoid using other scripting languages such as ruby and lua. We can not guarantee that the end user's vim has been compiled with support for non-vimscript languages. #### Plugin layout + **Organize functionality into modular plugins** Group your functionality as a plugin, unified in one directory (or code repository) which shares your plugin's name (with a "vim-" prefix or ".vim" suffix if desired). It should be split into plugin/, autoload/, etc. subdirectories as necessary, and it should declare metadata in the addon-info.json format (see the VAM documentation for details). #### Functions + **In the autoload/ directory, defined with [!] and [abort].** Autoloading allows functions to be loaded on demand, which makes startuptime faster and enforces function namespacing. @@ -117,6 +158,7 @@ Non-library plugins should expose commands instead of functions. Command logic s [abort] forces the function to halt when it encounters an error. #### Commands + **In the plugin/commands.vim or under the ftplugin/ directory, defined without [!].** General commands go in plugin/commands.vim. Filetype-specific commands go in ftplugin/. @@ -124,6 +166,7 @@ General commands go in plugin/commands.vim. Filetype-specific commands go in ftp Excluding [!] prevents your plugin from silently clobbering existing commands. Command conflicts should be resolved by the user. #### Autocommands + **Place them in plugin/autocmds.vim, within augroups.** Place all autocommands in augroups. @@ -133,6 +176,7 @@ The augroup name should be unique. It should either be, or be prefixed with, the Clear the augroup with autocmd! before defining new autocommands in the augroup. This makes your plugin re-entrable. #### Mappings + **Place them in plugin/mappings.vim, using maktaba#plugin#MapPrefix to get a prefix.** All key mappings should be defined in plugin/mappings.vim. @@ -148,6 +192,7 @@ Your plugins generally shouldn't introduce mappings, but if they do, the map com When using catch, match the error code rather than the error text. #### Settings + **Change settings locally** Use :setlocal and &l: instead of :set and & unless you have explicit reason to do otherwise. @@ -189,6 +234,7 @@ such as "noremap gf :grep -f ". ``` #### Line Continuations + - Prefer line continuations on semantic boundaries. ```diff @@ -214,6 +260,7 @@ autocommand BufEnter - Do not continue multi-line commands when you can avoid it. Prefer function calls. #### Naming + In general, use plugin-names-like-this, FunctionNamesLikeThis, CommandNamesLikeThis, augroup_names_like_this, variable_names_like_this. Always prefix variables with their scope. @@ -221,28 +268,29 @@ Always prefix variables with their scope. - plugin-names-like-this Keep them short and sweet. - FunctionNamesLikeThis - - Prefix script-local functions with s: - - Autoloaded functions may not have a scope prefix. - - Do not create global functions. Use autoloaded functions instead. + - Prefix script-local functions with s: + - Autoloaded functions may not have a scope prefix. + - Do not create global functions. Use autoloaded functions instead. - CommandNamesLikeThis Prefer succinct command names over common command prefixes. - variable_names_like_this Augroup names count as variables for naming purposes. - Prefix all variables with their scope. - - Global variables with g: - - Script-local variables with s: - - Function arguments with a: - - Function-local variables with l: - - Vim-predefined variables with v: - - Buffer-local variables with b: - - g:, s:, and a: must always be used. - - b: changes the variable semantics; use it when you want buffer-local semantics. - - l: and v: should be used for consistency, future proofing, and to avoid subtle bugs. They are not strictly required. Add them in new code but don’t go out of your way to add them elsewhere. + - Global variables with g: + - Script-local variables with s: + - Function arguments with a: + - Function-local variables with l: + - Vim-predefined variables with v: + - Buffer-local variables with b: + - g:, s:, and a: must always be used. + - b: changes the variable semantics; use it when you want buffer-local semantics. + - l: and v: should be used for consistency, future proofing, and to avoid subtle bugs. They are not strictly required. Add them in new code but don’t go out of your way to add them elsewhere. ## Markdown style guide ## Thanks: -- link : https://google.github.io/styleguide/vimscriptguide.xml -- link : https://google.github.io/styleguide/vimscriptfull.xml -- link : https://github.com/noahfrederick/vim-scripting-style-guide/blob/master/doc/scripting-style.txt + +- link : +- link : +- link : - [google's markdown style guide](https://github.com/google/styleguide/blob/3591b2e540cbcb07423e02d20eee482165776603/docguide/style.md) diff --git a/docs/documentation.md b/docs/documentation.md index 0e334f4cd..982ff002d 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -515,6 +515,10 @@ The letters displayed in the statusline correspond to the key bindings used to t | `SPC t S` | Ⓢ | S | enabled in spell checking | | `SPC t w` | ⓦ | w | whitespace mode | +**colorscheme of statusline:** + +current version only support `gruvbox`/`molokai`/`nord`/`one`/`onedark`, if you want to contribute theme please check the template of a statusline theme. + #### tabline Buffers will be listed on tabline if there is only one tab, each item contains the index, filetype icon and the bufname. if there are more than one tab, all tabs will be listed on the tabline. each item can be quickly accessed using ` number`. default `` is `\`. From ce3292f06879d2ed54e8c24b42f592fd81789cb3 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 9 Dec 2017 13:46:09 +0800 Subject: [PATCH 84/89] Update statusline --- docs/documentation.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/documentation.md b/docs/documentation.md index 982ff002d..16afce173 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -519,6 +519,36 @@ The letters displayed in the statusline correspond to the key bindings used to t current version only support `gruvbox`/`molokai`/`nord`/`one`/`onedark`, if you want to contribute theme please check the template of a statusline theme. +```vim +" the theme colors should be +" [ +" \ [ a_guifg, a_guibg, a_ctermfg, a_ctermbg], +" \ [ b_guifg, b_guibg, b_ctermfg, b_ctermbg], +" \ [ c_guifg, c_guibg, c_ctermfg, c_ctermbg], +" \ [ z_guibg, z_ctermbg], +" \ [ i_guifg, i_guibg, i_ctermfg, i_ctermbg], +" \ [ v_guifg, v_guibg, v_ctermfg, v_ctermbg], +" \ [ r_guifg, r_guibg, r_ctermfg, r_ctermbg], +" \ ] +" group_a: window id +" group_b/group_c: stausline sections +" group_z: empty area +" group_i: window id in insert mode +" group_v: window id in visual mode +" group_r: window id in select mode +function! SpaceVim#mapping#guide#theme#gruvbox#palette() abort + return [ + \ ['#282828', '#a89984', 246, 235], + \ ['#a89984', '#504945', 239, 246], + \ ['#a89984', '#3c3836', 237, 246], + \ ['#665c54', 241], + \ ['#282828', '#83a598', 235, 109], + \ ['#282828', '#fe8019', 235, 208], + \ ['#282828', '#8ec07c', 235, 108], + \ ] +endfunction +``` + #### tabline Buffers will be listed on tabline if there is only one tab, each item contains the index, filetype icon and the bufname. if there are more than one tab, all tabs will be listed on the tabline. each item can be quickly accessed using ` number`. default `` is `\`. From c1ac7940edae5877108f9d230c450552c381bbd2 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 9 Dec 2017 14:12:37 +0800 Subject: [PATCH 85/89] Update welcome page, ref #1092 --- README.md | 2 +- docs/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ea50e308b..85c8ad49e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ SpaceVim is a community-driven vim distribution that supports vim and Neovim. S Please star the project on github - it is a great way to show your appreciation while providing us motivation to continue working on this project. The extra visibility for the project doesn't hurt either! -![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png) +![welcome-page](https://user-images.githubusercontent.com/13142418/33793078-3446cb6e-dc76-11e7-9998-376a355557a4.png) See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information. diff --git a/docs/index.md b/docs/index.md index 32b08020c..5af642478 100644 --- a/docs/index.md +++ b/docs/index.md @@ -14,7 +14,7 @@ SpaceVim is a community-driven vim distribution that supports vim and Neovim. S Please star the project on github - it is a great way to show your appreciation while providing us motivation to continue working on this project. The extra visibility for the project doesn't hurt either! -![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png) +![welcome-page](https://user-images.githubusercontent.com/13142418/33793078-3446cb6e-dc76-11e7-9998-376a355557a4.png) See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information. From df4101e8fd0f047a8a5b79ce665d0949ea6f8cb7 Mon Sep 17 00:00:00 2001 From: Seong Yong-ju Date: Sat, 9 Dec 2017 17:34:18 +0900 Subject: [PATCH 86/89] Add language server configuration for JavaScript * Add APIs for register server commands for LSP * Add server command for JavaScript language server * Add a new layer option `use_lsp` for layer `javascript` * Update key mappings for Javascript --- autoload/SpaceVim/layers/lang/javascript.vim | 59 +++++++++++++++----- autoload/SpaceVim/layers/lsp.vim | 2 +- autoload/SpaceVim/lsp.vim | 10 ++++ docs/layers/lang/javascript.md | 9 +-- 4 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 autoload/SpaceVim/lsp.vim diff --git a/autoload/SpaceVim/layers/lang/javascript.vim b/autoload/SpaceVim/layers/lang/javascript.vim index c4794315f..9a5a89542 100644 --- a/autoload/SpaceVim/layers/lang/javascript.vim +++ b/autoload/SpaceVim/layers/lang/javascript.vim @@ -5,22 +5,29 @@ function! SpaceVim#layers#lang#javascript#plugins() abort \ ['othree/es.next.syntax.vim', { 'on_ft' : 'javascript' }], \ ['othree/javascript-libraries-syntax.vim', { 'on_ft' : ['javascript', 'coffee', 'ls', 'typescript'] }], \ ['MaxMEllon/vim-jsx-pretty', { 'on_ft' : 'javascript' }], - \ ['ternjs/tern_for_vim', { 'on_ft' : 'javascript', 'build' : 'npm install' }], \ ['Galooshi/vim-import-js', { 'on_ft' : 'javascript', 'build' : 'npm install -g import-js' }], \ ['maksimr/vim-jsbeautify', { 'on_ft' : 'javascript' }], \ ['mmalecki/vim-node.js', { 'on_ft' : 'javascript' }], \ ] - if has('nvim') - call add(plugins,['carlitux/deoplete-ternjs', { 'on_ft' : ['javascript'] }]) + if !s:use_lsp + call add(plugins, ['ternjs/tern_for_vim', { + \ 'on_ft': 'javascript', 'build' : 'npm install' }]) + + if has('nvim') + call add(plugins, ['carlitux/deoplete-ternjs', { 'on_ft': [ + \ 'javascript'] }]) + endif endif return plugins endfunction +let s:use_lsp = 0 let s:auto_fix = 0 function! SpaceVim#layers#lang#javascript#set_variable(var) abort + let s:use_lsp = get(a:var, 'use_lsp', 0) && has('nvim') let s:auto_fix = get(a:var, 'auto_fix', 0) endfunction @@ -34,9 +41,16 @@ function! SpaceVim#layers#lang#javascript#config() abort let g:vim_jsx_pretty_colorful_config = 1 " }}} - call SpaceVim#mapping#gd#add('javascript', function('s:gotodef')) call SpaceVim#plugins#runner#reg_runner('javascript', 'node %s') - call SpaceVim#mapping#space#regesit_lang_mappings('javascript', funcref('s:language_specified_mappings')) + call SpaceVim#mapping#space#regesit_lang_mappings('javascript', + \ funcref('s:on_ft')) + + if s:use_lsp && executable('javascript-typescript-stdio') + call SpaceVim#lsp#reg_server('javascript', ['javascript-typescript-stdio']) + call SpaceVim#mapping#gd#add('javascript', function('s:lsp_go_to_def')) + else + call SpaceVim#mapping#gd#add('javascript', function('s:tern_go_to_def')) + endif if s:auto_fix " Only use eslint @@ -52,12 +66,7 @@ function! SpaceVim#layers#lang#javascript#config() abort endif endfunction -function! s:language_specified_mappings() abort - " ternjs/tern_for_vim {{{ - call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], 'TernDoc', 'Look up the documentation of something', 1) - call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'], 'TernRename', 'Rename the variable under the cursor', 1) - " }}} - +function! s:on_ft() abort " Galooshi/vim-import-js {{{ nnoremap :ImportJSWord nnoremap ji :ImportJSWord @@ -70,14 +79,34 @@ function! s:language_specified_mappings() abort inoremap g :ImportJSGotoa " }}} - call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) + if s:use_lsp + nnoremap K :call LanguageClient_textDocument_hover() + + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], + \ 'call LanguageClient_textDocument_hover()', 'show_document', 1) + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'], + \ 'call LanguageClient_textDocument_rename()', 'rename symbol', 1) + else + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], 'TernDoc', + \ 'show document', 1) + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'], 'TernRename', + \ 'rename symbol', 1) + endif + + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'r'], + \ 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) endfunction -function! s:gotodef() abort +function! s:lsp_go_to_def() abort + if exists('*LanguageClient_textDocument_definition') + call LanguageClient_textDocument_definition() + endif +endfunction + +function! s:tern_go_to_def() abort if exists(':TernDef') TernDef endif endfunction - -" vim:set et sw=2 cc=80: +" vi: et sw=2 cc=80 diff --git a/autoload/SpaceVim/layers/lsp.vim b/autoload/SpaceVim/layers/lsp.vim index 88c6e15e0..63bbe005e 100644 --- a/autoload/SpaceVim/layers/lsp.vim +++ b/autoload/SpaceVim/layers/lsp.vim @@ -58,7 +58,7 @@ function! SpaceVim#layers#lsp#config() abort let g:LanguageClient_diagnosticsDisplay[4].signTexthl = 'ALEInfoSign' endif - let g:LanguageClient_autoStart = 0 + let g:LanguageClient_autoStart = 1 " }}} endfunction diff --git a/autoload/SpaceVim/lsp.vim b/autoload/SpaceVim/lsp.vim new file mode 100644 index 000000000..048cd9ca7 --- /dev/null +++ b/autoload/SpaceVim/lsp.vim @@ -0,0 +1,10 @@ +scriptencoding utf-8 + +" lsp.vim +" author: Seong Yong-ju ( @sei40kr ) + +function! SpaceVim#lsp#reg_server(ft, cmds) abort + let g:LanguageClient_serverCommands[a:ft] = copy(a:cmds) +endfunction + +" vi: et sw=2 cc=80 diff --git a/docs/layers/lang/javascript.md b/docs/layers/lang/javascript.md index 849ba6489..f28a1475a 100644 --- a/docs/layers/lang/javascript.md +++ b/docs/layers/lang/javascript.md @@ -7,10 +7,10 @@ description: "This layer is for JaveScript development" -- [Description](#description) -- [Layer Installation](#layer-installation) -- [Features](#features) -- [Layer configuration](#layer-configuration) +* [Description](#description) +* [Layer Installation](#layer-installation) +* [Features](#features) +* [Layer configuration](#layer-configuration) @@ -31,6 +31,7 @@ To use this configuration layer, add `call SpaceVim#layers#load('lang#javascript ## Layer configuration +`use_lsp`: Use language server if possible. The default value is `0`. `auto_fix`: auto fix problems when save files, disabled by default. if you need this feature, you can load this layer via: ```vim From 7c8d803865140b188f2ec8f8cfced16df94932cd Mon Sep 17 00:00:00 2001 From: Seong Yong-ju Date: Sat, 9 Dec 2017 17:49:42 +0900 Subject: [PATCH 87/89] Improve layer implementations for lsp, javascript --- autoload/SpaceVim/layers/lang/javascript.vim | 18 +++++++----------- autoload/SpaceVim/lsp.vim | 12 ++++++++++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/javascript.vim b/autoload/SpaceVim/layers/lang/javascript.vim index 9a5a89542..8ff7c9a74 100644 --- a/autoload/SpaceVim/layers/lang/javascript.vim +++ b/autoload/SpaceVim/layers/lang/javascript.vim @@ -28,6 +28,7 @@ let s:auto_fix = 0 function! SpaceVim#layers#lang#javascript#set_variable(var) abort let s:use_lsp = get(a:var, 'use_lsp', 0) && has('nvim') + \ && executable('javascript-typescript-stdio') let s:auto_fix = get(a:var, 'auto_fix', 0) endfunction @@ -45,9 +46,10 @@ function! SpaceVim#layers#lang#javascript#config() abort call SpaceVim#mapping#space#regesit_lang_mappings('javascript', \ funcref('s:on_ft')) - if s:use_lsp && executable('javascript-typescript-stdio') + if s:use_lsp call SpaceVim#lsp#reg_server('javascript', ['javascript-typescript-stdio']) - call SpaceVim#mapping#gd#add('javascript', function('s:lsp_go_to_def')) + call SpaceVim#mapping#gd#add('javascript', + \ function('SpaceVim#lsp#go_to_def')) else call SpaceVim#mapping#gd#add('javascript', function('s:tern_go_to_def')) endif @@ -80,12 +82,12 @@ function! s:on_ft() abort " }}} if s:use_lsp - nnoremap K :call LanguageClient_textDocument_hover() + nnoremap K :call SpaceVim#lsp#show_doc() call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], - \ 'call LanguageClient_textDocument_hover()', 'show_document', 1) + \ 'call SpaceVim#lsp#show_doc()', 'show_document', 1) call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'], - \ 'call LanguageClient_textDocument_rename()', 'rename symbol', 1) + \ 'call SpaceVim#lsp#rename()', 'rename symbol', 1) else call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], 'TernDoc', \ 'show document', 1) @@ -97,12 +99,6 @@ function! s:on_ft() abort \ 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) endfunction -function! s:lsp_go_to_def() abort - if exists('*LanguageClient_textDocument_definition') - call LanguageClient_textDocument_definition() - endif -endfunction - function! s:tern_go_to_def() abort if exists(':TernDef') TernDef diff --git a/autoload/SpaceVim/lsp.vim b/autoload/SpaceVim/lsp.vim index 048cd9ca7..0932e2de3 100644 --- a/autoload/SpaceVim/lsp.vim +++ b/autoload/SpaceVim/lsp.vim @@ -7,4 +7,16 @@ function! SpaceVim#lsp#reg_server(ft, cmds) abort let g:LanguageClient_serverCommands[a:ft] = copy(a:cmds) endfunction +function! SpaceVim#lsp#show_doc() abort + call LanguageClient_textDocument_hover() +endfunction + +function! SpaceVim#lsp#go_to_def() abort + call LanguageClient_textDocument_definition() +endfunction + +function! SpaceVim#lsp#rename() abort + call LanguageClient_textDocument_rename() +endfunction + " vi: et sw=2 cc=80 From b0bfa429d0aabe469a42ed740f50575e9c596981 Mon Sep 17 00:00:00 2001 From: Seong Yong-ju Date: Sat, 9 Dec 2017 18:18:21 +0900 Subject: [PATCH 88/89] Add language server configurations for Haskell * Add language server commands for Haskell * Update key mappings for Haskell --- autoload/SpaceVim/layers/lang/haskell.vim | 53 ++++++++++++++++++----- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/haskell.vim b/autoload/SpaceVim/layers/lang/haskell.vim index 350915c49..785033217 100644 --- a/autoload/SpaceVim/layers/lang/haskell.vim +++ b/autoload/SpaceVim/layers/lang/haskell.vim @@ -1,23 +1,56 @@ function! SpaceVim#layers#lang#haskell#plugins() abort - let plugins = [] - call add(plugins,['neovimhaskell/haskell-vim', { 'on_ft' : 'haskell'}]) - call add(plugins,['pbrisbin/vim-syntax-shakespeare', { 'on_ft' : 'haskell'}]) - call add(plugins,['eagletmt/neco-ghc', { 'on_ft' : 'haskell'}]) - return plugins + let plugins = [ + \ ['neovimhaskell/haskell-vim', { 'on_ft': 'haskell' }], + \ ['pbrisbin/vim-syntax-shakespeare', { 'on_ft': 'haskell' }], + \ ] + + if !s:use_lsp + call add(plugins, ['eagletmt/neco-ghc', { 'on_ft': 'haskell' }]) + endif + + return plugins +endfunction + +let s:use_lsp = 0 + +function! SpaceVim#layers#lang#haskell#set_variable(var) abort + let s:use_lsp = get(a:var, 'use_lsp', 0) && has('nvim') && executable('hie') endfunction function! SpaceVim#layers#lang#haskell#config() abort let g:haskellmode_completion_ghc = 0 - call SpaceVim#plugins#runner#reg_runner('haskell', ['ghc -v0 --make %s -o #TEMP#', '#TEMP#']) - call SpaceVim#mapping#space#regesit_lang_mappings('haskell', funcref('s:language_specified_mappings')) + call SpaceVim#plugins#runner#reg_runner('haskell', [ + \ 'ghc -v0 --make %s -o #TEMP#', + \ '#TEMP#']) + call SpaceVim#mapping#space#regesit_lang_mappings('haskell', + \ funcref('s:on_ft')) + + if s:use_lsp + call SpaceVim#mapping#gd#add('haskell', + \ function('SpaceVim#lsp#go_to_def')) + call SpaceVim#lsp#reg_server('haskell', ['hie', '--lsp']) + endif augroup SpaceVim_lang_haskell autocmd! - autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc + + if !s:use_lsp + autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc + endif augroup END endfunction -function! s:language_specified_mappings() abort - call SpaceVim#mapping#space#langSPC('nmap', ['l', 'r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) +function! s:on_ft() abort + if s:use_lsp + nnoremap K :call SpaceVim#lsp#show_doc() + + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], + \ 'call SpaceVim#lsp#show_doc()', 'show_document', 1) + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'], + \ 'call SpaceVim#lsp#rename()', 'rename symbol', 1) + endif + + call SpaceVim#mapping#space#langSPC('nmap', ['l', 'r'], + \ 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) endfunction From 3a2382d73847d5184ce8b1d3cb27a55e6fa243b0 Mon Sep 17 00:00:00 2001 From: Oleksii Vilchanskyi Date: Sat, 9 Dec 2017 11:54:14 +0100 Subject: [PATCH 89/89] doc: fix g:spacevim_terminal_cursor_shape default --- doc/SpaceVim.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 87246728a..fe5b3d928 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -282,9 +282,9 @@ Set the information symbol for SpaceVim's syntax maker. Default is '🛈'. *g:spacevim_terminal_cursor_shape* Set the SpaceVim cursor shape in the terminal. Set to 0 to prevent Nvim from -changing the cursor shape. Set to 1 to enable non-blinking mode-sensitive -cursor (this is the default). Set to 2 to enable blinking mode-sensitive -cursor. Host terminal must support the DECSCUSR CSI escape sequence. +changing the cursor shape. Set to 1 to enable non-blinking mode-sensitive +cursor. Set to 2 to enable blinking mode-sensitive cursor (this is the +default). Host terminal must support the DECSCUSR CSI escape sequence. Depending on the terminal emulator, using this option with nvim under tmux might require adding the following to ~/.tmux.conf: