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

Fix install cmd, improve shell layer (#2181)

This commit is contained in:
Wang Shidong 2018-09-25 22:17:36 +08:00 committed by GitHub
parent d33a845d93
commit 567c73f3df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 112 additions and 43 deletions

View File

@ -3,4 +3,6 @@
"docs/cn/*.md": {"alternate": "docs/{}.md"},
"doc/*.txt": {"alternate": "doc/{}.cnx"},
"doc/*.cnx": {"alternate": "doc/{}.txt"},
"docs/*.cmd": {"alternate": "docs/cn/{}.cmd"},
"docs/cn/*.cmd": {"alternate": "docs/{}.cmd"},
}

View File

@ -197,15 +197,6 @@ function! SpaceVim#default#keyBindings() abort
nnoremap <silent><C-Left> :<C-u>wincmd h<CR>
nnoremap <silent><C-Up> :<C-u>wincmd k<CR>
nnoremap <silent><C-Down> :<C-u>wincmd j<CR>
if has('nvim')
exe 'tnoremap <silent><C-Right> <C-\><C-n>:<C-u>wincmd l<CR>'
exe 'tnoremap <silent><C-Left> <C-\><C-n>:<C-u>wincmd h<CR>'
exe 'tnoremap <silent><C-Up> <C-\><C-n>:<C-u>wincmd k<CR>'
exe 'tnoremap <silent><C-Down> <C-\><C-n>:<C-u>wincmd j<CR>'
exe 'tnoremap <silent><M-Left> <C-\><C-n>:<C-u>bprev<CR>'
exe 'tnoremap <silent><M-Right> <C-\><C-n>:<C-u>bnext<CR>'
exe 'tnoremap <silent><esc> <C-\><C-n>'
endif
"Use jk switch to normal mode

View File

@ -26,7 +26,7 @@ function! SpaceVim#layers#edit#plugins() abort
\ ['gcmt/wildfire.vim',{'on_map' : '<Plug>(wildfire-'}],
\ ['easymotion/vim-easymotion'],
\ ['haya14busa/vim-easyoperator-line'],
\ ['editorconfig/editorconfig-vim', { 'merged' : 0}],
\ ['editorconfig/editorconfig-vim', { 'merged' : 0, 'if' : has('python') || has('python3')}],
\ ['osyo-manga/vim-jplus', { 'on_map' : '<Plug>(jplus' }],
\ ['godlygeek/tabular', { 'on_cmd' : 'Tabularize'}],
\ ['ntpeters/vim-better-whitespace', { 'on_cmd' : ['StripWhitespace', 'ToggleWhitespace', 'DisableWhitespace', 'EnableWhitespace']}],

View File

@ -39,6 +39,45 @@ function! SpaceVim#layers#shell#config() abort
\ ]
\ ], 1)
if has('nvim') || exists(':tnoremap') == 2
exe 'tnoremap <silent><C-Right> <C-\><C-n>:<C-u>wincmd l<CR>'
exe 'tnoremap <silent><C-Left> <C-\><C-n>:<C-u>wincmd h<CR>'
exe 'tnoremap <silent><C-Up> <C-\><C-n>:<C-u>wincmd k<CR>'
exe 'tnoremap <silent><C-Down> <C-\><C-n>:<C-u>wincmd j<CR>'
exe 'tnoremap <silent><M-Left> <C-\><C-n>:<C-u>bprev<CR>'
exe 'tnoremap <silent><M-Right> <C-\><C-n>:<C-u>bnext<CR>'
exe 'tnoremap <silent><esc> <C-\><C-n>'
if s:SYSTEM.isWindows
exe 'tnoremap <expr><silent><C-d> SpaceVim#layers#shell#terminal()'
exe 'tnoremap <expr><silent><C-u> SpaceVim#layers#shell#ctrl_u()'
exe 'tnoremap <expr><silent><C-w> SpaceVim#layers#shell#ctrl_w()'
endif
endif
" in window gvim, use <C-d> to close terminal buffer
endfunction
" FIXME:
func! SpaceVim#layers#shell#terminal() abort
let line = getline('$')
let pwd = getcwd()
if line ==# pwd . '>'
return "exit\<CR>"
endif
return "\<C-d>"
endf
func! SpaceVim#layers#shell#ctrl_u() abort
let line = getline('$')
let prompt = getcwd() . '>'
return repeat("\<BS>", len(line) - len(prompt) + 2)
return "\<C-u>"
endfunction
func! SpaceVim#layers#shell#ctrl_w() abort
let cursorpos = term_getcursor(s:term_buf_nr)
let line = getline(cursorpos[0])[:cursorpos[1]-1]
let str = matchstr(line, '[^ ]*\s*$')
return repeat("\<BS>", len(str))
endfunction
@ -90,11 +129,16 @@ function! s:open_default_shell() abort
else
let shell = empty($SHELL) ? 'bash' : $SHELL
endif
call term_start(shell, {'curwin' : 1, 'term_finish' : 'close'})
let s:term_buf_nr = term_start(shell, {'curwin' : 1, 'term_finish' : 'close'})
endif
let s:shell_win_nr = winnr()
let w:shell_layer_win = 1
setlocal nobuflisted
" use q to close terminal buffer in vim, if vimcompatible mode is not
" enabled, and smart quit is on.
if g:spacevim_windows_smartclose == 0 && !g:spacevim_vimcompatible
nnoremap <buffer><silent> q :bd!<CR>
endif
startinsert
else
echo ':terminal is not supported in this version'

