mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 15:19:12 +08:00
Merge branch 'dev' into comment
This commit is contained in:
commit
e7124b8801
13
README.md
13
README.md
@ -123,20 +123,20 @@ let g:spacevim_max_column = 80
|
||||
let g:spacevim_plugin_bundle_dir = '~/.cache/vimfiles/'
|
||||
|
||||
" set SpaceVim colorscheme
|
||||
let g:spacevim_colorscheme = 'jellybeans'
|
||||
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
|
||||
|
||||
" use space as `<Leader>`
|
||||
let mapleader = "\<space>"
|
||||
|
||||
" 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')
|
||||
@ -193,11 +193,6 @@ curl -sLf https://spacevim.org/install.sh | bash
|
||||
|
||||
**After SpaceVim is installed, launch `vim` and SpaceVim will automatically install plugins**
|
||||
|
||||
Once plugins start installing, at the bottom of the vim window, you will see
|
||||
`[dein] Install started: (YYYY/MM/DD HH:MM:SS)`
|
||||
|
||||
Please wait for all the plugins to complete installing before using vim. Once the plugin installation completes, you will see
|
||||
`[dein] Done: (YYYY/MM/DD HH:MM:SS) `. At this point you can start using vim.
|
||||
|
||||
SpaceVim required Vim7.4 above or neovim, here is the installation of neovim/vim with python support:
|
||||
|
||||
|
@ -416,6 +416,7 @@ let g:spacevim_leader_guide_submode_mappings = {'<C-C>': "win_close"}
|
||||
|
||||
|
||||
command -nargs=1 LeaderGuide call SpaceVim#mapping#guide#start_by_prefix('0', <args>)
|
||||
command -range -nargs=1 LeaderGuideVisual call SpaceVim#mapping#guide#start_by_prefix('1', <args>)
|
||||
|
||||
function! SpaceVim#loadCustomConfig() abort
|
||||
let custom_confs_old = SpaceVim#util#globpath(getcwd(), '.local.vim')
|
||||
|
@ -21,6 +21,7 @@ function! s:self.warp(argv, opts) abort
|
||||
let obj = {}
|
||||
let obj._argv = a:argv
|
||||
let obj._opts = a:opts
|
||||
let obj.in_io = get(a:opts, 'in_io', 'pipe')
|
||||
" @vimlint(EVL103, 1, a:job_id)
|
||||
function! obj._out_cb(job_id, data) abort
|
||||
if has_key(self._opts, 'on_stdout')
|
||||
@ -45,6 +46,7 @@ function! s:self.warp(argv, opts) abort
|
||||
\ 'argv': a:argv,
|
||||
\ 'opts': {
|
||||
\ 'mode': 'nl',
|
||||
\ 'in_io' : obj.in_io,
|
||||
\ 'out_cb': obj._out_cb,
|
||||
\ 'err_cb': obj._err_cb,
|
||||
\ 'exit_cb': obj._exit_cb,
|
||||
|
147
autoload/SpaceVim/api/prompt.vim
Normal file
147
autoload/SpaceVim/api/prompt.vim
Normal file
@ -0,0 +1,147 @@
|
||||
""
|
||||
" @section prompt, api-prompt
|
||||
" @parentsection api
|
||||
" open()
|
||||
"
|
||||
" Create a cmdline prompt, use while loop to get the input from user. The
|
||||
" default mapping for prompt is:
|
||||
" >
|
||||
" <Bs> remove last character
|
||||
" <C-w> remove the Word before the cursor
|
||||
" <C-u> remove the Line before the cursor
|
||||
" <C-k> remove the Line after the cursor
|
||||
" <C-a> / <Home> Go to the beginning of the line
|
||||
" <C-e> / <End> Go to the end of the line
|
||||
" <
|
||||
|
||||
let s:self = {}
|
||||
|
||||
|
||||
let s:self._keys = {
|
||||
\ 'close' : "\<Esc>",
|
||||
\ 'cursor_back' : '<Left>',
|
||||
\ 'cursor_forword' : '<Right>',
|
||||
\ }
|
||||
let s:self._prompt = {
|
||||
\ 'mpt' : '==>',
|
||||
\ 'begin' : '',
|
||||
\ 'cursor' : '',
|
||||
\ 'end' : '',
|
||||
\ }
|
||||
let s:self._function_key = {}
|
||||
|
||||
let s:self._quit = 1
|
||||
|
||||
let s:self._handle_fly = ''
|
||||
let s:self._onclose = ''
|
||||
let s:self._oninputpro = ''
|
||||
|
||||
|
||||
|
||||
func! s:self.open() abort
|
||||
let self._quit = 0
|
||||
let save_redraw = &lazyredraw
|
||||
set nolazyredraw
|
||||
call self._build_prompt()
|
||||
call self._handle_input()
|
||||
let &lazyredraw = save_redraw
|
||||
endf
|
||||
|
||||
function! s:self._getchar(...) abort
|
||||
let ret = call('getchar', a:000)
|
||||
return (type(ret) == type(0) ? nr2char(ret) : ret)
|
||||
endfunction
|
||||
|
||||
func! s:self._handle_input() abort
|
||||
while self._quit == 0
|
||||
let char = self._getchar()
|
||||
if has_key(self._function_key, char)
|
||||
call call(self._function_key[char], [])
|
||||
continue
|
||||
endif
|
||||
if char ==# "\<Right>" || char == 6
|
||||
let self._prompt.begin = self._prompt.begin . self._prompt.cursor
|
||||
let self._prompt.cursor = matchstr(self._prompt.end, '^.')
|
||||
let self._prompt.end = substitute(self._prompt.end, '^.', '', 'g')
|
||||
call self._build_prompt()
|
||||
continue
|
||||
elseif char ==# "\<Left>" || char == 2
|
||||
if self._prompt.begin !=# ''
|
||||
let self._prompt.end = self._prompt.cursor . self._prompt.end
|
||||
let self._prompt.cursor = matchstr(self._prompt.begin, '.$')
|
||||
let self._prompt.begin = substitute(self._prompt.begin, '.$', '', 'g')
|
||||
call self._build_prompt()
|
||||
endif
|
||||
continue
|
||||
elseif char ==# "\<C-w>"
|
||||
let self._prompt.begin = substitute(self._prompt.begin,'[^\ .*]\+\s*$','','g')
|
||||
call self._build_prompt()
|
||||
elseif char ==# "\<C-a>" || char ==# "\<Home>"
|
||||
let self._prompt.end = substitute(self._prompt.begin . self._prompt.cursor . self._prompt.end, '^.', '', 'g')
|
||||
let self._prompt.cursor = matchstr(self._prompt.begin, '^.')
|
||||
let self._prompt.begin = ''
|
||||
call self._build_prompt()
|
||||
continue
|
||||
elseif char ==# "\<C-e>" || char ==# "\<End>"
|
||||
let self._prompt.begin = self._prompt.begin . self._prompt.cursor . self._prompt.end
|
||||
let self._prompt.cursor = ''
|
||||
let self._prompt.end = ''
|
||||
call self._build_prompt()
|
||||
continue
|
||||
elseif char ==# "\<C-u>"
|
||||
let self._prompt.begin = ''
|
||||
call self._build_prompt()
|
||||
elseif char ==# "\<C-k>"
|
||||
let self._prompt.cursor = ''
|
||||
let self._prompt.end = ''
|
||||
call self._build_prompt()
|
||||
elseif char ==# "\<bs>"
|
||||
let self._prompt.begin = substitute(self._prompt.begin,'.$','','g')
|
||||
call self._build_prompt()
|
||||
elseif char == self._keys.close
|
||||
call self.close()
|
||||
break
|
||||
elseif char ==# "\<FocusLost>" || char ==# "\<FocusGained>" || char2nr(char) == 128
|
||||
continue
|
||||
else
|
||||
let self._prompt.begin .= char
|
||||
call self._build_prompt()
|
||||
endif
|
||||
if self._oninputpro !=# ''
|
||||
call call(self._oninputpro, [])
|
||||
endif
|
||||
if self._handle_fly !=# ''
|
||||
call call(self._handle_fly, [self._prompt.begin . self._prompt.cursor . self._prompt.end])
|
||||
endif
|
||||
endwhile
|
||||
endf
|
||||
|
||||
func! s:self._build_prompt() abort
|
||||
redraw
|
||||
echohl Comment | echon self._prompt.mpt
|
||||
echohl None | echon self._prompt.begin
|
||||
echohl Wildmenu | echon self._prompt.cursor
|
||||
echohl None | echon self._prompt.end
|
||||
endf
|
||||
|
||||
function! s:self._clear_prompt() abort
|
||||
let self._prompt = {
|
||||
\ 'mpt' : self._prompt.mpt,
|
||||
\ 'begin' : '',
|
||||
\ 'cursor' : '',
|
||||
\ 'end' : '',
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! s:self.close() abort
|
||||
if self._onclose !=# ''
|
||||
call call(self._onclose, [])
|
||||
endif
|
||||
call self._clear_prompt()
|
||||
normal! :
|
||||
let self._quit = 1
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#api#prompt#get() abort
|
||||
return deepcopy(s:self)
|
||||
endfunction
|
@ -65,6 +65,7 @@ function! SpaceVim#autocmds#init() abort
|
||||
" Instead of reverting the cursor to the last position in the buffer, we
|
||||
" set it to the first line when editing a git commit message
|
||||
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
|
||||
au StdinReadPost * call s:disable_welcome()
|
||||
autocmd InsertEnter * call s:fixindentline()
|
||||
if executable('synclient') && g:spacevim_auto_disable_touchpad
|
||||
let s:touchpadoff = 0
|
||||
@ -138,5 +139,11 @@ function! SpaceVim#autocmds#VimEnter() abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:disable_welcome() abort
|
||||
augroup SPwelcome
|
||||
au!
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
|
||||
" vim:set et sw=2:
|
||||
|
@ -107,6 +107,10 @@ function! SpaceVim#default#SetOptions() abort
|
||||
set ttimeout
|
||||
set ttimeoutlen=50
|
||||
set lazyredraw
|
||||
if has('patch-7.4.314')
|
||||
" don't give ins-completion-menu messages.
|
||||
set shortmess+=c
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#default#SetPlugins() abort
|
||||
|
@ -53,7 +53,7 @@ let s:modes = {
|
||||
\ },
|
||||
\ }
|
||||
|
||||
let s:loaded_sections = ['syntax checking', 'major mode', 'minor mode lighters', 'version control info']
|
||||
let s:loaded_sections = ['syntax checking', 'major mode', 'minor mode lighters', 'version control info', 'cursorpos']
|
||||
|
||||
function! s:battery_status() abort
|
||||
if executable('acpi')
|
||||
@ -156,6 +156,10 @@ function! s:whitespace() abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:cursorpos() abort
|
||||
return ' %l:%c '
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:modes() abort
|
||||
let m = ' ❖ '
|
||||
@ -210,6 +214,10 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
\ . '%#SpaceVim_statusline_a_bold_SpaceVim_statusline_b# %{get(unite#get_context(), "buffer_name", "")} '
|
||||
\ . '%#SpaceVim_statusline_b_SpaceVim_statusline_c# '
|
||||
\ . '%#SpaceVim_statusline_c# %{unite#get_status_string()} '
|
||||
elseif &filetype ==# 'SpaceVimFlyGrep'
|
||||
return '%#SpaceVim_statusline_a# FlyGrep %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
|
||||
\ . '%#SpaceVim_statusline_b# %{getcwd()}%#SpaceVim_statusline_b_SpaceVim_statusline_c#'
|
||||
\ . '%#SpaceVim_statusline_c# %{SpaceVim#plugins#flygrep#lineNr()}'
|
||||
endif
|
||||
if a:0 > 0
|
||||
return s:active()
|
||||
@ -237,10 +245,14 @@ function! s:active() abort
|
||||
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) . " "}')
|
||||
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())
|
||||
@ -343,6 +355,8 @@ function! SpaceVim#layers#core#statusline#config() abort
|
||||
\ '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
|
||||
|
@ -6,7 +6,7 @@ function! SpaceVim#layers#lang#lua#plugins() abort
|
||||
" Improved Lua 5.3 syntax and indentation support for Vim
|
||||
call add(plugins, ['tbastos/vim-lua', {'on_ft' : 'lua'}])
|
||||
call add(plugins, ['WolfgangMehner/lua-support', {'on_ft' : 'lua'}])
|
||||
call add(plugins, ['SpaceVim/vim-luacomplete', {'on_ft' : 'lua'}])
|
||||
call add(plugins, ['SpaceVim/vim-luacomplete', {'on_ft' : 'lua', 'if' : has('lua')}])
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
|
@ -50,3 +50,16 @@ function! SpaceVim#mapping#search#grep(key, scope)
|
||||
let g:unite_source_grep_default_opts = save_opt
|
||||
let g:unite_source_grep_recursive_opt = save_ropt
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#search#default_tool()
|
||||
if has_key(s:search_tools, 'default_exe')
|
||||
return s:search_tools.default_exe
|
||||
else
|
||||
for t in g:spacevim_search_tools
|
||||
if executable(t)
|
||||
let s:search_tools.default_exe = t
|
||||
return t
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
@ -3,7 +3,9 @@ function! SpaceVim#mapping#space#init() abort
|
||||
return
|
||||
endif
|
||||
nnoremap <silent><nowait> [SPC] :<c-u>LeaderGuide " "<CR>
|
||||
vnoremap <silent><nowait> [SPC] :<c-u>LeaderGuideVisual " "<CR>
|
||||
nmap <Space> [SPC]
|
||||
vmap <Space> [SPC]
|
||||
let g:_spacevim_mappings_space = {}
|
||||
let g:_spacevim_mappings_prefixs['[SPC]'] = {'name' : '+SPC prefix'}
|
||||
let g:_spacevim_mappings_space['?'] = ['Unite menu:CustomKeyMaps -input=[SPC]', 'show mappings']
|
||||
@ -105,6 +107,13 @@ function! SpaceVim#mapping#space#init() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'p'], 'Unite grep:.', 'grep in project', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'P'], "execute 'Unite grep:.::' . expand(\"<cword>\") . ' -start-insert'",
|
||||
\ 'grep in project', 1)
|
||||
" Searching background
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'j'],
|
||||
\ 'call SpaceVim#plugins#searcher#find("", SpaceVim#mapping#search#default_tool())', 'Background search keywords in project', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'J'],
|
||||
\ 'call SpaceVim#plugins#searcher#find(expand("<cword>"),SpaceVim#mapping#search#default_tool())',
|
||||
\ 'Background search cursor words in project', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'l'], 'call SpaceVim#plugins#searcher#list()', 'List all searching results', 1)
|
||||
|
||||
" Searching tools
|
||||
" ag
|
||||
@ -119,6 +128,10 @@ function! SpaceVim#mapping#space#init() abort
|
||||
\ 'search in arbitrary directory with ag', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'a', 'F'], 'call SpaceVim#mapping#search#grep("a", "F")',
|
||||
\ 'search cursor word in arbitrary directory with ag', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'a', 'j'], 'call SpaceVim#plugins#searcher#find("", "ag")',
|
||||
\ 'Background search cursor words in project with ag', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'a', 'J'], 'call SpaceVim#plugins#searcher#find(expand("<cword>"), "ag")',
|
||||
\ 'Background search cursor words in project with ag', 1)
|
||||
" grep
|
||||
let g:_spacevim_mappings_space.s.g = {'name' : '+grep'}
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'g', 'b'], 'call SpaceVim#mapping#search#grep("g", "b")',
|
||||
@ -132,6 +145,10 @@ function! SpaceVim#mapping#space#init() abort
|
||||
\ 'search in arbitrary directory with grep', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'g', 'F'], 'call SpaceVim#mapping#search#grep("g", "F")',
|
||||
\ 'search cursor word in arbitrary directory with grep', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'g', 'j'], 'call SpaceVim#plugins#searcher#find("", "grep")',
|
||||
\ 'Background search cursor words in project with grep', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'g', 'J'], 'call SpaceVim#plugins#searcher#find(expand("<cword>"), "grep")',
|
||||
\ 'Background search cursor words in project with grep', 1)
|
||||
" ack
|
||||
let g:_spacevim_mappings_space.s.k = {'name' : '+ack'}
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'k', 'b'], 'call SpaceVim#mapping#search#grep("k", "b")', 'search in all buffers with ack', 1)
|
||||
@ -144,6 +161,10 @@ function! SpaceVim#mapping#space#init() abort
|
||||
\ 'search in arbitrary directory with ack', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'k', 'F'], 'call SpaceVim#mapping#search#grep("k", "F")',
|
||||
\ 'search cursor word in arbitrary directory with ack', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'k', 'j'], 'call SpaceVim#plugins#searcher#find("", "ack")',
|
||||
\ 'Background search cursor words in project with ack', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'k', 'J'], 'call SpaceVim#plugins#searcher#find(expand("<cword>"), "ack")',
|
||||
\ 'Background search cursor words in project with ack', 1)
|
||||
" rg
|
||||
let g:_spacevim_mappings_space.s.r = {'name' : '+rg'}
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'r', 'b'], 'call SpaceVim#mapping#search#grep("r", "b")', 'search in all buffers with rt', 1)
|
||||
@ -156,6 +177,10 @@ function! SpaceVim#mapping#space#init() abort
|
||||
\ 'search in arbitrary directory with rt', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'r', 'F'], 'call SpaceVim#mapping#search#grep("r", "F")',
|
||||
\ 'search cursor word in arbitrary directory with rt', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'r', 'j'], 'call SpaceVim#plugins#searcher#find("", "rg")',
|
||||
\ 'Background search cursor words in project with rg', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'r', 'J'], 'call SpaceVim#plugins#searcher#find(expand("<cword>"), "rg")',
|
||||
\ 'Background search cursor words in project with rg', 1)
|
||||
" pt
|
||||
let g:_spacevim_mappings_space.s.t = {'name' : '+pt'}
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 't', 'b'], 'call SpaceVim#mapping#search#grep("t", "b")', 'search in all buffers with pt', 1)
|
||||
@ -168,6 +193,13 @@ function! SpaceVim#mapping#space#init() abort
|
||||
\ 'search in arbitrary directory with pt', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 't', 'F'], 'call SpaceVim#mapping#search#grep("t", "F")',
|
||||
\ 'search cursor word in arbitrary directory with pt', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 't', 'j'], 'call SpaceVim#plugins#searcher#find("", "pt")',
|
||||
\ 'Background search cursor words in project with pt', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 't', 'J'], 'call SpaceVim#plugins#searcher#find(expand("<cword>"), "pt")',
|
||||
\ 'Background search cursor words in project with pt', 1)
|
||||
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'g', 'G'], 'call SpaceVim#plugins#flygrep#open()',
|
||||
\ 'grep on the fly', 1)
|
||||
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['s', 'c'], 'noh',
|
||||
\ 'clear search highlight', 1)
|
||||
|
197
autoload/SpaceVim/plugins/flygrep.vim
Normal file
197
autoload/SpaceVim/plugins/flygrep.vim
Normal file
@ -0,0 +1,197 @@
|
||||
let s:MPT = SpaceVim#api#import('prompt')
|
||||
let s:JOB = SpaceVim#api#import('job')
|
||||
let s:SYS = SpaceVim#api#import('system')
|
||||
let s:grepid = 0
|
||||
|
||||
|
||||
function! SpaceVim#plugins#flygrep#open() abort
|
||||
rightbelow split __flygrep__
|
||||
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber
|
||||
let save_tve = &t_ve
|
||||
setlocal t_ve=
|
||||
" setlocal nomodifiable
|
||||
setf SpaceVimFlyGrep
|
||||
redraw!
|
||||
call s:MPT.open()
|
||||
let &t_ve = save_tve
|
||||
endfunction
|
||||
|
||||
let s:grep_expr = ''
|
||||
let s:grep_exe = SpaceVim#mapping#search#default_tool()
|
||||
let s:grep_timer_id = 0
|
||||
|
||||
" @vimlint(EVL103, 1, a:timer)
|
||||
function! s:grep_timer(timer) abort
|
||||
let s:grepid = s:JOB.start(s:get_search_cmd(s:grep_exe, s:grep_expr), {
|
||||
\ 'on_stdout' : function('s:grep_stdout'),
|
||||
\ 'in_io' : 'null',
|
||||
\ 'on_exit' : function('s:grep_exit'),
|
||||
\ })
|
||||
endfunction
|
||||
" @vimlint(EVL103, 0, a:timer)
|
||||
|
||||
function! s:flygrep(expr) abort
|
||||
call s:MPT._build_prompt()
|
||||
if a:expr ==# ''
|
||||
redrawstatus
|
||||
return
|
||||
endif
|
||||
try
|
||||
syn clear FileNames
|
||||
catch
|
||||
endtr
|
||||
exe 'syn match FileNames /' . substitute(a:expr, '\([/\\]\)', '\\\1', 'g') . '/'
|
||||
hi def link FileNames MoreMsg
|
||||
let s:grep_expr = a:expr
|
||||
let s:grep_timer_id = timer_start(500, funcref('s:grep_timer'), {'repeat' : 1})
|
||||
endfunction
|
||||
|
||||
let s:MPT._handle_fly = function('s:flygrep')
|
||||
|
||||
function! s:close_buffer() abort
|
||||
if s:grepid != 0
|
||||
call s:JOB.stop(s:grepid)
|
||||
endif
|
||||
if s:grep_timer_id != 0
|
||||
call timer_stop(s:grep_timer_id)
|
||||
endif
|
||||
q
|
||||
endfunction
|
||||
|
||||
let s:MPT._onclose = function('s:close_buffer')
|
||||
|
||||
|
||||
function! s:close_grep_job() abort
|
||||
if s:grepid != 0
|
||||
call s:JOB.stop(s:grepid)
|
||||
endif
|
||||
if s:grep_timer_id != 0
|
||||
call timer_stop(s:grep_timer_id)
|
||||
endif
|
||||
normal! "_ggdG
|
||||
endfunction
|
||||
|
||||
let s:MPT._oninputpro = function('s:close_grep_job')
|
||||
|
||||
" @vimlint(EVL103, 1, a:data)
|
||||
" @vimlint(EVL103, 1, a:id)
|
||||
" @vimlint(EVL103, 1, a:event)
|
||||
function! s:grep_stdout(id, data, event) abort
|
||||
let datas =filter(a:data, '!empty(v:val)')
|
||||
if getline(1) ==# ''
|
||||
call setline(1, datas)
|
||||
else
|
||||
call append('$', datas)
|
||||
endif
|
||||
call s:MPT._build_prompt()
|
||||
endfunction
|
||||
|
||||
function! s:grep_exit(id, data, event) abort
|
||||
redrawstatus
|
||||
let s:grepid = 0
|
||||
endfunction
|
||||
|
||||
" @vimlint(EVL103, 0, a:data)
|
||||
" @vimlint(EVL103, 0, a:id)
|
||||
" @vimlint(EVL103, 0, a:event)
|
||||
|
||||
function! s:get_search_cmd(exe, expr) abort
|
||||
if a:exe ==# 'grep'
|
||||
return ['grep', '-inHR', '--exclude-dir', '.git', a:expr, '.']
|
||||
elseif a:exe ==# 'rg'
|
||||
return ['rg', '-n', '-i', a:expr]
|
||||
else
|
||||
return [a:exe, a:expr]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:next_item() abort
|
||||
if line('.') == line('$')
|
||||
normal! gg
|
||||
else
|
||||
normal! j
|
||||
endif
|
||||
redrawstatus
|
||||
call s:MPT._build_prompt()
|
||||
endfunction
|
||||
|
||||
function! s:previous_item() abort
|
||||
if line('.') == 1
|
||||
normal! G
|
||||
else
|
||||
normal! k
|
||||
endif
|
||||
redrawstatus
|
||||
call s:MPT._build_prompt()
|
||||
endfunction
|
||||
|
||||
function! s:open_item() abort
|
||||
if line('.') !=# ''
|
||||
if s:grepid != 0
|
||||
call s:JOB.stop(s:grepid)
|
||||
endif
|
||||
call s:MPT._clear_prompt()
|
||||
let s:MPT._quit = 1
|
||||
let isfname = &isfname
|
||||
if s:SYS.isWindows
|
||||
set isfname-=:
|
||||
endif
|
||||
normal! gF
|
||||
let nr = bufnr('%')
|
||||
q
|
||||
exe 'silent b' . nr
|
||||
normal! :
|
||||
let &isfname = isfname
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:double_click() abort
|
||||
if line('.') !=# ''
|
||||
if s:grepid != 0
|
||||
call s:JOB.stop(s:grepid)
|
||||
endif
|
||||
call s:MPT._clear_prompt()
|
||||
let s:MPT._quit = 1
|
||||
let isfname = &isfname
|
||||
if s:SYS.isWindows
|
||||
set isfname-=:
|
||||
endif
|
||||
normal! gF
|
||||
let nr = bufnr('%')
|
||||
q
|
||||
exe 'silent b' . nr
|
||||
normal! :
|
||||
let &isfname = isfname
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:move_cursor() abort
|
||||
if v:mouse_win == winnr()
|
||||
let cl = line('.')
|
||||
if cl < v:mouse_lnum
|
||||
exe 'normal! ' . (v:mouse_lnum - cl) . 'j'
|
||||
elseif cl > v:mouse_lnum
|
||||
exe 'normal! ' . (cl - v:mouse_lnum) . 'k'
|
||||
endif
|
||||
endif
|
||||
call s:MPT._build_prompt()
|
||||
endfunction
|
||||
|
||||
let s:MPT._function_key = {
|
||||
\ "\<Tab>" : function('s:next_item'),
|
||||
\ "\<ScrollWheelDown>" : function('s:next_item'),
|
||||
\ "\<S-tab>" : function('s:previous_item'),
|
||||
\ "\<ScrollWheelUp>" : function('s:previous_item'),
|
||||
\ "\<Return>" : function('s:open_item'),
|
||||
\ "\<LeftMouse>" : function('s:move_cursor'),
|
||||
\ "\<2-LeftMouse>" : function('s:double_click'),
|
||||
\ }
|
||||
|
||||
" statusline api
|
||||
function! SpaceVim#plugins#flygrep#lineNr() abort
|
||||
if getline(1) ==# ''
|
||||
return ''
|
||||
else
|
||||
return line('.') . '/' . line('$')
|
||||
endif
|
||||
endfunction
|
@ -356,9 +356,10 @@ endfunction
|
||||
function! s:pull(repo) abort
|
||||
let s:pct += 1
|
||||
let s:ui_buf[a:repo.name] = s:pct
|
||||
let argv = ['git', '-C', a:repo.path, 'pull']
|
||||
let argv = ['git', '-C', a:repo.path, 'pull', '--progress']
|
||||
if s:JOB.vim_job || s:JOB.nvim_job
|
||||
let jobid = s:JOB.start(argv,{
|
||||
\ 'on_stderr' : function('s:on_install_stdout'),
|
||||
\ 'on_exit' : function('s:on_pull_exit')
|
||||
\ })
|
||||
if jobid != 0
|
||||
|
67
autoload/SpaceVim/plugins/searcher.vim
Normal file
67
autoload/SpaceVim/plugins/searcher.vim
Normal file
@ -0,0 +1,67 @@
|
||||
let s:JOB = SpaceVim#api#import('job')
|
||||
|
||||
let s:rst = []
|
||||
|
||||
function! SpaceVim#plugins#searcher#find(expr, exe) abort
|
||||
if empty(a:expr)
|
||||
let expr = input('search expr: ')
|
||||
else
|
||||
let expr = a:expr
|
||||
endif
|
||||
call s:JOB.start(s:get_search_cmd(a:exe, expr), {
|
||||
\ 'on_stdout' : function('s:search_stdout'),
|
||||
\ 'in_io' : 'null',
|
||||
\ 'on_exit' : function('s:search_exit'),
|
||||
\ })
|
||||
endfunction
|
||||
" @vimlint(EVL103, 1, a:id)
|
||||
" @vimlint(EVL103, 1, a:event)
|
||||
function! s:search_stdout(id, data, event) abort
|
||||
for data in a:data
|
||||
let info = split(data, '\:\d\+\:')
|
||||
if len(info) == 2
|
||||
let [fname, text] = info
|
||||
let lnum = matchstr(data, '\:\d\+\:')[1:-2]
|
||||
call add(s:rst, {
|
||||
\ 'filename' : fnamemodify(fname, ':p'),
|
||||
\ 'lnum' : lnum,
|
||||
\ 'text' : text,
|
||||
\ })
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:get_search_cmd(exe, expr) abort
|
||||
if a:exe ==# 'grep'
|
||||
return ['grep', '-inHR', '--exclude-dir', '.git', a:expr, '.']
|
||||
elseif a:exe ==# 'rg'
|
||||
return ['rg', '-n', a:expr]
|
||||
else
|
||||
return [a:exe, a:expr]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" @vimlint(EVL103, 1, a:data)
|
||||
function! s:search_exit(id, data, event) abort
|
||||
let &l:statusline = SpaceVim#layers#core#statusline#get(1)
|
||||
endfunction
|
||||
|
||||
" @vimlint(EVL103, 0, a:data)
|
||||
" @vimlint(EVL103, 0, a:id)
|
||||
" @vimlint(EVL103, 0, a:event)
|
||||
|
||||
function! SpaceVim#plugins#searcher#list() abort
|
||||
call setqflist(s:rst)
|
||||
let s:rst = []
|
||||
copen
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#plugins#searcher#count() abort
|
||||
if empty(s:rst)
|
||||
return ''
|
||||
else
|
||||
return ' ' . len(s:rst) . ' items '
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -26,7 +26,7 @@ else
|
||||
exec 'colorscheme '. g:spacevim_colorscheme_default
|
||||
endif
|
||||
if g:spacevim_hiddenfileinfo == 1 && has('patch-7.4.1570')
|
||||
set shortmess=filnxtToOFs
|
||||
set shortmess+=F
|
||||
endif
|
||||
if !empty(g:spacevim_guifont)
|
||||
exe 'set guifont=' . g:spacevim_guifont
|
||||
|
@ -50,8 +50,9 @@ CONTENTS *SpaceVim-contents*
|
||||
6. API........................................................|SpaceVim-api|
|
||||
1. cmdlinemenu................................|SpaceVim-api-cmdlinemenu|
|
||||
2. data#list....................................|SpaceVim-api-data-list|
|
||||
3. sid............................................|SpaceVim-api-vim-sid|
|
||||
4. vim#message................................|SpaceVim-api-vim-message|
|
||||
3. prompt..........................................|SpaceVim-api-prompt|
|
||||
4. sid............................................|SpaceVim-api-vim-sid|
|
||||
5. vim#message................................|SpaceVim-api-vim-message|
|
||||
7. FAQ........................................................|SpaceVim-faq|
|
||||
|
||||
==============================================================================
|
||||
@ -982,6 +983,22 @@ listpart({list}, {start}[, {len}])
|
||||
The result is a List, which is part of {list}, starting from index {start},
|
||||
with the length {len}
|
||||
|
||||
==============================================================================
|
||||
PROMPT *SpaceVim-api-prompt*
|
||||
|
||||
open()
|
||||
|
||||
Create a cmdline prompt, use while loop to get the input from user. The
|
||||
default mapping for prompt is:
|
||||
>
|
||||
<Bs> remove last character
|
||||
<C-w> remove the Word before the cursor
|
||||
<C-u> remove the Line before the cursor
|
||||
<C-k> remove the Line after the cursor
|
||||
<C-a> / <Home> Go to the beginning of the line
|
||||
<C-e> / <End> Go to the end of the line
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
SID *SpaceVim-api-vim-sid*
|
||||
|
||||
|
@ -74,7 +74,9 @@ title: "Documentation"
|
||||
* [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)
|
||||
* [Text insertion commands](#text-insertion-commands)
|
||||
@ -120,7 +122,7 @@ title: "Documentation"
|
||||
* [Plugin: Goyo and Limelight](#plugin-goyo-and-limelight)
|
||||
* [Plugin: ChooseWin](#plugin-choosewin)
|
||||
* [Plugin: Bookmarks](#plugin-bookmarks)
|
||||
* [Plugin: Gita](#plugin-gita)
|
||||
* [Plugin: Gina/Gita](#plugin-ginagita)
|
||||
* [Plugin: vim-signify](#plugin-vim-signify)
|
||||
* [Misc Plugins](#misc-plugins)
|
||||
|
||||
@ -398,7 +400,7 @@ Key Binding | Description
|
||||
`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 p` | toggle the cursor 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
|
||||
@ -1084,6 +1086,7 @@ Key Binding | Description
|
||||
`SPC *` or `SPC s P` | search with the first found tool with default input
|
||||
`SPC s a p` | ag
|
||||
`SPC s a P` | ag with default text
|
||||
`SPC s g p` | grep
|
||||
`SPC s g p` | grep with default text
|
||||
`SPC s k p` | ack
|
||||
`SPC s k P` | ack with default text
|
||||
@ -1094,15 +1097,57 @@ Key Binding | Description
|
||||
|
||||
**Hint**: It is also possible to search in a project without needing to open a file beforehand. To do so use `SPC p p` and then `C-s` on a given project to directly search into it like with `SPC s p`. (TODO)
|
||||
|
||||
##### Background searching in a project
|
||||
|
||||
Background search keyword in a project, when searching done, the count will be shown on the statusline.
|
||||
|
||||
Key Binding | Description
|
||||
----------- | -----------
|
||||
`SPC s j` | searching input expr background with the first found tool
|
||||
`SPC s J` | searching cursor word background with the first found tool
|
||||
`SPC s l` | List all searching result in quickfix buffer
|
||||
`SPC s a j` | ag
|
||||
`SPC s a J` | ag with default text
|
||||
`SPC s g j` | grep
|
||||
`SPC s g J` | grep with default text
|
||||
`SPC s k j` | ack
|
||||
`SPC s k J` | ack with default text
|
||||
`SPC s t j` | pt
|
||||
`SPC s t J` | pt with default text
|
||||
`SPC s r j` | rg
|
||||
`SPC s r J` | rg with default text
|
||||
|
||||
##### Searching the web
|
||||
|
||||
Key Binding Description
|
||||
Key Binding | Description
|
||||
-----------| -----------
|
||||
`SPC s w g` | Get Google suggestions in vim. Opens Google results in Browser.
|
||||
`SPC s w w` | Get Wikipedia suggestions in vim. Opens Wikipedia page in Browser.(TODO)
|
||||
|
||||
**Note**: to enable google suggestions in vim, you need to add `let g:spacevim_enable_googlesuggest = 1` to your custom Configuration file.
|
||||
|
||||
#### Searching on the fly
|
||||
|
||||
Key Binding | Description
|
||||
-----------| -----------
|
||||
`SPC s g G` | Searching in project on the fly with default tools
|
||||
|
||||
key binding in FlyGrep buffer:
|
||||
|
||||
Key Binding Description
|
||||
-----------| -----------
|
||||
`<Esc>` | close FlyGrep buffer
|
||||
`<Enter>` | open file at the cursor line
|
||||
`<Tab>` | move cursor line down
|
||||
`<S-Tab>` | move cursor line up
|
||||
`<Bs>` | remove last character
|
||||
`<C-w>` | remove the Word before the cursor
|
||||
`<C-u>` | remove the Line before the cursor
|
||||
`<C-k>` | remove the Line after the cursor
|
||||
`<C-a>`/`<Home>` | Go to the beginning of the line
|
||||
`<C-e>`/`<End>` | Go to the end of the line
|
||||
|
||||
|
||||
#### Persistent highlighting
|
||||
|
||||
SpaceVim uses `g:spacevim_search_highlight_persist` to keep the searched expression highlighted until the next search. It is also possible to clear the highlighting by pressing `SPC s c` or executing the ex command `:noh`.
|
||||
@ -1623,7 +1668,7 @@ Key | Mode | Action
|
||||
|
||||
As SpaceVim use above bookmarks mappings, so you can not use `a`, `m`, `n`, `p` or `i` registers to mark current position, but other registers should works will. if you really need to use these registers, you can add `nnoremap <leader>m m` to your custom configuration, then you use use `a` registers via `\ma`
|
||||
|
||||
##### Plugin: Gita
|
||||
##### Plugin: Gina/Gita
|
||||
|
||||
Key | Mode | Action
|
||||
----- |:----:| ------------------
|
||||
@ -1632,6 +1677,8 @@ Key | Mode | Action
|
||||
`<leader>`+`gc` | Normal | Git commit
|
||||
`<leader>`+`gb` | Normal | Git blame
|
||||
`<leader>`+`gp` | Normal | Git push
|
||||
`<leader>`+`ga` | Normal | Git add current buffer
|
||||
`<leader>`+`gA` | Normal | Git add all files
|
||||
|
||||
##### Plugin: vim-signify
|
||||
|
||||
|
114
docs/install.sh
114
docs/install.sh
@ -1,67 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
|
||||
# A guarding function to avoid executing an incompletely downloaded script
|
||||
guard () {
|
||||
#=============================================================================
|
||||
# install.sh --- bootstrap script for SpaceVim
|
||||
# Copyright (c) 2016-2017 Shidong Wang & Contributors
|
||||
# Author: Shidong Wang < wsdjeg at 163.com >
|
||||
# URL: https://spacevim.org
|
||||
# License: MIT license
|
||||
#=============================================================================
|
||||
|
||||
|
||||
# Reset
|
||||
Color_off='\033[0m' # Text Reset
|
||||
Version='0.4.0-dev'
|
||||
|
||||
# Regular Colors
|
||||
Red='\033[0;31m' # Red
|
||||
Blue='\033[0;34m' # Blue
|
||||
Red='\033[0;31m'
|
||||
Blue='\033[0;34m'
|
||||
Green='\033[0;32m'
|
||||
|
||||
need_cmd () {
|
||||
if ! hash "$1" &>/dev/null; then
|
||||
echo -e "${Red}need '$1' (command not found)${Color_off}"
|
||||
error "Need '$1' (command not fount)"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
msg() {
|
||||
printf '%b\n' "$1" >&2
|
||||
}
|
||||
|
||||
success() {
|
||||
msg "${Green}[✔]${Color_off} ${1}${2}"
|
||||
}
|
||||
|
||||
info() {
|
||||
msg "${Blue}==>${Color_off} ${1}${2}"
|
||||
}
|
||||
|
||||
error() {
|
||||
msg "${Red}[✘]${Color_off} ${1}${2}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
fetch_repo () {
|
||||
if [[ -d "$HOME/.SpaceVim" ]]; then
|
||||
info "Trying to update SpaceVim"
|
||||
git --git-dir "$HOME/.SpaceVim/.git" pull
|
||||
echo -e "${Blue}Successfully update SpaceVim${Color_off}"
|
||||
success "Successfully update SpaceVim"
|
||||
else
|
||||
info "Trying to clone SpaceVim"
|
||||
git clone https://github.com/SpaceVim/SpaceVim.git "$HOME/.SpaceVim"
|
||||
echo -e "${Blue}Successfully clone SpaceVim${Color_off}"
|
||||
success "Successfully clone SpaceVim"
|
||||
fi
|
||||
}
|
||||
|
||||
install_vim () {
|
||||
if [[ -f "$HOME/.vimrc" ]]; then
|
||||
mv "$HOME/.vimrc" "$HOME/.vimrc_back"
|
||||
echo -e "${Blue}BackUp $HOME/.vimrc${Color_off}"
|
||||
success "Backup $HOME/.vimrc to $HOME/.vimrc_back"
|
||||
fi
|
||||
|
||||
if [[ -d "$HOME/.vim" ]]; then
|
||||
if [[ "$(readlink $HOME/.vim)" =~ \.SpaceVim$ ]]; then
|
||||
echo -e "${Blue}Installed SpaceVim for vim${Color_off}"
|
||||
success "Installed SpaceVim for vim"
|
||||
else
|
||||
mv "$HOME/.vim" "$HOME/.vim_back"
|
||||
echo -e "${Blue}BackUp $HOME/.vim${Color_off}"
|
||||
success "BackUp $HOME/.vim to $HOME/.vim_back"
|
||||
ln -s "$HOME/.SpaceVim" "$HOME/.vim"
|
||||
echo -e "${Blue}Installed SpaceVim for vim${Color_off}"
|
||||
success "Installed SpaceVim for vim"
|
||||
fi
|
||||
else
|
||||
ln -s "$HOME/.SpaceVim" "$HOME/.vim"
|
||||
echo -e "${Blue}Installed SpaceVim for vim${Color_off}"
|
||||
success "Installed SpaceVim for vim"
|
||||
fi
|
||||
}
|
||||
|
||||
install_neovim () {
|
||||
if [[ -d "$HOME/.config/nvim" ]]; then
|
||||
if [[ "$(readlink $HOME/.config/nvim)" =~ \.SpaceVim$ ]]; then
|
||||
echo -e "${Blue}Installed SpaceVim for neovim${Color_off}"
|
||||
success "Installed SpaceVim for neovim"
|
||||
else
|
||||
mv "$HOME/.config/nvim" "$HOME/.config/nvim_back"
|
||||
echo -e "${Blue}BackUp $HOME/.config/nvim${Color_off}"
|
||||
success "BackUp $HOME/.config/nvim to $HOME/.config/nvim_back"
|
||||
ln -s "$HOME/.SpaceVim" "$HOME/.config/nvim"
|
||||
echo -e "${Blue}Installed SpaceVim for neovim${Color_off}"
|
||||
success "Installed SpaceVim for neovim"
|
||||
fi
|
||||
else
|
||||
ln -s "$HOME/.SpaceVim" "$HOME/.config/nvim"
|
||||
echo -e "${Blue}Installed SpaceVim for neovim${Color_off}"
|
||||
success "Installed SpaceVim for neovim"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -69,16 +95,16 @@ uninstall_vim () {
|
||||
if [[ -d "$HOME/.vim" ]]; then
|
||||
if [[ "$(readlink $HOME/.vim)" =~ \.SpaceVim$ ]]; then
|
||||
rm "$HOME/.vim"
|
||||
echo -e "${Blue}Uninstall SpaceVim for vim${Color_off}"
|
||||
success "Uninstall SpaceVim for vim"
|
||||
if [[ -d "$HOME/.vim_back" ]]; then
|
||||
mv "$HOME/.vim_back" "$HOME/.vim"
|
||||
echo -e "${Blue}Recover $HOME/.vim${Color_off}"
|
||||
success "Recover from $HOME/.vim_back"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [[ -f "$HOME/.vimrc_back" ]]; then
|
||||
mv "$HOME/.vimrc_back" "$HOME/.vimrc"
|
||||
echo -e "${Blue}Recover $HOME/.vimrc${Color_off}"
|
||||
success "Recover from $HOME/.vimrc_back"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -86,37 +112,55 @@ uninstall_neovim () {
|
||||
if [[ -d "$HOME/.config/nvim" ]]; then
|
||||
if [[ "$(readlink $HOME/.config/nvim)" =~ \.SpaceVim$ ]]; then
|
||||
rm "$HOME/.config/nvim"
|
||||
echo -e "${Blue}Uninstall SpaceVim for neovim${Color_off}"
|
||||
success "Uninstall SpaceVim for neovim"
|
||||
if [[ -d "$HOME/.config/nvim_back" ]]; then
|
||||
mv "$HOME/.config/nvim_back" "$HOME/.config/nvim"
|
||||
echo -e "${Blue}Recover $HOME/.config/nvim${Color_off}"
|
||||
success "Recover from $HOME/.config/nvim_back"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
usage () {
|
||||
echo "SpaceVim install script : V 0.1.0-dev"
|
||||
echo "SpaceVim install script : V ${Version}"
|
||||
echo ""
|
||||
echo "Usage : curl -sLf https://spacevim.org/install.sh | bash -s -- [option] [target]"
|
||||
echo ""
|
||||
echo " This is bootstrap script for SpaceVim."
|
||||
echo ""
|
||||
echo "OPTIONS"
|
||||
echo ""
|
||||
echo " -i, --install install spacevim for vim or neovim"
|
||||
echo " -v, --version Show version information and exit"
|
||||
echo " -u, --uninstall Uninstall SpaceVim"
|
||||
echo ""
|
||||
echo "EXAMPLE"
|
||||
echo ""
|
||||
echo " Install SpaceVim for vim and neovim"
|
||||
echo ""
|
||||
echo " curl -sLf https://spacevim.org/install.sh | bash"
|
||||
echo ""
|
||||
echo " Install SpaceVim for vim only or neovim only"
|
||||
echo " curl -sLf https://spacevim.org/install.sh | bash -s -- install vim"
|
||||
echo " or"
|
||||
echo " curl -sLf https://spacevim.org/install.sh | bash -s -- install neovim"
|
||||
echo ""
|
||||
echo " curl -sLf https://spacevim.org/install.sh | bash -s -- --install vim"
|
||||
echo " curl -sLf https://spacevim.org/install.sh | bash -s -- --install neovim"
|
||||
echo ""
|
||||
echo " Uninstall SpaceVim"
|
||||
echo " curl -sLf https://spacevim.org/install.sh | bash -s -- uninstall"
|
||||
echo ""
|
||||
echo " curl -sLf https://spacevim.org/install.sh | bash -s -- --uninstall"
|
||||
}
|
||||
|
||||
|
||||
if [ $# -gt 0 ]
|
||||
then
|
||||
case $1 in
|
||||
uninstall)
|
||||
--uninstall|-u)
|
||||
info "Trying to uninstall SpaceVim"
|
||||
uninstall_vim
|
||||
uninstall_neovim
|
||||
exit 0
|
||||
;;
|
||||
install)
|
||||
--install|-i)
|
||||
need_cmd 'git'
|
||||
fetch_repo
|
||||
if [ $# -eq 2 ]
|
||||
@ -135,9 +179,13 @@ then
|
||||
install_neovim
|
||||
exit 0
|
||||
;;
|
||||
-h)
|
||||
--help|-h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--version|-v)
|
||||
msg "${Version}"
|
||||
exit 0
|
||||
esac
|
||||
fi
|
||||
# if no argv, installer will install SpaceVim
|
||||
@ -145,9 +193,3 @@ need_cmd 'git'
|
||||
fetch_repo
|
||||
install_vim
|
||||
install_neovim
|
||||
|
||||
# end of guard
|
||||
}
|
||||
|
||||
# download finished fine
|
||||
guard $@
|
||||
|
8
syntax/SpaceVimFlyGrep.vim
Normal file
8
syntax/SpaceVimFlyGrep.vim
Normal file
@ -0,0 +1,8 @@
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let b:current_syntax = "SpaceVimFlyGrep"
|
||||
syntax case ignore
|
||||
syn match FileName /[^:]*:\d\+:/
|
||||
|
||||
hi def link FileName Comment
|
Loading…
x
Reference in New Issue
Block a user