1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 23:10:04 +08:00

Merge branch 'dev'

This commit is contained in:
wsdjeg 2017-09-02 20:02:40 +00:00
commit 30c220a4d7
21 changed files with 737 additions and 800 deletions

View File

@ -1,6 +1,11 @@
language: python
sudo: false
notifications:
slack:
on_success: never
on_failure: never
cache:
pip: true

247
README.md
View File

@ -4,16 +4,22 @@
[Documentation](http://spacevim.org/documentation/) |
[Twitter](https://twitter.com/SpaceVim) |
[Community](https://spacevim.org/community/) |
[Gitter **Chat**](https://gitter.im/SpaceVim/SpaceVim)
[Gitter **Chat**](https://gitter.im/SpaceVim/SpaceVim) |
[中文文档](http://spacevim.org/README_zh_cn/)
[![Build Status](https://travis-ci.org/SpaceVim/SpaceVim.svg?branch=dev)](https://travis-ci.org/SpaceVim/SpaceVim)
![Version](https://img.shields.io/badge/version-0.4.0--dev-FF00CC.svg)
![Version](https://img.shields.io/badge/version-0.5.0--dev-FF00CC.svg)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Doc](https://img.shields.io/badge/doc-%3Ah%20SpaceVim-orange.svg)](doc/SpaceVim.txt)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Percentage of issues still open")
SpaceVim is a community-driven vim distribution that seeks to provide layer feature, especially for neovim. It offers a variety of layers to choose from. to create a suitable vim development environment, you just need to select the required layers.
SpaceVim is a community-driven vim distribution that seeks to provide layer feature, especially for neovim. It offers a variety of layers to choose from. to create a suitable vim development environment, you just need to select the required layers. 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.
![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png)
See the [documentation](https://spacevim.org/documentation) or [the list of layers](http://spacevim.org/layers/) for more information.
@ -21,108 +27,8 @@ 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)
# Table of Contents
<!-- vim-markdown-toc GFM -->
* [Introduction](#introduction)
* [Features](#features)
* [Mnemonic key bindings](#mnemonic-key-bindings)
* [Unite work flow](#unite-work-flow)
* [module statusline](#module-statusline)
* [Install](#install)
* [1. Requirements](#1-requirements)
* [2. Install SpaceVim in Linux/Mac](#2-install-spacevim-in-linuxmac)
* [3. Install SpaceVim in windows](#3-install-spacevim-in-windows)
* [Update](#update)
* [Documentation](#documentation)
* [Quick start guide](#quick-start-guide)
* [Community](#community)
* [Support SpaceVim](#support-spacevim)
* [contribute to SpaceVim](#contribute-to-spacevim)
* [Write post about SpaceVim](#write-post-about-spacevim)
* [Credits & Thanks](#credits--thanks)
<!-- vim-markdown-toc -->
## Introduction
[SpaceVim](https://github.com/SpaceVim/SpaceVim) is a community-driven vim distribution with a bundle of modular configuration,
here we call these modules as 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.
![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png)
If you are new to vim, you should learn about Vim in general, read [vim-galore](https://github.com/mhinz/vim-galore).
## Features
- **Great documentation:** access documentation in Vim with
<kbd>:h SpaceVim</kbd>.
- **Beautiful GUI:** you'll love the awesome UI and its useful features.
- **Mnemonic key bindings:** commands have mnemonic prefixes like
<kbd>[Window]</kbd> for all the window and buffer commands or <kbd>[Unite]</kbd> for the
unite work flow commands.
- **Lazy load plugins:** Lazy-load 90% of plugins with [dein.vim]
- **Batteries included:** discover hundreds of ready-to-use packages nicely
organised in configuration layers following a set of
[conventions](http://spacevim.org/development/).
- **Neovim centric:** Dark powered mode of SpaceVim
### Mnemonic key bindings
By default the guide buffer will be displayed 1000ms after the key has been pressed. You can change the delay by setting `'timeoutlen'` option to your liking (the value is in milliseconds).
for example, after pressing `<Space>` in normal mode, you will see :
![mapping-guide](https://cloud.githubusercontent.com/assets/13142418/25778673/ae8c3168-3337-11e7-8536-ee78d59e5a9c.png)
this guide show you all the available key bindings begin with `[SPC]`, you can type `b` for all the buffer mappings, `p` for project mappings, etc. after pressing `<C-h>` in guide buffer, you will get paging and help info in the statusline.
here is the guide for the default mappings in SpaceVim:
![spc](https://user-images.githubusercontent.com/13142418/27549426-8141bd86-5ace-11e7-9082-eb86b398acdc.png)
### Unite work flow
![unite](docs/img/unite_mappings.png)
### module statusline
The `core#statusline` layer provide a heavily customized powerline with the following capabilities:, It is inspired by spacemacs's mode-line. and this layer is loaded by default.
- show the window number
- color code for current state
- show the number of search results
- toggle syntax checking info
- toggle battery info
- toggle minor mode lighters
![search status](https://cloud.githubusercontent.com/assets/13142418/26313080/578cc68c-3f3c-11e7-9259-a27419d49572.png)
## Install
### 1. Requirements
**nerd fonts and true colors:**
SpaceVim provides basic and awesome mode, if you want to use awesome mode, you need to install the [nerd-fonts](https://github.com/ryanoasis/nerd-fonts) and make sure your terminal support [true colors](https://gist.github.com/XVilka/8346728).
**Vim 7.4 above or neovim:**
- [neovim installation](https://github.com/neovim/neovim/wiki/Installing-Neovim)
- [install vim with python, python3 and lua support](https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source)
**git:**
SpaceVim will download all plugins via git.
### 2. Install SpaceVim in Linux/Mac
Install SpaceVim with the command below:
### Install
```bash
curl -sLf https://spacevim.org/install.sh | bash
@ -136,137 +42,24 @@ for more info about the install script, please check:
curl -sLf https://spacevim.org/install.sh | bash -s -- -h
```
### 3. Install SpaceVim in windows
### Features
- For vim in windows, please just clone this repo as vimfiles in you Home directory.
by default, when open a cmd, the current dir is your Home directory, run this command in cmd.
make sure you have a backup of your own vimfiles. also you need remove `~/_vimrc` in your home directory.
- **Great documentation:** access documentation in Vim with
<kbd>:h SpaceVim</kbd>.
- **Beautiful GUI:** you'll love the awesome UI and its useful features.
- **Mnemonic key bindings:** all key bindings have mnemonic prefixes.
- **Lazy load plugins:** Lazy-load 90% of plugins with [dein.vim](https://github.com/Shougo/dein.vim)
- **Neovim centric:** Dark powered mode of SpaceVim
```sh
git clone https://github.com/SpaceVim/SpaceVim.git vimfiles
```
- For neovim in windows, please clone this repo as `AppData\Local\nvim` in your home directory.
for more info, please check out [neovim's wiki](https://github.com/neovim/neovim/wiki/Installing-Neovim).
by default, when open a cmd, the current dir is your Home directory, run this command in cmd.
```bash
git clone https://github.com/SpaceVim/SpaceVim.git AppData\Local\nvim
```
## Update
you can update SpaceVim with the command below:
```viml
:SPUpdate SpaceVim
```
## Documentation
### Quick start guide
SpaceVim load custom configuration from `~/.SpaceVim.d/init.vim`,
:warning: It is not `~/.SpaceVim/init.vim`, user should not change anything in `~/.SpaceVim/`.
here is an example:
```vim
" Here are some basic customizations, please refer to the ~/.SpaceVim.d/init.vim
" file for all possible options:
let g:spacevim_default_indent = 3
let g:spacevim_max_column = 80
" Change the default directory where all miscellaneous persistent files go.
" By default it is ~/.cache/vimfiles/.
let g:spacevim_plugin_bundle_dir = '~/.cache/vimfiles/'
" set SpaceVim colorscheme
let g:spacevim_colorscheme = 'gruvbox'
" Set plugin manager, you want to use, default is dein.vim
let g:spacevim_plugin_manager = 'dein' " neobundle or dein or vim-plug
" Set windows shortcut leader [Window], default is `s`
let g:spacevim_windows_leader = 's'
" Set unite work flow shortcut leader [Unite], default is `f`
let g:spacevim_unite_leader = 'f'
" Set Denite work flow shortcut leader [Denite], default is `F`
let g:spacevim_denite_leader = 'F'
" By default, language specific plugins are not loaded. This can be changed
" with the following, then the plugins for go development will be loaded.
call SpaceVim#layers#load('lang#go')
" loaded ui layer
call SpaceVim#layers#load('ui')
" If there is a particular plugin you don't like, you can define this
" variable to disable them entirely:
let g:spacevim_disabled_plugins=[
\ ['junegunn/fzf.vim'],
\ ]
" If you want to add some custom plugins, use these options:
let g:spacevim_custom_plugins = [
\ ['plasticboy/vim-markdown', {'on_ft' : 'markdown'}],
\ ['wsdjeg/GitHub.vim'],
\ ]
" set the guifont
let g:spacevim_guifont = 'DejaVu\ Sans\ Mono\ for\ Powerline\ 11'
```
Comprehensive documentation is available for each layer by <kbd>:h SpaceVim</kbd>.
You can also check the [general documentation](http://spacevim.org/documentation/).
## Community
Try these SpaceVim hangouts for any questions, problems or comments.
- Chat
- [![Gitter](https://badges.gitter.im/SpaceVim/SpaceVim.svg)](https://gitter.im/SpaceVim/SpaceVim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
- [![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)
- Ask
- [issue tracker](https://github.com/SpaceVim/SpaceVim/issues) for issue and feature requests
- vi StackExchange for "how to" & configuration questions
- [![Twitter Follow](https://img.shields.io/twitter/follow/SpaceVim.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/SpaceVim) for hugs & pithy comments
- Discuss
- [google mailing list](https://groups.google.com/forum/#!forum/spacevim)
## Support SpaceVim
### Support SpaceVim
The best way to support SpaceVim is to contribute to it either by reporting bugs, helping the community on the Gitter Chat or sending pull requests.
If you want to show your support financially you can contribute to [Bountysource](https://www.bountysource.com/teams/spacevim) or buy a drink for the maintainer by clicking following icon.
If you want to show your support financially you can buy a drink for the maintainer by clicking following icon.
<a href='https://ko-fi.com/A538L6H' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi4.png?v=f' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
If you used SpaceVim in a project and you want to show that fact, you can use the SpaceVim badge:
[![](https://spacevim.org/img/build-with-SpaceVim.svg)](https://spacevim.org)
markdown
```markdown
[![](https://spacevim.org/img/build-with-SpaceVim.svg)](https://spacevim.org)
```
### contribute to SpaceVim
Before contributing be sure to consult the [contribution guidelines](http://spacevim.org/development/#contribution-guidelines) and [conventions](http://spacevim.org/development/#conventions).
### Write post about SpaceVim
if you want to write something about SpaceVim, and want your post to be posted in [SpaceVim's blog page](https://spacevim.org/blog), please show us the link.
## Credits & Thanks
### Credits & Thanks
- [![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

View File

@ -27,7 +27,7 @@
""
" Version of SpaceVim , this value can not be changed.
scriptencoding utf-8
let g:spacevim_version = '0.4.0-dev'
let g:spacevim_version = '0.5.0-dev'
lockvar g:spacevim_version
""
" Change the default indentation of SpaceVim. Default is 2.

View File

@ -12,9 +12,12 @@ function! SpaceVim#layers#load(layer, ...) abort
endif
if index(g:spacevim_plugin_groups, a:layer) == -1
call add(g:spacevim_plugin_groups, a:layer)
if a:0 == 1 && type(a:1) == 4
endif
if a:0 == 1 && type(a:1) == 4
try
call SpaceVim#layers#{a:layer}#set_variable(a:1)
endif
catch /^Vim\%((\a\+)\)\=:E117/
endtry
endif
if a:0 > 0 && type(a:1) == 1
for l in a:000

View File

@ -65,19 +65,36 @@ endfunction
function! SpaceVim#layers#autocomplete#config() abort
let g:delimitMate_matchpairs = '[:],{:},<:>'
inoremap <silent><expr> ( complete_parameter#pre_complete("()")
imap <expr>(
\ pumvisible() ?
\ complete_parameter#pre_complete("()") :
\ (len(maparg('<Plug>delimitMate(', 'i')) == 0) ?
\ "\<Plug>delimitMate(" :
\ '('
"mapping
imap <silent><expr><TAB> SpaceVim#mapping#tab()
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
imap <silent><expr><CR> SpaceVim#mapping#enter()
smap <expr><TAB>
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" :
\ (complete_parameter#jumpable(1) ?
\ "\<plug>(complete_parameter#goto_next_parameter)" :
\ "\<TAB>")
if s:tab_key_behavior ==# 'smart'
imap <silent><expr><TAB> SpaceVim#mapping#tab()
smap <expr><TAB>
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" :
\ (complete_parameter#jumpable(1) ?
\ "\<plug>(complete_parameter#goto_next_parameter)" :
\ "\<TAB>")
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
elseif s:tab_key_behavior ==# 'complete'
inoremap <expr> <Tab> pumvisible() ? "\<C-y>" : "\<C-n>"
elseif s:tab_key_behavior ==# 'cycle'
inoremap <expr> <Tab> pumvisible() ? "\<Down>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<Up>" : ""
elseif s:tab_key_behavior ==# 'nil'
endif
if s:return_key_behavior ==# 'smart'
imap <silent><expr><CR> SpaceVim#mapping#enter()
elseif s:return_key_behavior ==# 'complete'
imap <silent><expr><CR> pumvisible() ? "\<C-y>" : "\<CR>"
elseif s:return_key_behavior ==# 'nil'
endif
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
@ -87,10 +104,15 @@ function! SpaceVim#layers#autocomplete#config() abort
imap <expr> <M-/>
\ neosnippet#expandable() ?
\ "\<Plug>(neosnippet_expand)" : ""
call SpaceVim#mapping#space#def('nnoremap', ['i', 's'], 'Unite neosnippet', 'insert sneppets', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 's'], 'Unite neosnippet', 'insert sneppets', 1)
endfunction
function! SpaceVim#layers#autocomplete#set_variable(var)
let s:return_key_behavior = 'smart'
let s:tab_key_behavior = 'smart'
let s:key_sequence = 'nil'
let s:key_sequence_delay = 0.1
function! SpaceVim#layers#autocomplete#set_variable(var) abort
let s:return_key_behavior = get(a:var,
\ 'auto-completion-return-key-behavior',

View File

@ -18,413 +18,449 @@ let s:VIMCOMP = SpaceVim#api#import('vim#compatible')
" 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' : ['', ''],
\ }
let s:loaded_modes = ['syntax-checking']
let s:modes = {
\ 'center-cursor': {
\ 'icon' : '⊝',
\ 'desc' : 'centered-cursor mode',
\ },
\ 'hi-characters-for-long-lines' :{
\ 'icon' : '⑧',
\ 'desc' : 'toggle highlight of characters for long lines',
\ },
\ 'fill-column-indicator' :{
\ 'icon' : s:MESSLETTERS.circled_letter('f'),
\ 'desc' : 'fill-column-indicator mode',
\ },
\ 'syntax-checking' :{
\ 'icon' : s:MESSLETTERS.circled_letter('s'),
\ 'desc' : 'syntax-checking mode',
\ },
\ 'spell-checking' :{
\ 'icon' : s:MESSLETTERS.circled_letter('S'),
\ 'desc' : 'spell-checking mode',
\ },
\ 'whitespace' :{
\ 'icon' : s:MESSLETTERS.circled_letter('w'),
\ 'desc' : 'whitespace mode',
\ },
\ }
\ 'center-cursor': {
\ 'icon' : '⊝',
\ 'desc' : 'centered-cursor mode',
\ },
\ 'hi-characters-for-long-lines' :{
\ 'icon' : '⑧',
\ 'desc' : 'toggle highlight of characters for long lines',
\ },
\ 'fill-column-indicator' :{
\ 'icon' : s:MESSLETTERS.circled_letter('f'),
\ 'desc' : 'fill-column-indicator mode',
\ },
\ 'syntax-checking' :{
\ 'icon' : s:MESSLETTERS.circled_letter('s'),
\ 'desc' : 'syntax-checking mode',
\ },
\ 'spell-checking' :{
\ 'icon' : s:MESSLETTERS.circled_letter('S'),
\ 'desc' : 'spell-checking mode',
\ },
\ 'whitespace' :{
\ 'icon' : s:MESSLETTERS.circled_letter('w'),
\ 'desc' : 'whitespace mode',
\ },
\ }
let s:loaded_sections = ['syntax checking', 'major mode', 'minor mode lighters', 'version control info', 'cursorpos']
function! s:battery_status() abort
if executable('acpi')
return ' ⚡' . substitute(split(system('acpi'))[-1], '%', '%%', 'g') . ' '
else
return ''
endif
if executable('acpi')
return ' ⚡' . substitute(split(system('acpi'))[-1], '%', '%%', 'g') . ' '
else
return ''
endif
endfunction
function! s:check_mode() abort
if mode() == 'n'
return 'n'
elseif mode() =='i'
return 'i'
elseif mode() =~ 'v'
return 'v'
elseif mode() =~ 'R'
return 'R'
endif
if mode() == 'n'
return 'n'
elseif mode() =='i'
return 'i'
elseif mode() =~ 'v'
return 'v'
elseif mode() =~ 'R'
return 'R'
endif
endfunction
function! s:search_status() abort
let ct = 0
let tt = 0
let ctl = split(s:VIMCOMP.execute('keeppatterns .,$s/' . @/ . '//gn', 'silent!'), "\n")
if !empty(ctl)
let ct = split(ctl[0])[0]
endif
let ttl = split(s:VIMCOMP.execute('keeppatterns %s/' . @/ . '//gn', 'silent!'), "\n")
if !empty(ctl)
let tt = split(ttl[0])[0]
endif
return ' ' . (str2nr(tt) - str2nr(ct) + 1) . '/' . tt . ' '
let ct = 0
let tt = 0
let ctl = split(s:VIMCOMP.execute('keeppatterns .,$s/' . @/ . '//gn', 'silent!'), "\n")
if !empty(ctl)
let ct = split(ctl[0])[0]
endif
let ttl = split(s:VIMCOMP.execute('keeppatterns %s/' . @/ . '//gn', 'silent!'), "\n")
if !empty(ctl)
let tt = split(ttl[0])[0]
endif
return ' ' . (str2nr(tt) - str2nr(ct) + 1) . '/' . tt . ' '
endfunction
function! s:time() abort
return ' ' . s:TIME.current_time() . ' '
return ' ' . s:TIME.current_time() . ' '
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
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
else
function! s:syntax_checking()
if !exists(':SyntasticCheck')
return ''
endif
let l = SyntasticStatuslineFlag()
if strlen(l) > 0
return l
else
return ''
endif
endfunction
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:winnr(...) abort
if a:0 > 1
return ' ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' '
else
return '%{SpaceVim#layers#core#statusline#mode(mode())} ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' '
endif
if a:0 > 1
return ' ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' '
else
return '%{SpaceVim#layers#core#statusline#mode(mode())} ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_windows_index_type) . ' '
endif
endfunction
function! s:filename() abort
let name = fnamemodify(bufname('%'), ':t')
if empty(name)
let name = 'No Name'
endif
return (&modified ? ' * ' : ' - ') . s:filesize() . name . ' '
let name = fnamemodify(bufname('%'), ':t')
if empty(name)
let name = 'No Name'
endif
return (&modified ? ' * ' : ' - ') . s:filesize() . name . ' '
endfunction
function! s:git_branch() abort
if exists('g:loaded_fugitive')
let l:head = fugitive#head()
if empty(l:head)
call fugitive#detect(getcwd())
let l:head = fugitive#head()
endif
return empty(l:head) ? '' : '  '.l:head . ' '
if exists('g:loaded_fugitive')
let l:head = fugitive#head()
if empty(l:head)
call fugitive#detect(getcwd())
let l:head = fugitive#head()
endif
return ''
return empty(l:head) ? '' : '  '.l:head . ' '
endif
return ''
endfunction
function! s:whitespace() abort
let ln = search('\s\+$', 'n')
if ln != 0
return ' trailing[' . ln . '] '
else
return ''
endif
let ln = search('\s\+$', 'n')
if ln != 0
return ' trailing[' . ln . '] '
else
return ''
endif
endfunction
function! s:cursorpos() abort
return ' %l:%c '
return ' %l:%c '
endfunction
function! s:modes() abort
let m = ' ❖ '
for mode in s:loaded_modes
let m .= s:modes[mode].icon . ' '
endfor
return m . ' '
let m = ' ❖ '
for mode in s:loaded_modes
let m .= s:modes[mode].icon . ' '
endfor
return m . ' '
endfunction
function! s:filesize() abort
let l:size = getfsize(bufname('%'))
if l:size == 0 || l:size == -1 || l:size == -2
return ''
endif
if l:size < 1024
return l:size.' bytes '
elseif l:size < 1024*1024
return printf('%.1f', l:size/1024.0).'k '
elseif l:size < 1024*1024*1024
return printf('%.1f', l:size/1024.0/1024.0) . 'm '
else
return printf('%.1f', l:size/1024.0/1024.0/1024.0) . 'g '
endif
let l:size = getfsize(bufname('%'))
if l:size == 0 || l:size == -1 || l:size == -2
return ''
endif
if l:size < 1024
return l:size.' bytes '
elseif l:size < 1024*1024
return printf('%.1f', l:size/1024.0).'k '
elseif l:size < 1024*1024*1024
return printf('%.1f', l:size/1024.0/1024.0) . 'm '
else
return printf('%.1f', l:size/1024.0/1024.0/1024.0) . 'g '
endif
endfunction
function! SpaceVim#layers#core#statusline#get(...) abort
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
elseif &filetype ==# 'startify'
call fugitive#detect(getcwd())
elseif &filetype ==# 'SpaceVimLayerManager'
return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# LayerManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
elseif &filetype ==# 'SpaceVimPlugManager'
return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# PlugManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
elseif &filetype ==# 'SpaceVimTabsManager'
return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# TabsManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
elseif &filetype ==# 'denite'
return '%#SpaceVim_statusline_a_bold# %{SpaceVim#layers#core#statusline#denite_mode()} '
\ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b#' . s:lsep . ' '
\ . '%#SpaceVim_statusline_b#%{denite#get_status_sources()} %#SpaceVim_statusline_b_SpaceVim_statusline_z#' . s:lsep . ' '
\ . '%#SpaceVim_statusline_z#%=%#SpaceVim_statusline_c_SpaceVim_statusline_z#' . s:rsep
\ . '%#SpaceVim_statusline_c# %{denite#get_status_path() . denite#get_status_linenr()}'
elseif &filetype ==# 'unite'
return '%#SpaceVim_statusline_a_bold#%{SpaceVim#layers#core#statusline#unite_mode()} Unite '
\ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b#' . s:lsep . ' %{get(unite#get_context(), "buffer_name", "")} '
\ . '%#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' '
\ . '%#SpaceVim_statusline_c# %{unite#get_status_string()} '
elseif &filetype ==# 'SpaceVimFlyGrep'
return '%#SpaceVim_statusline_a# FlyGrep %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# %{getcwd()}%#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
\ . '%#SpaceVim_statusline_c# %{SpaceVim#plugins#flygrep#lineNr()}'
elseif &filetype ==# 'TransientState'
return '%#SpaceVim_statusline_a# Transient State %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
elseif &filetype ==# 'HelpDescribe'
return '%#SpaceVim_statusline_a# HelpDescribe %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
endif
if a:0 > 0
return s:active()
else
return s:inactive()
endif
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
elseif &filetype ==# 'startify'
call fugitive#detect(getcwd())
elseif &filetype ==# 'SpaceVimLayerManager'
return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# LayerManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
elseif &filetype ==# 'SpaceVimPlugManager'
return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# PlugManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
elseif &filetype ==# 'SpaceVimTabsManager'
return '%#SpaceVim_statusline_a#' . s:winnr(1) . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# TabsManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
elseif &filetype ==# 'denite'
return '%#SpaceVim_statusline_a_bold# %{SpaceVim#layers#core#statusline#denite_mode()} '
\ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b#' . s:lsep . ' '
\ . '%#SpaceVim_statusline_b#%{denite#get_status_sources()} %#SpaceVim_statusline_b_SpaceVim_statusline_z#' . s:lsep . ' '
\ . '%#SpaceVim_statusline_z#%=%#SpaceVim_statusline_c_SpaceVim_statusline_z#' . s:rsep
\ . '%#SpaceVim_statusline_c# %{denite#get_status_path() . denite#get_status_linenr()}'
elseif &filetype ==# 'unite'
return '%#SpaceVim_statusline_a_bold#%{SpaceVim#layers#core#statusline#unite_mode()} Unite '
\ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b#' . s:lsep . ' %{get(unite#get_context(), "buffer_name", "")} '
\ . '%#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' '
\ . '%#SpaceVim_statusline_c# %{unite#get_status_string()} '
elseif &filetype ==# 'SpaceVimFlyGrep'
return '%#SpaceVim_statusline_a# FlyGrep %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
\ . '%#SpaceVim_statusline_b# %{getcwd()}%#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
\ . '%#SpaceVim_statusline_c# %{SpaceVim#plugins#flygrep#lineNr()}'
elseif &filetype ==# 'TransientState'
return '%#SpaceVim_statusline_a# Transient State %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
elseif &filetype ==# 'HelpDescribe'
return '%#SpaceVim_statusline_a# HelpDescribe %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
endif
if a:0 > 0
return s:active()
else
return s:inactive()
endif
endfunction
function! s:active() abort
let lsec = [s:winnr(), s:filename()]
if index(s:loaded_sections, 'search status') != -1
call add(lsec, s:search_status())
endif
if index(s:loaded_sections, 'major mode') != -1 && !empty(&filetype)
call add(lsec, ' ' . &filetype . ' ')
endif
let rsec = []
if index(s:loaded_sections, 'syntax checking') != -1 && s:syntax_checking() != ''
call add(lsec, s:syntax_checking())
endif
let lsec = [s:winnr(), s:filename()]
if index(s:loaded_sections, 'search status') != -1
call add(lsec, s:search_status())
endif
if index(s:loaded_sections, 'major mode') != -1 && !empty(&filetype)
call add(lsec, ' ' . &filetype . ' ')
endif
let rsec = []
if index(s:loaded_sections, 'syntax checking') != -1 && s:syntax_checking() != ''
call add(lsec, s:syntax_checking())
endif
if index(s:loaded_sections, 'minor mode lighters') != -1
call add(lsec, s:modes())
endif
if index(s:loaded_sections, 'version control info') != -1
call add(lsec, s:git_branch())
endif
call add(lsec, SpaceVim#plugins#searcher#count())
if index(s:loaded_sections, 'battery status') != -1
call add(rsec, s:battery_status())
endif
call add(rsec, '%{" " . &ff . " | " . (&fenc!=""?&fenc:&enc) . " "}')
if index(s:loaded_sections, 'cursorpos') != -1
call add(rsec, s:cursorpos())
endif
call add(rsec, ' %P ')
if index(s:loaded_sections, 'time') != -1
call add(rsec, s:time())
endif
if index(s:loaded_sections, 'minor mode lighters') != -1
call add(lsec, s:modes())
endif
if index(s:loaded_sections, 'version control info') != -1
call add(lsec, s:git_branch())
endif
call add(lsec, SpaceVim#plugins#searcher#count())
if index(s:loaded_sections, 'battery status') != -1
call add(rsec, s:battery_status())
endif
call add(rsec, '%{" " . &ff . " | " . (&fenc!=""?&fenc:&enc) . " "}')
if index(s:loaded_sections, 'cursorpos') != -1
call add(rsec, s:cursorpos())
endif
call add(rsec, ' %P ')
if index(s:loaded_sections, 'time') != -1
call add(rsec, s:time())
endif
if index(s:loaded_sections, 'whitespace') != -1
call add(rsec, s:whitespace())
endif
return s:STATUSLINE.build(lsec, rsec, s:lsep, s:rsep,
\ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z')
if index(s:loaded_sections, 'whitespace') != -1
call add(rsec, s:whitespace())
endif
return s:STATUSLINE.build(lsec, rsec, s:lsep, s:rsep,
\ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z')
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 '
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 '
endfunction
function! s:gitgutter() abort
if exists('b:gitgutter_summary')
let l:summary = get(b:, 'gitgutter_summary')
if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
endif
if exists('b:gitgutter_summary')
let l:summary = get(b:, 'gitgutter_summary')
if l:summary[0] != 0 || l:summary[1] != 0 || l:summary[2] != 0
return ' +'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2].' '
endif
return ''
endif
return ''
endfunction
function! SpaceVim#layers#core#statusline#init() abort
augroup SpaceVim_statusline
autocmd!
autocmd BufWinEnter,WinEnter,FileType
\ * let &l:statusline = SpaceVim#layers#core#statusline#get(1)
autocmd BufWinLeave,WinLeave * let &l:statusline = SpaceVim#layers#core#statusline#get()
autocmd ColorScheme * call SpaceVim#layers#core#statusline#def_colors()
augroup END
augroup SpaceVim_statusline
autocmd!
autocmd BufWinEnter,WinEnter,FileType
\ * let &l:statusline = SpaceVim#layers#core#statusline#get(1)
autocmd BufWinLeave,WinLeave * let &l:statusline = SpaceVim#layers#core#statusline#get()
autocmd ColorScheme * call SpaceVim#layers#core#statusline#def_colors()
augroup END
endfunction
let s:colors_template = SpaceVim#mapping#guide#theme#gruvbox#palette()
function! SpaceVim#layers#core#statusline#def_colors() abort
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
let s:colors_template = t
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
exe 'hi! SpaceVim_statusline_ia ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
exe 'hi! SpaceVim_statusline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0]
exe 'hi! SpaceVim_statusline_c ctermbg=' . t[2][2] . ' ctermfg=' . t[2][3] . ' guibg=' . t[2][1] . ' guifg=' . t[2][0]
exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[3][1] . ' guibg=' . t[3][0] . ' guifg=' . t[3][0]
hi! SpaceVim_statusline_error ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fb4934 gui=bold
hi! SpaceVim_statusline_warn ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fabd2f gui=bold
call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b')
call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b')
call s:HI.hi_separator('SpaceVim_statusline_ia', 'SpaceVim_statusline_b')
call s:HI.hi_separator('SpaceVim_statusline_b', 'SpaceVim_statusline_c')
call s:HI.hi_separator('SpaceVim_statusline_b', 'SpaceVim_statusline_z')
call s:HI.hi_separator('SpaceVim_statusline_c', 'SpaceVim_statusline_z')
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
let s:colors_template = t
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
exe 'hi! SpaceVim_statusline_ia ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
exe 'hi! SpaceVim_statusline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0]
exe 'hi! SpaceVim_statusline_c ctermbg=' . t[2][2] . ' ctermfg=' . t[2][3] . ' guibg=' . t[2][1] . ' guifg=' . t[2][0]
exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[3][1] . ' guibg=' . t[3][0] . ' guifg=' . t[3][0]
hi! SpaceVim_statusline_error ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fb4934 gui=bold
hi! SpaceVim_statusline_warn ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fabd2f gui=bold
call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b')
call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b')
call s:HI.hi_separator('SpaceVim_statusline_ia', 'SpaceVim_statusline_b')
call s:HI.hi_separator('SpaceVim_statusline_b', 'SpaceVim_statusline_c')
call s:HI.hi_separator('SpaceVim_statusline_b', 'SpaceVim_statusline_z')
call s:HI.hi_separator('SpaceVim_statusline_c', 'SpaceVim_statusline_z')
endfunction
function! SpaceVim#layers#core#statusline#toggle_mode(name) abort
if index(s:loaded_modes, a:name) != -1
call remove(s:loaded_modes, index(s:loaded_modes, a:name))
else
call add(s:loaded_modes, a:name)
endif
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
if index(s:loaded_modes, a:name) != -1
call remove(s:loaded_modes, index(s:loaded_modes, a:name))
else
call add(s:loaded_modes, a:name)
endif
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
endfunction
function! SpaceVim#layers#core#statusline#toggle_section(name) abort
if index(s:loaded_sections, a:name) != -1
call remove(s:loaded_sections, index(s:loaded_sections, a:name))
else
call add(s:loaded_sections, a:name)
endif
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
if index(s:loaded_sections, a:name) != -1
call remove(s:loaded_sections, index(s:loaded_sections, a:name))
else
call add(s:loaded_sections, a:name)
endif
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
endfunction
function! SpaceVim#layers#core#statusline#rsep()
return get(s:separators, g:spacevim_statusline_separator, s:separators['arrow'])
return get(s:separators, g:spacevim_statusline_separator, s:separators['arrow'])
endfunction
function! SpaceVim#layers#core#statusline#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:i_separators['arrow'])
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'm'], 'call SpaceVim#layers#core#statusline#toggle_section("minor mode lighters")',
\ 'toggle the minor mode lighters', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'v'], 'call SpaceVim#layers#core#statusline#toggle_section("version control info")',
\ 'version control info', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'M'], 'call SpaceVim#layers#core#statusline#toggle_section("major mode")',
\ 'toggle the major mode', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'b'], 'call SpaceVim#layers#core#statusline#toggle_section("battery status")',
\ 'toggle the battery status', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 't'], 'call SpaceVim#layers#core#statusline#toggle_section("time")',
\ 'toggle the time', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'p'], 'call SpaceVim#layers#core#statusline#toggle_section("cursorpos")',
\ '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)
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')
endfunction
let g:tagbar_status_func = 'TagbarStatusline'
let g:unite_force_overwrite_statusline = 0
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:i_separators['arrow'])
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'm'], 'call SpaceVim#layers#core#statusline#toggle_section("minor mode lighters")',
\ 'toggle the minor mode lighters', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'v'], 'call SpaceVim#layers#core#statusline#toggle_section("version control info")',
\ 'version control info', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'M'], 'call SpaceVim#layers#core#statusline#toggle_section("major mode")',
\ 'toggle the major mode', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'b'], 'call SpaceVim#layers#core#statusline#toggle_section("battery status")',
\ 'toggle the battery status', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 't'], 'call SpaceVim#layers#core#statusline#toggle_section("time")',
\ 'toggle the time', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'p'], 'call SpaceVim#layers#core#statusline#toggle_section("cursorpos")',
\ '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)
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')
endfunction
let g:tagbar_status_func = 'TagbarStatusline'
let g:unite_force_overwrite_statusline = 0
let g:ctrlp_status_func = {
\ 'main': 'SpaceVim#layers#core#statusline#ctrlp',
\ 'prog': 'SpaceVim#layers#core#statusline#ctrlp_status',
\ }
endfunction
" Arguments:
" |
" +- a:focus : The focus of the prompt: "prt" or "win".
" |
" +- a:byfname : In filename mode or in full path mode: "file" or "path".
" |
" +- a:regex : In regex mode: 1 or 0.
" |
" +- a:prev : The previous search mode.
" |
" +- a:item : The current search mode.
" |
" +- a:next : The next search mode.
" |
" +- a:marked : The number of marked files, or a comma separated list of
" the marked filenames.
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')
endfunction
" a:str : Either the number of files scanned so far, or a string indicating
" the current directory is being scanned with a user_command.
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')
endfunction
function! SpaceVim#layers#core#statusline#jump(i) abort
if winnr('$') >= a:i
exe a:i . 'wincmd w'
endif
if winnr('$') >= a:i
exe a:i . 'wincmd w'
endif
endfunction
function! SpaceVim#layers#core#statusline#mode(mode)
let t = s:colors_template
if get(w:, 'spacevim_statusline_mode', '') != a:mode
if a:mode == 'n'
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
elseif a:mode == 'i'
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
elseif a:mode == 'R'
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[6][3] . ' ctermfg=' . t[6][2] . ' guibg=' . t[6][1] . ' guifg=' . t[6][0]
elseif a:mode == 'v' || a:mode == 'V' || a:mode == '^V' || a:mode == 's' || a:mode == 'S' || a:mode == '^S'
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[5][3] . ' ctermfg=' . t[5][2] . ' guibg=' . t[5][1] . ' guifg=' . t[5][0]
endif
call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b')
let w:spacevim_statusline_mode = a:mode
let t = s:colors_template
if get(w:, 'spacevim_statusline_mode', '') != a:mode
if a:mode == 'n'
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
elseif a:mode == 'i'
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
elseif a:mode == 'R'
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[6][3] . ' ctermfg=' . t[6][2] . ' guibg=' . t[6][1] . ' guifg=' . t[6][0]
elseif a:mode == 'v' || a:mode == 'V' || a:mode == '^V' || a:mode == 's' || a:mode == 'S' || a:mode == '^S'
exe 'hi! SpaceVim_statusline_a ctermbg=' . t[5][3] . ' ctermfg=' . t[5][2] . ' guibg=' . t[5][1] . ' guifg=' . t[5][0]
endif
return ''
call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b')
let w:spacevim_statusline_mode = a:mode
endif
return ''
endfunction
function! SpaceVim#layers#core#statusline#denite_mode()
let t = s:colors_template
let dmode = split(denite#get_status_mode())[1]
if get(w:, 'spacevim_statusline_mode', '') != dmode
if dmode == 'NORMAL'
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
elseif dmode == 'INSERT'
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
endif
call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b')
let w:spacevim_statusline_mode = dmode
let t = s:colors_template
let dmode = split(denite#get_status_mode())[1]
if get(w:, 'spacevim_statusline_mode', '') != dmode
if dmode == 'NORMAL'
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
elseif dmode == 'INSERT'
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
endif
return dmode
call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b')
let w:spacevim_statusline_mode = dmode
endif
return dmode
endfunction
function! SpaceVim#layers#core#statusline#unite_mode()
let t = s:colors_template
let dmode = mode()
if get(w:, 'spacevim_statusline_mode', '') != dmode
if dmode == 'n'
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
elseif dmode == 'i'
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
endif
call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b')
let w:spacevim_statusline_mode = dmode
let t = s:colors_template
let dmode = mode()
if get(w:, 'spacevim_statusline_mode', '') != dmode
if dmode == 'n'
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0]
elseif dmode == 'i'
exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0]
endif
return ''
call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b')
let w:spacevim_statusline_mode = dmode
endif
return ''
endfunction
" vim:set et sw=2 cc=80:

View File

@ -2,12 +2,15 @@
" @section Default, default
" @parentsection layers
let s:filename = expand('<sfile>:~')
function! SpaceVim#layers#default#plugins() abort
let plugins = []
return plugins
endfunction
let s:lnum = expand('<slnum>') + 3
function! SpaceVim#layers#default#config() abort
" Unimpaired bindings
" Quickly add empty lines
@ -47,7 +50,27 @@ function! SpaceVim#layers#default#config() abort
" Select last paste
nnoremap <silent><expr> gp '`['.strpart(getregtype(), 0, 1).'`]'
call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'], "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')", 'Find files in the directory of the current buffer', 1)
let lnum = expand('<slnum>') + 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)
@ -63,7 +86,7 @@ function! SpaceVim#layers#default#config() abort
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 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'], '<C-o>', 'jump backward', 0)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'f'], '<C-i>', 'jump forward', 0)
call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'VimFiler -no-split', 'Explore current directory', 1)
@ -317,102 +340,102 @@ function! s:buffer_transient_state() abort
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' : [
\ ["\<C-1>" , ''],
\ ["\<C-2>" , ''],
\ ["\<C-3>" , ''],
\ ["\<C-4>" , ''],
\ ["\<C-5>" , ''],
\ ["\<C-6>" , ''],
\ ["\<C-7>" , ''],
\ ["\<C-8>" , ''],
\ ["\<C-9>" , ''],
\ ],
\ },
\ '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' : [
\ ["\<M-1>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [1])'],
\ ["\<M-2>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [2])'],
\ ["\<M-3>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [3])'],
\ ["\<M-4>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [4])'],
\ ["\<M-5>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [5])'],
\ ["\<M-6>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [6])'],
\ ["\<M-7>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [7])'],
\ ["\<M-8>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [8])'],
\ ["\<M-9>" , '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,
\ },
\ ],
\ 'layout' : 'vertical split',
\ 'left' : [
\ {
\ 'key' : {
\ 'name' : 'C-1..C-9',
\ 'pos' : [[1,4], [6,9]],
\ 'handles' : [
\ ["\<C-1>" , ''],
\ ["\<C-2>" , ''],
\ ["\<C-3>" , ''],
\ ["\<C-4>" , ''],
\ ["\<C-5>" , ''],
\ ["\<C-6>" , ''],
\ ["\<C-7>" , ''],
\ ["\<C-8>" , ''],
\ ["\<C-9>" , ''],
\ ],
\ },
\ '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' : [
\ ["\<M-1>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [1])'],
\ ["\<M-2>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [2])'],
\ ["\<M-3>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [3])'],
\ ["\<M-4>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [4])'],
\ ["\<M-5>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [5])'],
\ ["\<M-6>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [6])'],
\ ["\<M-7>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [7])'],
\ ["\<M-8>" , 'call call(' . string(s:_function('s:swap_buffer_with_nth_win')) . ', [8])'],
\ ["\<M-9>" , '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()

View File

@ -6,6 +6,7 @@ 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'],
\ ['terryma/vim-expand-region', { 'loadconf' : 1}],
@ -49,7 +50,7 @@ function! SpaceVim#layers#edit#config() abort
let g:_spacevim_mappings_space.x.i = {'name' : '+change symbol style'}
nnoremap <silent> <Plug>CountSelectionRegion :call <SID>count_selection_region()<Cr>
xnoremap <silent> <Plug>CountSelectionRegion :<C-u>call <SID>count_selection_region()<Cr>
call SpaceVim#mapping#space#def('nmap', ['x', 'c'], '<Plug>CountSelectionRegion', 'cunt in the selection region', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['x', 'c'], '<Plug>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)

View File

@ -10,7 +10,7 @@ function! SpaceVim#layers#lang#plugins() abort
\ ['juvenn/mustache.vim', { 'on_ft' : ['mustache']}],
\ ['leafgarland/typescript-vim', { 'on_ft' : ['typescript']}],
\ ['kchmck/vim-coffee-script', { 'on_ft' : ['coffee']}],
\ ['leshill/vim-json', { 'on_ft' : ['javascript','json']}],
\ ['elzr/vim-json', { 'on_ft' : ['javascript','json']}],
\ ['elixir-lang/vim-elixir', { 'on_ft' : 'elixir'}],
\ ['PotatoesMaster/i3-vim-syntax', { 'on_ft' : 'i3'}],
\ ['isundil/vim-irssi-syntax', { 'on_ft' : 'irssi'}],

View File

@ -0,0 +1,32 @@
"=============================================================================
" julia.vim --- Julia Language configuration for SpaceVim
" Copyright (c) 2012-2016 Shidong Wang & Contributors
" Author: Jinxuan Zhu <zhujinxuan@gmail.com>
" URL: https://spacevim.org
" License: MIT license
"=============================================================================
""
" @section lang#julia, layer-lang-julia
" @parentsection layers
" The layer provides synatax highlight and linting for julia.
" The completeion only works in nvim with deoplete.
" However, the julia-vim could not be load on-demanding
" due to its LaTeXToUnicode feature.
"
function! SpaceVim#layers#lang#julia#plugins() abort
let plugins = []
call add(plugins, ['JuliaEditorSupport/julia-vim' ])
if (has('nvim'))
call add(plugins, ['JuliaEditorSupport/deoplete-julia', {'on_ft' : 'julia'}])
endif
call add(plugins, ['zyedidia/julialint.vim', {'on_ft' : 'julia'}])
return plugins
endfunction
function! SpaceVim#layers#lang#julia#config() abort
let g:latex_to_unicode_tab = 0
au! BufNewFile,BufRead *.jl setf julia
au! BufNewFile,BufRead *.julia setf julia
endfunction

View File

@ -49,7 +49,7 @@ function! SpaceVim#layers#unite#plugins() abort
\ ['sgur/unite-everything'],
\ ['wsdjeg/unite-dwm'],
\ ['raw1z/unite-projects'],
\ ['voi/unite-ctags'],
\ ['SpaceVim/unite-ctags'],
\ ['Shougo/unite-session'],
\ ['osyo-manga/unite-quickfix'],
\ ['ujihisa/unite-colorscheme'],

View File

@ -68,6 +68,8 @@ function! SpaceVim#mapping#g#init() abort
nnoremap gn gn
let g:_spacevim_mappings_g['Q'] = ['call feedkeys("gQ", "n")', 'switch to Ex mode']
nnoremap gQ gQ
let g:_spacevim_mappings_g['q'] = ['call feedkeys("gq", "n")', 'format Nmove text']
nnoremap gq gq
let g:_spacevim_mappings_g['R'] = ['call feedkeys("gR", "n")', 'enter VREPLACE mode']
nnoremap gR gR
let g:_spacevim_mappings_g['T'] = ['call feedkeys("gT", "n")', 'previous tag page']
@ -94,10 +96,8 @@ function! SpaceVim#mapping#g#init() abort
nnoremap gs gs
let g:_spacevim_mappings_g['v'] = ['call feedkeys("gv", "n")', 'reselect the previous Visual area']
nnoremap gv gv
let g:_spacevim_mappings_g['<C-]>'] = ['call feedkeys("g<c-]>", "n")', 'jump to tag under cursor']
nnoremap g<c-]> g<c-]>
let g:_spacevim_mappings_g['d'] = ['call SpaceVim#mapping#gd()', 'goto definition']
call SpaceVim#mapping#def('nnoremap <silent>', 'gd', ':call SpaceVim#mapping#gd()<CR>', 'Goto declaration', '')

View File

@ -1,3 +1,4 @@
let s:file = expand('<sfile>:~')
function! SpaceVim#mapping#space#init() abort
if s:has_map_to_spc()
return
@ -63,19 +64,28 @@ function! SpaceVim#mapping#space#init() abort
call SpaceVim#mapping#space#def('nnoremap', ['w', 'W'], 'ChooseWin', 'select window', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'u'], 'call SpaceVim#plugins#windowsmanager#UndoQuitWin()', 'undo quieted window', 1)
call SpaceVim#mapping#space#def('nnoremap', ['w', 'U'], 'call SpaceVim#plugins#windowsmanager#RedoQuitWin()', 'redo quieted window', 1)
nnoremap <silent> [SPC]bn :bnext<CR>
let g:_spacevim_mappings_space.b.n = ['bnext', 'next buffer',
let s:lnum = expand('<slnum>') + 3
call SpaceVim#mapping#space#def('nnoremap', ['b', 'n'], 'bnext', ['next buffer',
\ [
\ 'SPC b n is running :bnext, jump to next buffer',
\ '[SPC b n] is running :bnext, jump to next buffer',
\ 'which is a vim build in command',
\ 'It is bound to SPC b n, ] b,',
\ '',
\ 'Definition: ' . s:file . ':' . s:lnum,
\ ]
\ ]
call SpaceVim#mapping#menu('Open next buffer', '[SPC]bn', 'bp')
nnoremap <silent> [SPC]bp :bp<CR>
let g:_spacevim_mappings_space.b.p = ['bp', 'previous buffer']
call SpaceVim#mapping#menu('Open previous buffer', '[SPC]bp', 'bp')
\ , 1)
let s:lnum = expand('<slnum>') + 3
call SpaceVim#mapping#space#def('nnoremap', ['b', 'p'], 'bp', ['previous buffer',
\ [
\ 'SPC b p is running :bp, jump to previous buffer',
\ 'which is a vim build in command',
\ 'It is bound to SPC b p, [ b,',
\ '',
\ 'Definition: ' . s:file . ':' . s:lnum,
\ ]
\ ]
\ , 1)
"
" Comments sections
"

View File

@ -208,7 +208,7 @@ function! SpaceVim#plugins#manager#update(...) abort
elseif reponame ==# 'SpaceVim'
let repo = {
\ 'name' : 'SpaceVim',
\ 'path' : expand('~/.SpaceVim')
\ 'path' : fnamemodify(g:Config_Main_Home, ':h')
\ }
call s:pull(repo)

View File

@ -1,4 +1,6 @@
let g:Config_Main_Home = fnamemodify(expand('<sfile>'), ':p:h:gs?\\?'.((has('win16') || has('win32') || has('win64'))?'\':'/') . '?')
let g:Config_Main_Home = fnamemodify(expand('<sfile>'),
\ ':p:h:gs?\\?'.((has('win16') || has('win32')
\ || has('win64'))?'\':'/') . '?')
" [dir?, path]
@ -58,3 +60,5 @@ endif
call zvim#util#source_rc('commands.vim')
filetype plugin indent on
syntax on
" vim:set et sw=2 cc=80:

View File

@ -20,7 +20,7 @@ if executable('rg') && !exists('g:ctrlp_user_command')
let g:ctrlp_user_command = 'rg %s --no-ignore --hidden --files -g "" '
\ . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'rg', 1))
elseif executable('ag') && !exists('g:ctrlp_user_command')
let g:ctrlp_user_command = 'ag %s --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'ag'))
let g:ctrlp_user_command = 'ag --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:spacevim_wildignore,'ag')) . ' %s'
endif
if !exists('g:ctrlp_match_func') && (has('python') || has('python3'))
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }

View File

@ -7,131 +7,131 @@ title: "Documentation"
<!-- vim-markdown-toc GFM -->
* [Core Pillars](#core-pillars)
* [Mnemonic](#mnemonic)
* [Discoverable](#discoverable)
* [Consistent](#consistent)
* [Crowd-Configured](#crowd-configured)
* [Mnemonic](#mnemonic)
* [Discoverable](#discoverable)
* [Consistent](#consistent)
* [Crowd-Configured](#crowd-configured)
* [Highlighted features](#highlighted-features)
* [Screenshots](#screenshots)
* [welcome page](#welcome-page)
* [working flow](#working-flow)
* [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)
* [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)
* [Configuration layers](#configuration-layers)
* [Custom Configuration](#custom-configuration)
* [Automatic Generation](#automatic-generation)
* [Alternative directory](#alternative-directory)
* [Automatic Generation](#automatic-generation)
* [Alternative directory](#alternative-directory)
* [Concepts](#concepts)
* [Transient-states](#transient-states)
* [Transient-states](#transient-states)
* [Awesome ui](#awesome-ui)
* [Colorschemes](#colorschemes)
* [Font](#font)
* [UI Toggles](#ui-toggles)
* [Statusline && tabline](#statusline--tabline)
* [statusline](#statusline)
* [tabline](#tabline)
* [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)
* [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)
* [Achievements](#achievements)
* [issues](#issues)
* [Stars, forks and watchers](#stars-forks-and-watchers)
* [issues](#issues)
* [Stars, forks and watchers](#stars-forks-and-watchers)
* [Features](#features)
* [Awesome ui](#awesome-ui-1)
* [Mnemonic key bindings](#mnemonic-key-bindings)
* [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)
* [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)
* [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)
* [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)
<!-- vim-markdown-toc -->
@ -848,7 +848,7 @@ SpaceVim use vimfiler as the default file tree, and the default key binding is `
let g:spacevim_filemanager = 'nerdtree'
```
VCS integration is supported, there will be a colum status, this feature maybe make vimfiler slow, so it is not enabled by default. to enable this feature, add `let g:spacevim_enable_vimfiler_gitstatus = 1` to your custom config. here is any picture for this feature:
VCS integration is supported, there will be a column status, this feature maybe make vimfiler slow, so it is not enabled by default. to enable this feature, add `let g:spacevim_enable_vimfiler_gitstatus = 1` to your custom config. here is any picture for this feature:
![file-tree](https://user-images.githubusercontent.com/13142418/26881817-279225b2-4bcb-11e7-8872-7e4bd3d1c84e.png)
@ -1196,7 +1196,7 @@ Text related commands (start with `x`):
| `SPC x a L` | right-align with evil-lion (TODO) |
| `SPC x a r` | align region using user-specified regexp (TODO) |
| `SPC x a m` | align region at arithmetic operators `(+-*/)` (TODO) |
| `SPC x c` | cunt the number of chars/words/lines in the selection region |
| `SPC x c` | count the number of chars/words/lines in the selection region |
| `SPC x d w` | delete trailing whitespaces |
| `SPC x d SPC` | Delete all spaces and tabs around point, leaving one space |
| `SPC x g l` | set lanuages used by translate commands (TODO) |

View File

@ -5,7 +5,7 @@ title: "Home"
# Introduction
[![Build Status](https://travis-ci.org/SpaceVim/SpaceVim.svg?branch=dev)](https://travis-ci.org/SpaceVim/SpaceVim)
![Version](https://img.shields.io/badge/version-0.4.0--dev-FF00CC.svg)
![Version](https://img.shields.io/badge/version-0.5.0--dev-FF00CC.svg)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/SpaceVim/SpaceVim/dev/LICENSE)
[![Doc](https://img.shields.io/badge/doc-%3Ah%20SpaceVim-orange.svg?style=flat-square)](https://raw.githubusercontent.com/SpaceVim/SpaceVim/dev/doc/SpaceVim.txt)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/SpaceVim/SpaceVim.svg)](http://isitmaintained.com/project/SpaceVim/SpaceVim "Average time to resolve an issue")

View File

@ -11,7 +11,7 @@
# Reset
Color_off='\033[0m' # Text Reset
Version='0.4.0-dev'
Version='0.5.0-dev'
# Regular Colors
Red='\033[0;31m'

View File

@ -44,17 +44,18 @@ call SpaceVim#layers#load('autocomplete')
You can customize the user experience of auto-completion with the following layer variables:
1. `auto-completion-return-key-behavior` set the action to perform when the `RET` key is pressed, the possible values are:
1. `auto-completion-return-key-behavior` set the action to perform when the `Return`/`Enter` key is pressed, the possible values are:
- `complete` completes with the current selection
- `nil` does nothing
- `smart` completes with current selection and expand snippet or argvs
- `nil`
2. `auto-completion-tab-key-behavior` set the action to perform when the `TAB` key is pressed, the possible values are:
- `smart` cycle candidates, expand snippets, jump parameters
- `complete` completes with the current selection
- `cycle` completes the common prefix and cycle between candidates
- `nil` does nothing
- `nil` insert a carriage return
3. `auto-completion-complete-with-key-sequence` is a string of two characters denoting a key sequence that will perform a `complete` action if the sequence as been entered quickly enough. If its value is `nil` then the feature is disabled.
4. `auto-completion-complete-with-key-sequence-delay` is the number of seconds to wait for the auto-completion key sequence to be entered. The default value is 0.1 seconds.
@ -98,13 +99,13 @@ call SpaceVim#layers#load('autocomplete', {
### auto-complete
| Key bindings | Description |
| ------------ | -------------------------------------------------------------------- |
| `<C-n>` | select next candidate |
| `<C-p>` | select previous candidate |
| `<Tab>` | expand selection or select next candidate |
| `<S-Tab>` | select previous candidate |
| `<Return>` | complete word, if word is already completed insert a carriage return |
| Key bindings | Description |
| ------------ | --------------------------------------------- |
| `<C-n>` | select next candidate |
| `<C-p>` | select previous candidate |
| `<Tab>` | base on `auto-completion-tab-key-behavior` |
| `<S-Tab>` | select previous candidate |
| `<Return>` | base on `auto-completion-return-key-behavior` |
### Neosnippet
@ -112,4 +113,3 @@ call SpaceVim#layers#load('autocomplete', {
| ----------- | -------------------------------------------------------------- |
| `M-/` | Expand a snippet if text before point is a prefix of a snippet |
| `SPC i s` | List all current yasnippets for inserting |

8
syntax/HelpDescribe.vim Normal file
View File

@ -0,0 +1,8 @@
if exists("b:current_syntax")
finish
endif
let b:current_syntax = "HelpDescribe"
syntax case ignore
syn match FileName /[^:]*:\d\+:/
hi def link FileName Comment