mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 09:40:06 +08:00
commit
3678b0c44d
@ -1,5 +1,5 @@
|
||||
function! s:body() abort
|
||||
return 'SpaceVim development (pre-release) build.'
|
||||
return 'SpaceVim development (pre-release:' . g:spacevim_version . ') build.'
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#dev#releases#open() abort
|
||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 SpaceVim
|
||||
Copyright (c) 2017 SpaceVim
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -44,7 +44,7 @@ to select the layers they need. It got inspired by [spacemacs](https://github.co
|
||||
please star it on github. It's a great way of getting feedback and gives me the kick to
|
||||
put more time into development.
|
||||
|
||||
![2017-04-29-20 54 49](https://cloud.githubusercontent.com/assets/13142418/25555650/d7d2c07e-2d1e-11e7-975d-646a07b38a62.png)
|
||||
![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).
|
||||
|
||||
|
@ -131,6 +131,9 @@ let g:spacevim_enable_neocomplcache = 0
|
||||
" <
|
||||
let g:spacevim_enable_cursorline = 1
|
||||
""
|
||||
" Set the statusline separators of statusline, default is 'arrow'
|
||||
let g:spacevim_statusline_separator = 'arrow'
|
||||
""
|
||||
" Enable/Disable cursorcolumn. Default is 0, cursorcolumn will be
|
||||
" highlighted in normal mode. To enable this feature:
|
||||
" >
|
||||
@ -479,6 +482,10 @@ function! SpaceVim#end() abort
|
||||
silent exec 'lan ' . g:spacevim_language
|
||||
endif
|
||||
|
||||
if index(g:spacevim_plugin_groups, 'core#statusline') != -1
|
||||
call SpaceVim#layers#core#statusline#init()
|
||||
endif
|
||||
|
||||
if g:spacevim_realtime_leader_guide
|
||||
nnoremap <silent><nowait> <leader> :<c-u>LeaderGuide get(g:, 'mapleader', '\')<CR>
|
||||
vnoremap <silent> <leader> :<c-u>LeaderGuideVisual get(g:, 'mapleader', '\')<CR>
|
||||
|
63
autoload/SpaceVim/api/color.vim
Normal file
63
autoload/SpaceVim/api/color.vim
Normal file
@ -0,0 +1,63 @@
|
||||
let s:self = {}
|
||||
|
||||
let s:self._color_map = {
|
||||
\ '0': '#000000', '1': '#800000', '2': '#008000', '3': '#808000', '4': '#000080',
|
||||
\ '5': '#800080', '6': '#008080', '7': '#c0c0c0', '8': '#808080', '9': '#ff0000',
|
||||
\ '10': '#00ff00', '11': '#ffff00', '12': '#0000ff', '13': '#ff00ff', '14': '#00ffff',
|
||||
\ '15': '#ffffff', '16': '#000000', '17': '#00005f', '18': '#000087', '19': '#0000af',
|
||||
\ '20': '#0000df', '21': '#0000ff', '22': '#005f00', '23': '#005f5f', '24': '#005f87',
|
||||
\ '25': '#005faf', '26': '#005fdf', '27': '#005fff', '28': '#008700', '29': '#00875f',
|
||||
\ '30': '#008787', '31': '#0087af', '32': '#0087df', '33': '#0087ff', '34': '#00af00',
|
||||
\ '35': '#00af5f', '36': '#00af87', '37': '#00afaf', '38': '#00afdf', '39': '#00afff',
|
||||
\ '40': '#00df00', '41': '#00df5f', '42': '#00df87', '43': '#00dfaf', '44': '#00dfdf',
|
||||
\ '45': '#00dfff', '46': '#00ff00', '47': '#00ff5f', '48': '#00ff87', '49': '#00ffaf',
|
||||
\ '50': '#00ffdf', '51': '#00ffff', '52': '#5f0000', '53': '#5f005f', '54': '#5f0087',
|
||||
\ '55': '#5f00af', '56': '#5f00df', '57': '#5f00ff', '58': '#5f5f00', '59': '#5f5f5f',
|
||||
\ '60': '#5f5f87', '61': '#5f5faf', '62': '#5f5fdf', '63': '#5f5fff', '64': '#5f8700',
|
||||
\ '65': '#5f875f', '66': '#5f8787', '67': '#5f87af', '68': '#5f87df', '69': '#5f87ff',
|
||||
\ '70': '#5faf00', '71': '#5faf5f', '72': '#5faf87', '73': '#5fafaf', '74': '#5fafdf',
|
||||
\ '75': '#5fafff', '76': '#5fdf00', '77': '#5fdf5f', '78': '#5fdf87', '79': '#5fdfaf',
|
||||
\ '80': '#5fdfdf', '81': '#5fdfff', '82': '#5fff00', '83': '#5fff5f', '84': '#5fff87',
|
||||
\ '85': '#5fffaf', '86': '#5fffdf', '87': '#5fffff', '88': '#870000', '89': '#87005f',
|
||||
\ '90': '#870087', '91': '#8700af', '92': '#8700df', '93': '#8700ff', '94': '#875f00',
|
||||
\ '95': '#875f5f', '96': '#875f87', '97': '#875faf', '98': '#875fdf', '99': '#875fff',
|
||||
\ '100': '#878700', '101': '#87875f', '102': '#878787', '103': '#8787af', '104': '#8787df',
|
||||
\ '105': '#8787ff', '106': '#87af00', '107': '#87af5f', '108': '#87af87', '109': '#87afaf',
|
||||
\ '110': '#87afdf', '111': '#87afff', '112': '#87df00', '113': '#87df5f', '114': '#87df87',
|
||||
\ '115': '#87dfaf', '116': '#87dfdf', '117': '#87dfff', '118': '#87ff00', '119': '#87ff5f',
|
||||
\ '120': '#87ff87', '121': '#87ffaf', '122': '#87ffdf', '123': '#87ffff', '124': '#af0000',
|
||||
\ '125': '#af005f', '126': '#af0087', '127': '#af00af', '128': '#af00df', '129': '#af00ff',
|
||||
\ '130': '#af5f00', '131': '#af5f5f', '132': '#af5f87', '133': '#af5faf', '134': '#af5fdf',
|
||||
\ '135': '#af5fff', '136': '#af8700', '137': '#af875f', '138': '#af8787', '139': '#af87af',
|
||||
\ '140': '#af87df', '141': '#af87ff', '142': '#afaf00', '143': '#afaf5f', '144': '#afaf87',
|
||||
\ '145': '#afafaf', '146': '#afafdf', '147': '#afafff', '148': '#afdf00', '149': '#afdf5f',
|
||||
\ '150': '#afdf87', '151': '#afdfaf', '152': '#afdfdf', '153': '#afdfff', '154': '#afff00',
|
||||
\ '155': '#afff5f', '156': '#afff87', '157': '#afffaf', '158': '#afffdf', '159': '#afffff',
|
||||
\ '160': '#df0000', '161': '#df005f', '162': '#df0087', '163': '#df00af', '164': '#df00df',
|
||||
\ '165': '#df00ff', '166': '#df5f00', '167': '#df5f5f', '168': '#df5f87', '169': '#df5faf',
|
||||
\ '170': '#df5fdf', '171': '#df5fff', '172': '#df8700', '173': '#df875f', '174': '#df8787',
|
||||
\ '175': '#df87af', '176': '#df87df', '177': '#df87ff', '178': '#dfaf00', '179': '#dfaf5f',
|
||||
\ '180': '#dfaf87', '181': '#dfafaf', '182': '#dfafdf', '183': '#dfafff', '184': '#dfdf00',
|
||||
\ '185': '#dfdf5f', '186': '#dfdf87', '187': '#dfdfaf', '188': '#dfdfdf', '189': '#dfdfff',
|
||||
\ '190': '#dfff00', '191': '#dfff5f', '192': '#dfff87', '193': '#dfffaf', '194': '#dfffdf',
|
||||
\ '195': '#dfffff', '196': '#ff0000', '197': '#ff005f', '198': '#ff0087', '199': '#ff00af',
|
||||
\ '200': '#ff00df', '201': '#ff00ff', '202': '#ff5f00', '203': '#ff5f5f', '204': '#ff5f87',
|
||||
\ '205': '#ff5faf', '206': '#ff5fdf', '207': '#ff5fff', '208': '#ff8700', '209': '#ff875f',
|
||||
\ '210': '#ff8787', '211': '#ff87af', '212': '#ff87df', '213': '#ff87ff', '214': '#ffaf00',
|
||||
\ '215': '#ffaf5f', '216': '#ffaf87', '217': '#ffafaf', '218': '#ffafdf', '219': '#ffafff',
|
||||
\ '220': '#ffdf00', '221': '#ffdf5f', '222': '#ffdf87', '223': '#ffdfaf', '224': '#ffdfdf',
|
||||
\ '225': '#ffdfff', '226': '#ffff00', '227': '#ffff5f', '228': '#ffff87', '229': '#ffffaf',
|
||||
\ '230': '#ffffdf', '231': '#ffffff', '232': '#080808', '233': '#121212', '234': '#1c1c1c',
|
||||
\ '235': '#262626', '236': '#303030', '237': '#3a3a3a', '238': '#444444', '239': '#4e4e4e',
|
||||
\ '240': '#585858', '241': '#606060', '242': '#666666', '243': '#767676', '244': '#808080',
|
||||
\ '245': '#8a8a8a', '246': '#949494', '247': '#9e9e9e', '248': '#a8a8a8', '249': '#b2b2b2',
|
||||
\ '250': '#bcbcbc', '251': '#c6c6c6', '252': '#d0d0d0', '253': '#dadada', '254': '#e4e4e4',
|
||||
\ '255': '#eeeeee', 'fg': 'fg', 'bg': 'bg', 'NONE': 'NONE' }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function! SpaceVim#api#color#get() abort
|
||||
return deepcopy(s:self)
|
||||
endfunction
|
@ -1,6 +1,7 @@
|
||||
scriptencoding utf-8
|
||||
let s:file = {}
|
||||
let s:system = SpaceVim#api#import('system')
|
||||
let s:vim_comp = SpaceVim#api#import('vim#compatible')
|
||||
|
||||
if s:system.isWindows
|
||||
let s:file['separator'] = '\'
|
||||
@ -175,6 +176,16 @@ endfunction
|
||||
|
||||
let s:file['read'] = function('s:read')
|
||||
|
||||
function! s:ls(dir, if_file_only) abort
|
||||
let items = s:vim_comp.globpath(a:dir, '*')
|
||||
if a:if_file_only
|
||||
let items = filter(items, '!isdirectory(v:val)')
|
||||
endif
|
||||
return map(items, "fnamemodify(v:val, ':t')")
|
||||
endfunction
|
||||
|
||||
let s:file['ls'] = function('s:ls')
|
||||
|
||||
function! SpaceVim#api#file#get() abort
|
||||
return deepcopy(s:file)
|
||||
endfunction
|
||||
|
11
autoload/SpaceVim/api/time.vim
Normal file
11
autoload/SpaceVim/api/time.vim
Normal file
@ -0,0 +1,11 @@
|
||||
let s:self = {}
|
||||
|
||||
" see: man 3 strftime
|
||||
function! s:self.current_time() abort
|
||||
return strftime('%I:%M %p')
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#api#time#get() abort
|
||||
return deepcopy(s:self)
|
||||
endfunction
|
@ -36,6 +36,10 @@ func! s:self.resize(size, ...) abort
|
||||
exe cmd 'resize' a:size
|
||||
endf
|
||||
|
||||
function! s:self.listed_buffers() abort
|
||||
return filter(range(1, bufnr('$')), 'buflisted(v:val)')
|
||||
endfunction
|
||||
|
||||
fu! SpaceVim#api#vim#buffer#get() abort
|
||||
return deepcopy(s:self)
|
||||
endf
|
||||
|
@ -3,28 +3,36 @@ function! SpaceVim#api#vim#compatible#get() abort
|
||||
\ 'execute' : '',
|
||||
\ 'system' : '',
|
||||
\ 'systemlist' : '',
|
||||
\ 'globpath' : '',
|
||||
\ },
|
||||
\ "function('s:' . v:key)"
|
||||
\ )
|
||||
endfunction
|
||||
|
||||
function! s:execute(cmd, ...) abort
|
||||
if a:0 == 0
|
||||
let s = 'silent'
|
||||
else
|
||||
let s = a:1
|
||||
endif
|
||||
redir => output
|
||||
if s ==# 'silent'
|
||||
silent execute a:cmd
|
||||
elseif s ==# 'silent!'
|
||||
silent! execute a:cmd
|
||||
else
|
||||
execute a:cmd
|
||||
endif
|
||||
redir END
|
||||
return output
|
||||
endfunction
|
||||
|
||||
if exists('*execute')
|
||||
function! s:execute(cmd, ...) abort
|
||||
return call('execute', [a:cmd] + a:000)
|
||||
endfunction
|
||||
else
|
||||
function! s:execute(cmd, ...) abort
|
||||
if a:0 == 0
|
||||
let s = 'silent'
|
||||
else
|
||||
let s = a:1
|
||||
endif
|
||||
redir => output
|
||||
if s ==# 'silent'
|
||||
silent execute a:cmd
|
||||
elseif s ==# 'silent!'
|
||||
silent! execute a:cmd
|
||||
else
|
||||
execute a:cmd
|
||||
endif
|
||||
redir END
|
||||
return output
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if has('nvim')
|
||||
function! s:system(cmd, ...) abort
|
||||
@ -68,4 +76,14 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
if has('patch-7.4.279')
|
||||
function! s:globpath(dir, expr) abort
|
||||
return globpath(a:dir, a:expr, 1, 1)
|
||||
endfunction
|
||||
else
|
||||
function! s:globpath(dir, expr) abort
|
||||
return split(globpath(a:dir, a:expr), '\n')
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -1,18 +1,18 @@
|
||||
let s:self = {}
|
||||
|
||||
function! s:self.group2dict(name) abort
|
||||
let id = index(map(range(999), 'synIDattr(v:val, "name")'), a:name)
|
||||
let id = index(map(range(999), "synIDattr(v:val, 'name')"), a:name)
|
||||
if id == -1
|
||||
return {}
|
||||
endif
|
||||
let rst = {
|
||||
\ 'name' : synIDattr(id, 'name'),
|
||||
\ 'ctermbg' : synIDattr(id, 'bg'),
|
||||
\ 'ctermfg' : synIDattr(id, 'fg'),
|
||||
\ 'ctermbg' : synIDattr(id, 'bg', 'cterm'),
|
||||
\ 'ctermfg' : synIDattr(id, 'fg', 'cterm'),
|
||||
\ 'bold' : synIDattr(id, 'bold'),
|
||||
\ 'italic' : synIDattr(id, 'italic'),
|
||||
\ 'underline' : synIDattr(id, 'underline'),
|
||||
\ 'guibg' :synIDattr(id, 'bg#'),
|
||||
\ 'guibg' : synIDattr(id, 'bg#'),
|
||||
\ 'guifg' : synIDattr(id, 'fg#'),
|
||||
\ }
|
||||
return rst
|
||||
@ -69,7 +69,6 @@ function! s:self.hide_in_normal(name) abort
|
||||
return
|
||||
endif
|
||||
if &termguicolors || has('gui_running')
|
||||
let g:wsd = self.group2dict('Normal')
|
||||
let bg = self.group2dict('Normal').guibg
|
||||
let group.guifg = bg
|
||||
let group.guibg = bg
|
||||
@ -81,6 +80,28 @@ function! s:self.hide_in_normal(name) abort
|
||||
call self.hi(group)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:self.hi_separator(a, b) abort
|
||||
let hi_a = self.group2dict(a:a)
|
||||
let hi_b = self.group2dict(a:b)
|
||||
let hi_a_b = {
|
||||
\ 'name' : a:a . '_' . a:b,
|
||||
\ 'guibg' : hi_b.guibg,
|
||||
\ 'guifg' : hi_a.guibg,
|
||||
\ 'ctermbg' : hi_b.ctermbg,
|
||||
\ 'ctermfg' : hi_a.ctermbg,
|
||||
\ }
|
||||
let hi_b_a = {
|
||||
\ 'name' : a:b . '_' . a:a,
|
||||
\ 'guibg' : hi_a.guibg,
|
||||
\ 'guifg' : hi_b.guibg,
|
||||
\ 'ctermbg' : hi_a.ctermbg,
|
||||
\ 'ctermfg' : hi_b.ctermbg,
|
||||
\ }
|
||||
call self.hi(hi_a_b)
|
||||
call self.hi(hi_b_a)
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#api#vim#highlight#get() abort
|
||||
return deepcopy(s:self)
|
||||
endfunction
|
||||
|
48
autoload/SpaceVim/api/vim/statusline.vim
Normal file
48
autoload/SpaceVim/api/vim/statusline.vim
Normal file
@ -0,0 +1,48 @@
|
||||
let s:self = {}
|
||||
|
||||
|
||||
function! s:self.build(left_sections, right_sections, lsep, rsep, hi_a, hi_b, hi_c, hi_z) 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[:-4]
|
||||
if empty(a:right_sections)
|
||||
if flag == 1
|
||||
return l . '%#' . a:hi_c . '#'
|
||||
else
|
||||
return l . '%#' . a:hi_b . '#'
|
||||
endif
|
||||
endif
|
||||
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
|
||||
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]
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#api#vim#statusline#get() abort
|
||||
return deepcopy(s:self)
|
||||
endfunction
|
@ -123,6 +123,15 @@ function! SpaceVim#autocmds#VimEnter() abort
|
||||
for argv in g:_spacevim_mappings_space_custom
|
||||
call call('SpaceVim#mapping#space#def', argv)
|
||||
endfor
|
||||
if get(g:, '_spacevim_statusline_loaded', 0) == 1
|
||||
set laststatus=2
|
||||
call SpaceVim#layers#core#statusline#def_colors()
|
||||
setlocal statusline=%!SpaceVim#layers#core#statusline#get(1)
|
||||
endif
|
||||
if get(g:, '_spacevim_tabline_loaded', 0) == 1
|
||||
call SpaceVim#layers#core#tabline#def_colors()
|
||||
set showtabline=2
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
|
@ -132,6 +132,8 @@ function! SpaceVim#default#SetPlugins() abort
|
||||
call add(g:spacevim_plugin_groups, 'misc')
|
||||
|
||||
call add(g:spacevim_plugin_groups, 'core')
|
||||
call SpaceVim#layers#load('core#statusline')
|
||||
call SpaceVim#layers#load('core#tabline')
|
||||
call add(g:spacevim_plugin_groups, 'default')
|
||||
call add(g:spacevim_plugin_groups, 'unite')
|
||||
call add(g:spacevim_plugin_groups, 'github')
|
||||
@ -189,17 +191,10 @@ function! SpaceVim#default#SetMappings() abort
|
||||
exe 'tnoremap <silent><esc> <C-\><C-n>'
|
||||
endif
|
||||
|
||||
"Quickly add empty lines
|
||||
nnoremap <silent>[<space> :<c-u>put! =repeat(nr2char(10), v:count1)<cr>
|
||||
nnoremap <silent>]<space> :<c-u>put =repeat(nr2char(10), v:count1)<cr>
|
||||
|
||||
"Use jk switch to normal mode
|
||||
inoremap jk <esc>
|
||||
|
||||
"]e or [e move current line ,count can be useed
|
||||
nnoremap <silent>[e :<c-u>execute 'move -1-'. v:count1<cr>
|
||||
nnoremap <silent>]e :<c-u>execute 'move +'. v:count1<cr>
|
||||
|
||||
"]<End> or ]<Home> move current line to the end or the begin of current buffer
|
||||
nnoremap <silent>]<End> ddGp``
|
||||
nnoremap <silent>]<Home> ddggP``
|
||||
@ -245,8 +240,6 @@ function! SpaceVim#default#SetMappings() abort
|
||||
nnoremap <silent><Down> gj
|
||||
nnoremap <silent><Up> gk
|
||||
|
||||
" Select last paste
|
||||
nnoremap <silent><expr> gp '`['.strpart(getregtype(), 0, 1).'`]'
|
||||
|
||||
" Use Q format lines
|
||||
map Q gq
|
||||
|
@ -9,6 +9,8 @@ endfunction
|
||||
function! SpaceVim#layers#core#config() abort
|
||||
let g:rooter_silent_chdir = 1
|
||||
call SpaceVim#layers#load('core#banner')
|
||||
call SpaceVim#layers#load('core#statusline')
|
||||
call SpaceVim#layers#load('core#tabline')
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 't'], 'Rooter', 'find-project-root', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'], 'CtrlP', 'find files in current project', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['p', '/'], 'Grepper', 'fuzzy search for text in current project', 1)
|
||||
|
@ -1,40 +1,298 @@
|
||||
let g:spacevim_statusline_mode_format = {
|
||||
\ 'n' : 'NORMAL',
|
||||
\ 'i' : 'INSERT',
|
||||
\ 'v' : 'VISUAL',
|
||||
" ============================================================================
|
||||
" File: statusline.vim
|
||||
" Description: SpaceVim core#statusline layer
|
||||
" Author: Shidong Wang <wsdjeg@outlook.com>
|
||||
" Website: https://spacevim.org
|
||||
" License: MIT
|
||||
" ============================================================================
|
||||
|
||||
" statusline
|
||||
scriptencoding utf-8
|
||||
let g:_spacevim_statusline_loaded = 1
|
||||
" APIs
|
||||
let s:MESSLETTERS = SpaceVim#api#import('messletters')
|
||||
let s:TIME = SpaceVim#api#import('time')
|
||||
let s:HI = SpaceVim#api#import('vim#highlight')
|
||||
let s:STATUSLINE = SpaceVim#api#import('vim#statusline')
|
||||
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' : ['', ''],
|
||||
\ }
|
||||
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',
|
||||
\ },
|
||||
\ }
|
||||
|
||||
"""""""""""""""""""""""""""""""""
|
||||
let s:loaded_sections = ['syntax checking', 'major mode', 'minor mode lighters', 'version control info']
|
||||
|
||||
function! s:mode() abort
|
||||
let mt = g:spacevim_statusline_mode_format
|
||||
let m = mode()
|
||||
return mt[m]
|
||||
function! s:battery_status() abort
|
||||
if executable('acpi')
|
||||
return ' ⚡' . substitute(split(system('acpi'))[-1], '%', '%%', 'g') . ' '
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:filetype() abort
|
||||
return &filetype
|
||||
function! s:search_status() abort
|
||||
let ct = 0
|
||||
let tt = 0
|
||||
let ctl = split(s:VIMCOMP.execute('.,$s/' . @/ . '//gn', 'silent!'), "\n")
|
||||
if !empty(ctl)
|
||||
let ct = split(ctl[0])[0]
|
||||
endif
|
||||
let ttl = split(s:VIMCOMP.execute('%s/' . @/ . '//gn', 'silent!'), "\n")
|
||||
if !empty(ctl)
|
||||
let tt = split(ttl[0])[0]
|
||||
endif
|
||||
return ' ' . (str2nr(tt) - str2nr(ct) + 1) . '/' . tt . ' '
|
||||
endfunction
|
||||
|
||||
function! s:encoding() abort
|
||||
return &encoding
|
||||
function! s:time() abort
|
||||
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 l = warnings ? '%#SpaceVim_statusline_warn#●' . warnings : ''
|
||||
let counts = neomake#statusline#LoclistCounts()
|
||||
let errors = get(counts, 'E', 0)
|
||||
let l .= errors ? ' %#SpaceVim_statusline_error#●' . errors : ''
|
||||
return l
|
||||
endfunction
|
||||
else
|
||||
endif
|
||||
|
||||
function! s:winnr() abort
|
||||
return ' ' . s:MESSLETTERS.circled_num(winnr(), g:spacevim_buffer_index_type) . ' '
|
||||
endfunction
|
||||
|
||||
function! s:filename() abort
|
||||
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 . ' '
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:whitespace() abort
|
||||
let ln = search('\s\+$', 'n')
|
||||
if ln != 0
|
||||
return ' trailing[' . ln . '] '
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:tabname() abort
|
||||
return '1'
|
||||
function! s:modes() abort
|
||||
let m = ' ❖ '
|
||||
for mode in s:loaded_modes
|
||||
let m .= s:modes[mode].icon . ' '
|
||||
endfor
|
||||
return m . ' '
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#get() abort
|
||||
return join([
|
||||
\ s:mode(),
|
||||
\ s:tabname(),
|
||||
\ s:encoding(),
|
||||
\ s:filetype()
|
||||
\ ], ' ')
|
||||
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
|
||||
endfunction
|
||||
|
||||
function! s:refresh() abort
|
||||
function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
if &filetype ==# 'vimfiler'
|
||||
return '%#SpaceVim_statusline_a#' . s:winnr() . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
\ . '%#SpaceVim_statusline_b# vimfiler %#SpaceVim_statusline_b_SpaceVim_statusline_c#'
|
||||
elseif &filetype ==# 'tagbar'
|
||||
return '%#SpaceVim_statusline_a# ' . s:winnr() . ' %#SpaceVim_statusline_a_b#'
|
||||
\ . '%#SpaceVim_statusline_b# tagbar %#SpaceVim_statusline_b_c#'
|
||||
elseif &filetype ==# 'startify'
|
||||
call fugitive#detect(getcwd())
|
||||
endif
|
||||
if a:0 > 0
|
||||
return s:active()
|
||||
else
|
||||
return s:inactive()
|
||||
endif
|
||||
endfunction
|
||||
set statusline=%!SpaceVim#layers#core#statusline#get()
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
if index(s:loaded_sections, 'battery status') != -1
|
||||
call add(rsec, s:battery_status())
|
||||
endif
|
||||
call add(rsec, '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}')
|
||||
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')
|
||||
endfunction
|
||||
|
||||
function! s:inactive() abort
|
||||
return '%#SpaceVim_statusline_a#' . s:winnr() . '%#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
\ . '%#SpaceVim_statusline_b#' . s:filename() . ''
|
||||
\ . ' ' . &filetype . ' '
|
||||
\ . s:modes() . ''
|
||||
\ . s:git_branch() . ''
|
||||
\ . ' %='
|
||||
\ . '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}'
|
||||
\ . ' %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
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#init() abort
|
||||
augroup status
|
||||
autocmd!
|
||||
autocmd BufWinEnter,WinEnter * let &l:statusline = SpaceVim#layers#core#statusline#get(1)
|
||||
autocmd BufWinLeave,WinLeave * let &l:statusline = SpaceVim#layers#core#statusline#get()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
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
|
||||
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_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_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)
|
||||
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)
|
||||
endfunction
|
||||
|
||||
function! Test() abort
|
||||
echo s:loaded_modes
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#statusline#config() abort
|
||||
let [s:lsep , s:rsep] = get(s:separators, g:spacevim_statusline_separator, s: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', 'T'], 'if &laststatus == 2 | let &laststatus = 0 | else | let &laststatus = 2 | endif',
|
||||
\ 'toggle the statuline itself', 1)
|
||||
function! TagbarStatusline(...) abort
|
||||
return s:STATUSLINE.build([s:winnr(),' Tagbar ', ' ' . a:3 . ' '], [], s:lsep, s:rsep,
|
||||
\ 'SpaceVim_statusline_a', 'SpaceVim_statusline_b', 'SpaceVim_statusline_c', 'SpaceVim_statusline_z')
|
||||
endfunction
|
||||
let g:tagbar_status_func = 'TagbarStatusline'
|
||||
endfunction
|
||||
|
@ -11,9 +11,14 @@
|
||||
" @parentsection layers
|
||||
" This layer provides default tabline for SpaceVim
|
||||
|
||||
scriptencoding utf-8
|
||||
let s:messletters = SpaceVim#api#import('messletters')
|
||||
let s:file = SpaceVim#api#import('file')
|
||||
let s:BUFFER = SpaceVim#api#import('vim#buffer')
|
||||
let s:HI = SpaceVim#api#import('vim#highlight')
|
||||
|
||||
let g:_spacevim_tabline_loaded = 1
|
||||
let s:buffers = s:BUFFER.listed_buffers()
|
||||
|
||||
function! s:tabname(id) abort
|
||||
let id = s:messletters.bubble_num(a:id, g:spacevim_buffer_index_type) . ' '
|
||||
@ -32,28 +37,104 @@ function! s:tabname(id) abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#get() abort
|
||||
let t = ' '
|
||||
let nr = tabpagenr()
|
||||
" if nr > 1
|
||||
for i in range(1, nr)
|
||||
let buflist = tabpagebuflist(i)
|
||||
let winnr = tabpagewinnr(i)
|
||||
let name = fnamemodify(bufname(buflist[winnr - 1]), ':t')
|
||||
let id = s:messletters.bubble_num(i, g:spacevim_buffer_index_type)
|
||||
let icon = s:file.fticon(name)
|
||||
if !empty(icon)
|
||||
let name = icon . ' ' . name
|
||||
endif
|
||||
let t .= id . ' ' . name
|
||||
if i == nr
|
||||
let t .= '%#TabLineSel#'
|
||||
let nr = tabpagenr('$')
|
||||
let t = ''
|
||||
if nr > 1
|
||||
let ct = tabpagenr()
|
||||
if ct == 1
|
||||
let t = '%#SpaceVim_tabline_a# '
|
||||
else
|
||||
let t .= '%#TabLine# | '
|
||||
let t = '%#SpaceVim_tabline_b# '
|
||||
endif
|
||||
endfor
|
||||
let t .= '%#TabLineFill#%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
|
||||
let id = s:messletters.bubble_num(i, g:spacevim_buffer_index_type)
|
||||
let icon = s:file.fticon(name)
|
||||
if !empty(icon)
|
||||
let name = icon . ' ' . name
|
||||
endif
|
||||
let t .= id . ' ' . name
|
||||
if i == ct - 1
|
||||
let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a# '
|
||||
elseif i == ct
|
||||
let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b# '
|
||||
else
|
||||
let t .= ' '
|
||||
endif
|
||||
endfor
|
||||
let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#'
|
||||
let t .= '%#SpaceVim_tabline_a# Tabs'
|
||||
else
|
||||
let s:buffers = s:BUFFER.listed_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
|
||||
let id = s:messletters.bubble_num(index(s:buffers, i) + 1, g:spacevim_buffer_index_type)
|
||||
let icon = s:file.fticon(name)
|
||||
if !empty(icon)
|
||||
let name = icon . ' ' . name
|
||||
endif
|
||||
let t .= id . ' ' . name
|
||||
if i == ct
|
||||
let t .= ' %#SpaceVim_tabline_a_SpaceVim_tabline_b# '
|
||||
elseif i == pt
|
||||
let t .= ' %#SpaceVim_tabline_b_SpaceVim_tabline_a# '
|
||||
else
|
||||
let t .= ' '
|
||||
endif
|
||||
endfor
|
||||
let t .= '%=%#SpaceVim_tabline_a_SpaceVim_tabline_b#'
|
||||
let t .= '%#SpaceVim_tabline_a# Buffers'
|
||||
endif
|
||||
return t
|
||||
endfunction
|
||||
function! SpaceVim#layers#core#tabline#config() abort
|
||||
set tabline=%!SpaceVim#layers#core#tabline#get()
|
||||
for i in range(1, 9)
|
||||
exe "call SpaceVim#mapping#space#def('nnoremap', [" . i . "], 'call SpaceVim#layers#core#tabline#jump(" . i . ")', 'window " . i . "', 1)"
|
||||
endfor
|
||||
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 'b' . bid
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#core#tabline#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
|
||||
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]
|
||||
call s:HI.hi_separator('SpaceVim_tabline_a', 'SpaceVim_tabline_b')
|
||||
endfunction
|
||||
|
@ -9,20 +9,115 @@ function! SpaceVim#layers#default#plugins() abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#default#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'], "exe 'CtrlP ' . fnamemodify(bufname('%'), ':h')", 'Find files in the directory of the current buffer', 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)
|
||||
" Unimpaired bindings
|
||||
" Quickly add empty lines
|
||||
nnoremap <silent> [<space> :<c-u>put! =repeat(nr2char(10), v:count1)<cr>
|
||||
nnoremap <silent> ]<space> :<c-u>put =repeat(nr2char(10), v:count1)<cr>
|
||||
|
||||
"]e or [e move current line ,count can be useed
|
||||
nnoremap <silent>[e :<c-u>execute 'move -1-'. v:count1<cr>
|
||||
nnoremap <silent>]e :<c-u>execute 'move +'. v:count1<cr>
|
||||
|
||||
" [b or ]n go to previous or next buffer
|
||||
nnoremap <silent> [b :<c-u>bN<cr>
|
||||
nnoremap <silent> ]b :<c-u>bn<cr>
|
||||
|
||||
" [f or ]f go to next or previous file in dir
|
||||
nnoremap <silent> ]f :<c-u>call <SID>next_file()<cr>
|
||||
nnoremap <silent> [f :<c-u>call <SID>previous_file()<cr>
|
||||
|
||||
" [l or ]l go to next and previous error
|
||||
nnoremap <silent> [l :lprevious<cr>
|
||||
nnoremap <silent> ]l :lnext<cr>
|
||||
|
||||
" [c or ]c go to next or previous vcs hunk
|
||||
|
||||
" [w or ]w go to next or previous window
|
||||
nnoremap <silent> [w :call <SID>previous_window()<cr>
|
||||
nnoremap <silent> ]w :call <SID>next_window()<cr>
|
||||
|
||||
" [t or ]t for next and previous tab
|
||||
nnoremap <silent> [t :tabprevious<cr>
|
||||
nnoremap <silent> ]t :tabnext<cr>
|
||||
|
||||
" [p or ]p for p and P
|
||||
nnoremap <silent> [p P
|
||||
nnoremap <silent> ]p p
|
||||
|
||||
" 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)
|
||||
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 beginning of line', 0)
|
||||
endfunction
|
||||
|
||||
let s:file = SpaceVim#api#import('file')
|
||||
|
||||
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
|
||||
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
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:next_window() abort
|
||||
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
|
||||
endfunction
|
||||
|
@ -37,8 +37,8 @@ function! SpaceVim#layers#incsearch#config() abort
|
||||
map g/ <Plug>(incsearch-stay)
|
||||
set hlsearch
|
||||
let g:incsearch#auto_nohlsearch = 1
|
||||
map n <Plug>(incsearch-nohl-n)
|
||||
map N <Plug>(incsearch-nohl-N)
|
||||
noremap <silent> n :call <SID>update_search_index('n')<cr>
|
||||
noremap <silent> N :call <SID>update_search_index('N')<cr>
|
||||
map * <Plug>(incsearch-nohl-*)
|
||||
map # <Plug>(incsearch-nohl-#)
|
||||
map g* <Plug>(incsearch-nohl-g*)
|
||||
@ -68,3 +68,22 @@ function! SpaceVim#layers#incsearch#config() abort
|
||||
noremap <silent><expr> <Space>/ incsearch#go(<SID>config_easyfuzzymotion())
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['/',], 'call feedkeys("\<Space>/", "m")', 'incsearch-fuzzy', 1)
|
||||
endfunction
|
||||
|
||||
|
||||
let s:si_flag = 0
|
||||
function! s:update_search_index(key) abort
|
||||
if a:key == 'n'
|
||||
normal! n
|
||||
normal! ml
|
||||
elseif a:key == 'N'
|
||||
normal! N
|
||||
normal! ml
|
||||
endif
|
||||
if s:si_flag == 0
|
||||
call SpaceVim#layers#core#statusline#toggle_section('search status')
|
||||
let s:si_flag = 1
|
||||
else
|
||||
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
|
||||
endif
|
||||
normal! `l
|
||||
endfunction
|
||||
|
@ -10,6 +10,7 @@ endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#markdown#config() abort
|
||||
let g:markdown_minlines = 100
|
||||
let g:markdown_syntax_conceal = 0
|
||||
let g:markdown_enable_mappings = 0
|
||||
let g:markdown_enable_insert_mode_leader_mappings = 0
|
||||
let g:markdown_enable_spell_checking = 0
|
||||
@ -23,7 +24,7 @@ function! SpaceVim#layers#lang#markdown#config() abort
|
||||
autocmd BufEnter *.md call s:mappings()
|
||||
augroup END
|
||||
if executable('firefox')
|
||||
let g:mkdp_path_to_chrome= 'firefox'
|
||||
let g:mkdp_path_to_chrome= get(g:, 'mkdp_path_to_chrome', 'firefox')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -1,16 +1,21 @@
|
||||
scriptencoding utf-8
|
||||
function! SpaceVim#layers#ui#plugins() abort
|
||||
return [
|
||||
let plugins = [
|
||||
\ ['Yggdroot/indentLine'],
|
||||
\ ['mhinz/vim-signify'],
|
||||
\ ['majutsushi/tagbar', {'loadconf' : 1}],
|
||||
\ ['lvht/tagbar-markdown',{'merged' : 0}],
|
||||
\ ['t9md/vim-choosewin', {'merged' : 0}],
|
||||
\ ['vim-airline/vim-airline', { 'merged' : 0,
|
||||
\ 'loadconf' : 1}],
|
||||
\ ['vim-airline/vim-airline-themes', { 'merged' : 0}],
|
||||
\ ['mhinz/vim-startify', {'loadconf' : 1}],
|
||||
\ ]
|
||||
if get(g:, '_spacevim_statusline_loaded', 0) == 0
|
||||
call add(plugins, ['vim-airline/vim-airline', { 'merged' : 0,
|
||||
\ 'loadconf' : 1}])
|
||||
call add(plugins, ['vim-airline/vim-airline-themes', { 'merged' : 0}])
|
||||
endif
|
||||
|
||||
return plugins
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#ui#config() abort
|
||||
@ -62,6 +67,12 @@ function! SpaceVim#layers#ui#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['t', 's'], 'call call('
|
||||
\ . string(s:_function('s:toggle_syntax_checker')) . ', [])',
|
||||
\ 'toggle syntax checker', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['t', 'S'], 'call call('
|
||||
\ . string(s:_function('s:toggle_spell_check')) . ', [])',
|
||||
\ 'toggle syntax checker', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['t', 'w'], 'call call('
|
||||
\ . string(s:_function('s:toggle_whitespace')) . ', [])',
|
||||
\ 'toggle the whitespace', 1)
|
||||
endfunction
|
||||
" function() wrapper
|
||||
if v:version > 703 || v:version == 703 && has('patch1170')
|
||||
@ -108,6 +119,7 @@ function! s:toggle_colorcolumn() abort
|
||||
set cc=
|
||||
let s:ccflag = 0
|
||||
endif
|
||||
call SpaceVim#layers#core#statusline#toggle_mode('fill-column-indicator')
|
||||
endfunction
|
||||
|
||||
let s:fcflag = 0
|
||||
@ -119,6 +131,7 @@ function! s:toggle_fill_column() abort
|
||||
set cc=
|
||||
let s:fcflag = 0
|
||||
endif
|
||||
call SpaceVim#layers#core#statusline#toggle_mode('hi-characters-for-long-lines')
|
||||
endfunction
|
||||
|
||||
let s:idflag = 0
|
||||
@ -178,5 +191,21 @@ function! s:toggle_win_fringe() abort
|
||||
endfunction
|
||||
|
||||
function! s:toggle_syntax_checker() abort
|
||||
call SpaceVim#layers#core#statusline#toggle_section('syntax checking')
|
||||
call SpaceVim#layers#core#statusline#toggle_mode('syntax-checking')
|
||||
let g:_spacevim_toggle_syntax_flag = g:_spacevim_toggle_syntax_flag * -1
|
||||
endfunction
|
||||
|
||||
function! s:toggle_spell_check() abort
|
||||
if &l:spell
|
||||
let &l:spell = 0
|
||||
else
|
||||
let &l:spell = 1
|
||||
endif
|
||||
call SpaceVim#layers#core#statusline#toggle_mode('spell-checking')
|
||||
endfunction
|
||||
|
||||
function! s:toggle_whitespace() abort
|
||||
call SpaceVim#layers#core#statusline#toggle_section('whitespace')
|
||||
call SpaceVim#layers#core#statusline#toggle_mode('whitespace')
|
||||
endfunction
|
||||
|
@ -337,6 +337,7 @@ function! s:handle_input(input) " {{{
|
||||
call s:start_buffer()
|
||||
else
|
||||
let s:prefix_key_inp = ''
|
||||
doautocmd WinEnter
|
||||
call feedkeys(s:vis.s:reg.s:count, 'ti')
|
||||
redraw!
|
||||
try
|
||||
@ -352,6 +353,7 @@ function! s:wait_for_input() " {{{
|
||||
if inp ==? ''
|
||||
let s:prefix_key_inp = ''
|
||||
call s:winclose()
|
||||
doautocmd WinEnter
|
||||
elseif match(inp, "^<LGCMD>paging_help") == 0
|
||||
let s:guide_help_mode = 1
|
||||
call s:updateStatusline()
|
||||
|
@ -9,9 +9,9 @@ function! SpaceVim#mapping#guide#theme#hi() abort
|
||||
endfunction
|
||||
|
||||
function! s:hi(t) abort
|
||||
exe 'hi! LeaderGuiderPrompt cterm=bold gui=bold guifg=' . a:t[0][0] . ' guibg=' . a:t[0][1]
|
||||
exe 'hi! LeaderGuiderSep1 cterm=bold gui=bold guifg=' . a:t[0][1] . ' guibg=' . a:t[1][1]
|
||||
exe 'hi! LeaderGuiderName cterm=bold gui=bold guifg=' . a:t[1][0] . ' guibg=' . a:t[1][1]
|
||||
exe 'hi! LeaderGuiderSep2 cterm=bold gui=bold guifg=' . a:t[1][1] . ' guibg=' . a:t[2][1]
|
||||
exe 'hi! LeaderGuiderFill guifg=' . a:t[2][0] . ' guibg=' . a:t[2][1]
|
||||
exe 'hi! LeaderGuiderPrompt ctermbg=' . a:t[0][2] . ' ctermfg=' . a:t[0][3] . ' cterm=bold gui=bold guifg=' . a:t[0][0] . ' guibg=' . a:t[0][1]
|
||||
exe 'hi! LeaderGuiderSep1 ctermbg=' . a:t[1][2] . ' ctermfg=' . a:t[0][2] . ' cterm=bold gui=bold guifg=' . a:t[0][1] . ' guibg=' . a:t[1][1]
|
||||
exe 'hi! LeaderGuiderName ctermbg=' . a:t[1][2] . ' ctermfg=' . a:t[1][3] . ' cterm=bold gui=bold guifg=' . a:t[1][0] . ' guibg=' . a:t[1][1]
|
||||
exe 'hi! LeaderGuiderSep2 ctermbg=' . a:t[2][2] . ' ctermfg=' . a:t[1][2] . ' cterm=bold gui=bold guifg=' . a:t[1][1] . ' guibg=' . a:t[2][1]
|
||||
exe 'hi! LeaderGuiderFill ctermbg=' . a:t[2][2] . ' ctermfg=' . a:t[2][3] . ' guifg=' . a:t[2][0] . ' guibg=' . a:t[2][1]
|
||||
endfunction
|
||||
|
@ -1,7 +1,8 @@
|
||||
function! SpaceVim#mapping#guide#theme#gruvbox#palette() abort
|
||||
return [
|
||||
\ ['#282828', '#a89984'],
|
||||
\ ['#a89984', '#504945'],
|
||||
\ ['#a89984', '#3c3836']
|
||||
\ ['#282828', '#a89984', 246, 235],
|
||||
\ ['#a89984', '#504945', 239, 246],
|
||||
\ ['#a89984', '#3c3836', 237, 246],
|
||||
\ ['#665c54', 241]
|
||||
\ ]
|
||||
endfunction
|
||||
|
@ -1,7 +1,8 @@
|
||||
function! SpaceVim#mapping#guide#theme#molokai#palette() abort
|
||||
return [
|
||||
\ ['#080808', '#e6db74'],
|
||||
\ ['#f8f8f0', '#232526'],
|
||||
\ ['#f8f8f0', '#465457']
|
||||
\ ['#080808', '#e6db74', 144, 232],
|
||||
\ ['#f8f8f0', '#232526', 16, 253],
|
||||
\ ['#f8f8f0', '#293739', 236, 253],
|
||||
\ ['#465457', 67],
|
||||
\ ]
|
||||
endfunction
|
||||
|
@ -1,7 +1,8 @@
|
||||
function! SpaceVim#mapping#guide#theme#one#palette() abort
|
||||
return [
|
||||
\ ['#2c323c', '#98c379'],
|
||||
\ ['#abb2bf', '#3b4048'],
|
||||
\ ['#abb2bf', '#2c323c']
|
||||
\ ['#2c323c', '#98c379', 114, 16],
|
||||
\ ['#abb2bf', '#3b4048', 16, 145],
|
||||
\ ['#abb2bf', '#2c323c', 16, 145],
|
||||
\ ['#2c323c', 16]
|
||||
\ ]
|
||||
endfunction
|
||||
|
@ -1,7 +1,9 @@
|
||||
" fg,bg, cbg,cfg
|
||||
function! SpaceVim#mapping#guide#theme#onedark#palette() abort
|
||||
return [
|
||||
\ ['#282C34', '#98C379'],
|
||||
\ ['#ABB2BF', '#3E4452'],
|
||||
\ ['#98C379', '#282C34']
|
||||
\ ['#282C34', '#98C379', 114, 235],
|
||||
\ ['#ABB2BF', '#3E4452', 236, 144],
|
||||
\ ['#ABB2BF', '#3B4048', 238, 144],
|
||||
\ ['#5C6370', 59],
|
||||
\ ]
|
||||
endfunction
|
||||
|
@ -9,10 +9,12 @@ function! SpaceVim#mapping#space#init() abort
|
||||
let g:_spacevim_mappings_space['?'] = ['Unite menu:CustomKeyMaps -input=[SPC]', 'show mappings']
|
||||
let g:_spacevim_mappings_space.t = {'name' : '+Toggles'}
|
||||
let g:_spacevim_mappings_space.t.h = {'name' : '+Toggles highlight'}
|
||||
let g:_spacevim_mappings_space.t.m = {'name' : '+modeline'}
|
||||
let g:_spacevim_mappings_space.T = {'name' : '+UI toggles/themes'}
|
||||
let g:_spacevim_mappings_space.a = {'name' : '+Applications'}
|
||||
let g:_spacevim_mappings_space.b = {'name' : '+Buffers'}
|
||||
let g:_spacevim_mappings_space.f = {'name' : '+Files'}
|
||||
let g:_spacevim_mappings_space.j = {'name' : '+Jump/Join/Split'}
|
||||
let g:_spacevim_mappings_space.w = {'name' : '+Windows'}
|
||||
let g:_spacevim_mappings_space.p = {'name' : '+Projects'}
|
||||
let g:_spacevim_mappings_space.h = {'name' : '+Help'}
|
||||
@ -86,7 +88,7 @@ function! SpaceVim#mapping#space#def(m, keys, cmd, desc, is_cmd) abort
|
||||
endfunction
|
||||
|
||||
function! s:has_map_to_spc() abort
|
||||
return get(g:, 'mapleader', '\') == ' '
|
||||
return get(g:, 'mapleader', '\') ==# ' '
|
||||
endfunction
|
||||
|
||||
function! s:windows_layout_toggle() abort
|
||||
|
@ -113,6 +113,9 @@ endfunction
|
||||
|
||||
" @vimlint(EVL102, 1, l:i)
|
||||
function! SpaceVim#plugins#manager#install(...) abort
|
||||
if !s:JOB.vim_job && !s:JOB.nvim_job
|
||||
let &maxfuncdepth = 2000
|
||||
endif
|
||||
let s:plugins = a:0 == 0 ? sort(map(s:get_uninstalled_plugins(), 'v:val.name')) : sort(copy(a:1))
|
||||
let status = s:new_window()
|
||||
if status == 0
|
||||
@ -152,11 +155,17 @@ function! SpaceVim#plugins#manager#install(...) abort
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
if !s:JOB.vim_job && !s:JOB.nvim_job
|
||||
let &maxfuncdepth = 100
|
||||
endif
|
||||
endfunction
|
||||
" @vimlint(EVL102, 0, l:i)
|
||||
|
||||
" @vimlint(EVL102, 1, l:i)
|
||||
function! SpaceVim#plugins#manager#update(...) abort
|
||||
if !s:JOB.vim_job && !s:JOB.nvim_job
|
||||
let &maxfuncdepth = 2000
|
||||
endif
|
||||
let status = s:new_window()
|
||||
if status == 0
|
||||
echohl WarningMsg
|
||||
@ -205,6 +214,9 @@ function! SpaceVim#plugins#manager#update(...) abort
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
if !s:JOB.vim_job && !s:JOB.nvim_job
|
||||
let &maxfuncdepth = 100
|
||||
endif
|
||||
endfunction
|
||||
" @vimlint(EVL102, 0, l:i)
|
||||
|
||||
|
@ -188,7 +188,9 @@ endfunction
|
||||
function! zvim#util#OpenVimfiler() abort
|
||||
if bufnr('vimfiler') == -1
|
||||
VimFiler
|
||||
AirlineRefresh
|
||||
if exists(':AirlineRefresh')
|
||||
AirlineRefresh
|
||||
endif
|
||||
wincmd p
|
||||
if &filetype !=# 'startify'
|
||||
IndentLinesToggle
|
||||
@ -197,7 +199,10 @@ function! zvim#util#OpenVimfiler() abort
|
||||
wincmd p
|
||||
else
|
||||
VimFiler
|
||||
AirlineRefresh
|
||||
doautocmd WinEnter
|
||||
if exists(':AirlineRefresh')
|
||||
AirlineRefresh
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -6,8 +6,8 @@ if has('filterpipe')
|
||||
endif
|
||||
if count(g:spacevim_plugin_groups, 'colorscheme') && g:spacevim_colorscheme !=# '' "{{{
|
||||
try
|
||||
exec 'colorscheme ' . g:spacevim_colorscheme
|
||||
exec 'set background=' . g:spacevim_colorscheme_bg
|
||||
exec 'colorscheme ' . g:spacevim_colorscheme
|
||||
catch
|
||||
exec 'colorscheme '. g:spacevim_colorscheme_default
|
||||
endtry
|
||||
|
@ -36,7 +36,7 @@ if !s:sys.isWindows
|
||||
" For ripgrep
|
||||
" Note: It is slower than ag
|
||||
call denite#custom#var('file_rec', 'command',
|
||||
\ ['rg', '--hidden', '--files', '--glob', '!.git', '']
|
||||
\ ['rg', '--hidden', '--files', '--glob', '!.git', '--glob', '']
|
||||
\ + zvim#util#Generate_ignore(g:spacevim_wildignore, 'rg')
|
||||
\ )
|
||||
elseif executable('ag')
|
||||
|
@ -59,6 +59,6 @@ augroup END
|
||||
if !exists('g:startify_custom_header')
|
||||
call s:update_logo()
|
||||
endif
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['a','s'], 'Startify', 'fancy start screen',1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['a','s'], 'Startify | doautocmd WinEnter', 'fancy start screen',1)
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -162,6 +162,9 @@ normal mode.To disable this feature:
|
||||
let g:spacevim_enable_cursorline = 0
|
||||
<
|
||||
|
||||
*g:spacevim_statusline_separator*
|
||||
Set the statusline separators of statusline, default is 'arrow'
|
||||
|
||||
*g:spacevim_enable_cursorcolumn*
|
||||
Enable/Disable cursorcolumn. Default is 0, cursorcolumn will be highlighted in
|
||||
normal mode. To enable this feature:
|
||||
|
33
docs/_posts/2017-05-31-SpaceVim-release-v0.3.0.md
Normal file
33
docs/_posts/2017-05-31-SpaceVim-release-v0.3.0.md
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
title: SpaceVim release v0.3.0
|
||||
categories: changelog
|
||||
excerpt: "Here you can check what has been done so far."
|
||||
---
|
||||
|
||||
# [Changelogs](https://spacevim.org/development#changelog) > SpaceVim release v0.3.0
|
||||
|
||||
## FEATURES
|
||||
|
||||
- **Mappings guide:** A guide buffer is displayed each time the prefix key is pressed in normal mode. It lists the available key bindings and their short description.
|
||||
|
||||
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)
|
||||
|
||||
for more information about mapping guide, please read the [documentation](http://spacevim.org/documentation/#mappings-guide).
|
||||
|
||||
- **Statusline:** A modulue statusline will displayed all the status of SpaceVim. all the sections in the statusline can be toggled.
|
||||
|
||||
here is an picture for this feature:
|
||||
|
||||
![search status](https://cloud.githubusercontent.com/assets/13142418/26313080/578cc68c-3f3c-11e7-9259-a27419d49572.png)
|
||||
|
||||
please checkout statusline [documentation](http://spacevim.org/documentation/#statusline) for all the shortcuts.
|
||||
|
||||
## CHANGES
|
||||
|
||||
SpaceVim now use Space as [SPC] only in normal mode. and do not change the default value of mapleader.
|
||||
|
||||
## FIXES
|
||||
|
||||
please checkout our issue list.
|
@ -30,6 +30,7 @@ title: "Documentation"
|
||||
* [Font](#font)
|
||||
* [UI Toggles](#ui-toggles)
|
||||
* [Statusline && tabline](#statusline--tabline)
|
||||
* [statusline](#statusline)
|
||||
* [Manual](#manual)
|
||||
* [Completion](#completion)
|
||||
* [Unite/Denite](#unitedenite)
|
||||
@ -44,6 +45,10 @@ title: "Documentation"
|
||||
* [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)
|
||||
* [Auto-saving](#auto-saving)
|
||||
* [Searching](#searching)
|
||||
* [Editing](#editing)
|
||||
@ -118,11 +123,13 @@ Community-driven configuration provides curated packages tuned by power users an
|
||||
|
||||
- **Great documentation:** access documentation in Vim with
|
||||
<kbd>:h SpaceVim</kbd>.
|
||||
- **Beautiful GUI:** you'll love the awesome UI and its useful features.
|
||||
- **Minimalistic and nice graphical UI:** you'll love the awesome UI and its useful features.
|
||||
- **Keep your fingers on the home row:** for quicker editing with support for QWERTY and BEPO layouts.
|
||||
- **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]
|
||||
- **Fast boot time:** Lazy-load 90% of plugins with [dein.vim]
|
||||
- **Lower the risk of RSI:** by heavily using the space bar instead of modifiers.
|
||||
- **Batteries included:** discover hundreds of ready-to-use packages nicely
|
||||
organised in configuration layers following a set of
|
||||
[conventions](http://spacevim.org/development/).
|
||||
@ -132,7 +139,7 @@ Community-driven configuration provides curated packages tuned by power users an
|
||||
|
||||
### welcome page
|
||||
|
||||
![2017-04-29-20 54 49](https://cloud.githubusercontent.com/assets/13142418/25555650/d7d2c07e-2d1e-11e7-975d-646a07b38a62.png)
|
||||
![welcome-page](https://cloud.githubusercontent.com/assets/13142418/26402270/28ad72b8-40bc-11e7-945e-003f41e057be.png)
|
||||
|
||||
### working flow
|
||||
|
||||
@ -326,10 +333,111 @@ The statusline and tabline is a heavily customized [airline](https://github.com/
|
||||
- checker info: numbers of errors and warnings.
|
||||
- trailing line number.
|
||||
|
||||
Key Binding | Description
|
||||
----------- | -----------
|
||||
`SPC [1-9]` | jump to the index of tabline.
|
||||
Key Binding | Description
|
||||
----------- | -----------
|
||||
`SPC [1-9]` | jump to the index of tabline.
|
||||
|
||||
#### statusline
|
||||
|
||||
The `core#statusline` layer provide a heavily customized powerline with the following capabilities:, It is inspired by spacemacs's mode-line.
|
||||
|
||||
|
||||
- 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
|
||||
|
||||
Reminder of the color codes for the states:
|
||||
|
||||
Mode | Color
|
||||
--- | ---
|
||||
Normal | Orange
|
||||
Insert | Green
|
||||
Visual | Grey
|
||||
|
||||
all the colors based on the current colorscheme
|
||||
|
||||
Some elements can be dynamically toggled:
|
||||
|
||||
Key Binding | Description
|
||||
----------- | -----------
|
||||
`SPC t m b` | toggle the battery status (need to install acpi)
|
||||
`SPC t m c` | toggle the org task clock (available in org layer)
|
||||
`SPC t m m` | toggle the minor mode lighters
|
||||
`SPC t m M` | toggle the major mode
|
||||
`SPC t m n` | toggle the cat! (if colors layer is declared in your dotfile)
|
||||
`SPC t m p` | toggle the point character position
|
||||
`SPC t m t` | toggle the time
|
||||
`SPC t m T` | toggle the mode line itself
|
||||
`SPC t m v` | toggle the version control info
|
||||
|
||||
**Powerline font installation:**
|
||||
|
||||
By defalut SpaceVim use [DejaVu Sans Mono for Powerline](https://github.com/powerline/fonts/tree/master/DejaVuSansMono), to make statusline render correctly, you need to install the font. [powerline extra symbols](https://github.com/ryanoasis/powerline-extra-symbols) also should be installed.
|
||||
|
||||
**syntax checking integration:**
|
||||
|
||||
When syntax checking minor mode is enabled, a new element appears showing the number of errors, warnings.
|
||||
|
||||
syntax checking integration in statusline.
|
||||
|
||||
**Search index integration:**
|
||||
|
||||
Search index shows the number of occurrence when performing a search via `/` or `?`. SpaceVim integrates nicely the search status by displaying it temporarily when n or N are being pressed. See the 20/22 segment on the screenshot below.
|
||||
|
||||
![search status](https://cloud.githubusercontent.com/assets/13142418/26313080/578cc68c-3f3c-11e7-9259-a27419d49572.png)
|
||||
|
||||
_search index in statusline_
|
||||
|
||||
**Battery status integration:**
|
||||
|
||||
_acpi_ displays the percentage of total charge of the battery as well as the time remaining to charge or discharge completely the battery.
|
||||
|
||||
A color code is used for the battery status:
|
||||
|
||||
Battery State | Color
|
||||
------------ | ----
|
||||
Charging | Green
|
||||
Discharging | Orange
|
||||
Critical | Red
|
||||
|
||||
all the colors based on the current colorscheme
|
||||
|
||||
**Statusline separators:**
|
||||
|
||||
It is possible to easily customize the statusline separator by setting the `g:spacevim_statusline_separator` variable in your custon configration file and then redraw the statusline. For instance if you want to set back the separator to the well-known arrow separator add the following snippet to your configuration file:
|
||||
|
||||
```vim
|
||||
let g:spacevim_statusline_separator = 'arrow'
|
||||
```
|
||||
|
||||
here is an exhaustive set of screenshots for all the available separator:
|
||||
|
||||
Separator | Screenshot
|
||||
--------- | ----------
|
||||
`arrow` | ![separator-arrow](https://cloud.githubusercontent.com/assets/13142418/26234639/b28bdc04-3c98-11e7-937e-641c9d85c493.png)
|
||||
`curve` | ![separator-curve](https://cloud.githubusercontent.com/assets/13142418/26248272/42bbf6e8-3cd4-11e7-8792-665447040f49.png)
|
||||
`slant` | ![separator-slant](https://cloud.githubusercontent.com/assets/13142418/26248515/53a65ea2-3cd5-11e7-8758-d079c5a9c2d6.png)
|
||||
`nil` | ![separator-nil](https://cloud.githubusercontent.com/assets/13142418/26249776/645a5a96-3cda-11e7-9655-0aa1f76714f4.png)
|
||||
`fire` | ![separator-fire](https://cloud.githubusercontent.com/assets/13142418/26274142/434cdd10-3d75-11e7-811b-e44cebfdca58.png)
|
||||
|
||||
**Minor Modes:**
|
||||
|
||||
The minor mode area can be toggled on and off with `SPC t m m`
|
||||
|
||||
Unicode symbols are displayed by default. Setting the variable `g:spacevim_statusline_unicode_symbols` to nil in your custom configuration file will display ASCII characters instead (may be useful in terminal if you cannot set an appropriate font).
|
||||
|
||||
The letters displayed in the statusline correspond to the key bindings used to toggle them.
|
||||
|
||||
Key Binding | Unicode | ASCII | Mode
|
||||
----------- | ------- | ----- | ----
|
||||
`SPC t 8` | ⑧ | 8 | toggle highlight of characters for long lines
|
||||
`SPC t f` | ⓕ | f | fill-column-indicator mode
|
||||
`SPC t s` | ⓢ | s | syntax checking (neomake)
|
||||
`SPC t S` | Ⓢ | S | enabled in spell checking
|
||||
`SPC t w` | ⓦ | w | whitespace mode
|
||||
|
||||
## Manual
|
||||
|
||||
@ -378,7 +486,7 @@ Prefix name | custom option and default value | description
|
||||
`[unite]` | `g:spacevim_unite_leader` / `f` | unite mapping prefix of SpaceVim
|
||||
`<leader>` | `mapleader` / ``\`` | default leader prefix of vim/neovim
|
||||
|
||||
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).
|
||||
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 :
|
||||
|
||||
@ -438,8 +546,64 @@ All plugins can be easily discovered via `<leader> l p`.
|
||||
|
||||
#### Toggles
|
||||
|
||||
both the toggles mappings started with `[SPC] t` or `[SPC] T`. you can find it in the mapping guide.
|
||||
|
||||
### Navigating
|
||||
|
||||
#### Point/Cursor
|
||||
|
||||
Navigation is performed using the Vi key bindings `hjkl`.
|
||||
|
||||
Key Binding | Description
|
||||
----------- | -----------
|
||||
`h` | move cursor left (origin vim key, no mappings)
|
||||
`j` | move cursor down (origin vim key, no mappings)
|
||||
`k` | move cursor up (origin vim key, no mappings)
|
||||
`l` | move cursor right (origin vim key, no mappings)
|
||||
`H` | move cursor to the top of the screen (origin vim key, no mappings)
|
||||
`L` | move cursor to the bottom of the screen (origin vim key, no mappings)
|
||||
`SPC j 0` | go to the beginning of line (and set a mark at the previous location in the line)
|
||||
`SPC j $` | go to the end of line (and set a mark at the previous location in the line)
|
||||
`SPC t -` | lock the cursor at the center of the screen
|
||||
|
||||
#### Vim motions with vim-easymotion
|
||||
|
||||
##### quick-jump-link mode (TODO)
|
||||
|
||||
https://github.com/easymotion/vim-easymotion/issues/315
|
||||
|
||||
Similar to easymotion or `f` in vimperator for firefox, this mode allows one to jump to any link in help file with two key strokes.
|
||||
|
||||
mapping | description
|
||||
------- | -----------
|
||||
`o` | initiate quick jump link mode in help buffer
|
||||
|
||||
#### Unimpaired bindings
|
||||
|
||||
Mappings | Description
|
||||
-------- | -----------
|
||||
`[ SPC` | Insert space above
|
||||
`] SPC` | Insert space below
|
||||
`[ b` | Go to previous buffer
|
||||
`] b` | Go to next buffer
|
||||
`[ f` | Go to previous file in directory
|
||||
`] f` | Go to next file in directory
|
||||
`[ l` | Go to the previous error
|
||||
`] l` | Go to the next error
|
||||
`[ c` | Go to the previous vcs hunk
|
||||
`] c` | Go to the next vcs hunk
|
||||
`[ q` | Go to the previous error
|
||||
`] q` | Go to the next error
|
||||
`[ t` | Go to the previous frame
|
||||
`] t` | Go to the next frame
|
||||
`[ w` | Go to the previous window
|
||||
`] w` | Go to the next window
|
||||
`[ e` | Move line up
|
||||
`] e` | Move line down
|
||||
`[ p` | Paste above current line
|
||||
`] p` | Paste below current line
|
||||
`g p` | Select pasted text
|
||||
|
||||
### Auto-saving
|
||||
|
||||
### Searching
|
||||
|
Loading…
Reference in New Issue
Block a user