View File

@ -69,6 +69,7 @@ let g:terminal_color_14 = '#8ec07c'
" light4 + light1
let g:terminal_color_7 = '#a89984'
let g:terminal_color_15 = '#ebdbb2'
augroup Terminal
au!
au TermOpen * let g:last_terminal_job_id = b:terminal_job_id | IndentLinesDisable
@ -79,6 +80,7 @@ augroup Terminal
au TermClose * let g:_spacevim_termclose_abuf = expand('<abuf>') | call SpaceVim#mapping#close_term_buffer()
endif
augroup END
augroup nvimrc_aucmd
autocmd!
autocmd CursorHold,FocusGained,FocusLost * rshada|wshada

View File

@ -11,7 +11,7 @@ echo " \______/| ##____/ \_______/\_______/\_______/ \_/ |__|__/ |__/
echo " | ## "
echo " | ## "
echo " |__/ "
echo " 版本 : 0.9.0-dev 中文官网 : https://spacevim.org/cn/ "
echo " 版本 : 0.9.0-dev 中文官网 : https://spacevim.org/cn/ "
Push-Location ~
@ -20,7 +20,7 @@ $repo_url = "https://github.com/SpaceVim/SpaceVim.git"
$repo_name = "SpaceVim"
$repo_path = "$HOME\.SpaceVim"
Function Pause ($Message = "请按任意按键继续 . . . ") {
Function Pause ($Message = "请按任意按键继续 . . . ") {
if ((Test-Path variable:psISE) -and $psISE) {
$Shell = New-Object -ComObject "WScript.Shell"
$Button = $Shell.Popup("Click OK to continue.", 0, "Script Paused", 0)
@ -31,48 +31,48 @@ Function Pause ($Message = "请按任意按键继续 . . . ") {
}
}
echo "==> 开始检测环境依赖..."
echo "==> 开始检测环境依赖..."
echo ""
sleep 1
echo "==> 测试 git 命令"
echo "==> 测试 git 命令"
if (Get-Command "git" -ErrorAction SilentlyContinue) {
git version
echo "[OK] 测试成功. 开始下一个测试..."
echo "[OK] 测试成功. 开始下一个测试..."
sleep 1
} else {
echo ""
echo "[ERROR] 无法在你的 PATH 中发现 'git.exe' 命令"
echo ">>> 准备退出......"
echo "[ERROR] 无法在你的 PATH 中发现 'git.exe' 命令"
echo ">>> 准备退出......"
Pause
exit
}
echo ""
echo "==> 测试 gvim 命令"
echo "==> 测试 gvim 命令"
if (Get-Command "gvim" -ErrorAction SilentlyContinue) {
echo ($(vim --version) -split '\n')[0]
echo "[OK] 测试成功. 开始下一个测试..."
echo "[OK] 测试成功. 开始下一个测试..."
sleep 1
} else {
echo "[WARNING] 无法在你的 PATH 中发现 'gvim.exe' 命令. 但仍可继续安装..."
echo "[WARNING] 无法在你的 PATH 中发现 'gvim.exe' 命令. 但仍可继续安装..."
echo ""
echo "[WARNING] 请后续安装 gvim 或者正确设置你的 PATH! "
echo "[WARNING] 请后续安装 gvim 或者正确设置你的 PATH! "
Pause
}
echo "<== 环境依赖检测已完成. 继续下一步..."
echo "<== 环境依赖检测已完成. 继续下一步..."
sleep 1
echo ""
echo ""
if (!(Test-Path "$HOME\.SpaceVim")) {
echo "==> 正在安装 $app_name"
echo "==> 正在安装 $app_name"
git clone $repo_url $repo_path
} else {
echo "==> 正在更新 $app_name"
echo "==> 正在更新 $app_name"
Push-Location $repo_path
git pull origin master
}
@ -80,30 +80,30 @@ if (!(Test-Path "$HOME\.SpaceVim")) {
echo ""
if (!(Test-Path "$HOME\vimfiles")) {
cmd /c mklink $HOME\vimfiles $repo_path
echo "[OK] 已为 vim 安装 SpaceVim"
echo "[OK] 已为 vim 安装 SpaceVim"
sleep 1
} else {
echo "[OK] $HOME\vimfiles 已存在"
echo "[OK] $HOME\vimfiles 已存在"
sleep 1
}
echo ""
if (!(Test-Path "$HOME\AppData\Local\nvim")) {
cmd /c mklink $HOME\AppData\Local\nvim $repo_path
echo "[OK] 已为 neovim 安装 SpaceVim"
cmd /c mklink "$HOME\AppData\Local\nvim" $repo_path
echo "[OK] 已为 neovim 安装 SpaceVim"
sleep 1
} else {
echo "[OK] $HOME\AppData\Local\nvim 已存在"
echo "[OK] $HOME\AppData\Local\nvim 已存在"
sleep 1
}
echo ""
echo "安装已完成!"
echo "安装已完成!"
echo "=============================================================================="
echo "== 打开 Vim 或 Neovim所有插件将会自动安装 =="
echo "== 打开 Vim 或 Neovim所有插件将会自动安装 =="
echo "=============================================================================="
echo ""
echo "感谢支持 SpaceVim欢迎反馈"
echo "感谢支持 SpaceVim欢迎反馈"
echo ""
Pause

View File

@ -25,7 +25,7 @@ lang: cn
- 多光标支持
- 对齐文档内容
- 高亮行为符号
- 自动载入 editorconfig 配置
- 自动载入 editorconfig 配置,需要 `+python` 或者 `+python3` 支持
## 模块选项

View File

@ -57,6 +57,13 @@ The default shell is quickly accessible via a the default shortcut key `SPC '`.
## 快捷键
| 按键 | 描述 |
| ------- | ------------------------------ |
| `SPC '` | 打开终端或跳至已打开的终端窗口 |
| 按键 | 描述 |
| -------- | ---------------------------------- |
| `SPC '` | 打开或跳至已打开的终端窗口 |
| `Ctrl-d` | 输入模式下关闭终端窗口 |
| `q` | Normal 模式下关闭终端窗口 |
| `<Esc>` | 从 Terminal 模式切换到 Normal 模式 |
| `Ctrl-h` | 切换到左侧窗口 |
| `Ctrl-j` | 切换到上方窗口 |
| `Ctrl-k` | 切换到下方窗口 |
| `Ctrl-l` | 切换到右侧窗口 |

View File

@ -85,6 +85,14 @@ if (!(Test-Path "$HOME\vimfiles")) {
echo "[OK] vimfiles already exists"
sleep 1
}
echo ""
if (!(Test-Path "$HOME\AppData\Local\nvim")) {
cmd /c mklink "$HOME\AppData\Local\nvim" $repo_path
} else {
echo "[OK] $HOME\AppData\Local\nvim already exists"
sleep 1
}
echo ""
echo "Almost done!"

View File

@ -19,6 +19,12 @@ This layer provide many edit key bindings for SpaceVim, and also porvide more te
## Features
- chang surround symbol via vim-surround
- repeat latest action via vim-repeat
- multiple cursor
- align
- highlight whitespace at the end of a line
- load ditorconfig config, need `+python` or `+python3`
## Options

View File

@ -37,8 +37,8 @@ Vim support these kinds of shell:
To define the default shell you can set the layer variable `default_shell` to the following variables:
- terminal
- VimShell
- terminal
- VimShell
The default shell is quickly accessible via a the default shortcut key `SPC '`.
@ -58,6 +58,13 @@ in percents with the variable `default_height`. Default value is 30.
## Key bindings
| Key Binding | Description |
| ----------- | -------------------------------------- |
| `SPC '` | Open, close or go to the default shell |
| Key Binding | Description |
| ----------- | ---------------------------------------- |
| `SPC '` | Open or switch to the terminal windows |
| `Ctrl-d` | Close terminal windows in terminal mode |
| `q` | Close terminal windows in Normal mode |
| `<Esc>` | Switch to Normal mode from terminal mode |
| `Ctrl-h` | Switch to the windows on the left |
| `Ctrl-j` | Switch to the windows below |
| `Ctrl-k` | Switch to the windows on the top |
| `Ctrl-l` | Switch to the windows on the right |

View File

@ -89,9 +89,11 @@ The next release is v0.9.0.
- Fix active statusline displaying fileformat info ([#2125](https://github.com/SpaceVim/SpaceVim/pull/2125))
- Fix unkown v:progpath ([#2169](https://github.com/SpaceVim/SpaceVim/pull/2169))
- Fix builtin statusline theme ([#2170](https://github.com/SpaceVim/SpaceVim/pull/2170))
- Fix toggle cursorline highlighting ([#2171](https://github.com/SpaceVim/SpaceVim/pull/2171))
- Fix toggle cursorline
- Fix cn install script ([#2181](https://github.com/SpaceVim/SpaceVim/pull/2181))
- Fix searching for the cursor word in the project w/ FlyGrep ([#2183](https://github.com/SpaceVim/SpaceVim/pull/2183))
### Removed
### Doc, Wiki && Website