mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 23:00:04 +08:00
add fish script support (#3033)
This commit is contained in:
parent
4d6ebb590e
commit
af1b4d1f29
@ -608,12 +608,14 @@ endif
|
||||
|
||||
augroup spacevim_layer_edit
|
||||
au!
|
||||
autocmd BufNewFile * call <SID>add_buffer_head()
|
||||
autocmd FileType * call <SID>add_buffer_head()
|
||||
augroup END
|
||||
let s:ft_head_tp = {}
|
||||
function! s:add_buffer_head() abort
|
||||
if has_key(s:ft_head_tp, &ft)
|
||||
call setline(1, s:ft_head_tp[&ft])
|
||||
if has_key(s:ft_head_tp, &ft) && getline(1) == '' && line('$') == 1
|
||||
let head = s:ft_head_tp[&ft]
|
||||
call setline(1, head)
|
||||
call cursor(len(head), 0)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -70,7 +70,9 @@ function! SpaceVim#layers#lang#python#config() abort
|
||||
call SpaceVim#layers#edit#add_ft_head_tamplate('python',
|
||||
\ ['#!/usr/bin/env python',
|
||||
\ '# -*- coding: utf-8 -*-',
|
||||
\ '']
|
||||
\ '',
|
||||
\ ''
|
||||
\ ]
|
||||
\ )
|
||||
if executable('ipython')
|
||||
call SpaceVim#plugins#repl#reg('python', 'ipython --no-term-title')
|
||||
|
@ -7,14 +7,15 @@
|
||||
"=============================================================================
|
||||
|
||||
function! SpaceVim#layers#lang#sh#plugins() abort
|
||||
let l:plugins = []
|
||||
call add(l:plugins, ['chrisbra/vim-zsh', { 'on_ft' : 'zsh' }])
|
||||
if get(g:, 'spacevim_enable_ycm') == 1
|
||||
call add(l:plugins, ['Valodim/vim-zsh-completion', { 'on_ft' : 'zsh' }])
|
||||
else
|
||||
call add(l:plugins, ['zchee/deoplete-zsh', { 'on_ft' : 'zsh' }])
|
||||
endif
|
||||
return l:plugins
|
||||
let l:plugins = []
|
||||
call add(l:plugins, ['chrisbra/vim-zsh', { 'on_ft' : 'zsh' }])
|
||||
call add(l:plugins, ['dag/vim-fish', { 'merged' : 0 }])
|
||||
if get(g:, 'spacevim_enable_ycm') == 1
|
||||
call add(l:plugins, ['Valodim/vim-zsh-completion', { 'on_ft' : 'zsh' }])
|
||||
else
|
||||
call add(l:plugins, ['zchee/deoplete-zsh', { 'on_ft' : 'zsh' }])
|
||||
endif
|
||||
return l:plugins
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#sh#config() abort
|
||||
@ -22,19 +23,29 @@ function! SpaceVim#layers#lang#sh#config() abort
|
||||
let g:zsh_fold_enable = 1
|
||||
" }}}
|
||||
|
||||
call SpaceVim#layers#edit#add_ft_head_tamplate('sh',
|
||||
\ ['#!/usr/bin/env bash',
|
||||
\ '']
|
||||
\ )
|
||||
call SpaceVim#layers#edit#add_ft_head_tamplate('sh',
|
||||
\ ['#!/usr/bin/env bash',
|
||||
\ '',
|
||||
\ ''
|
||||
\ ]
|
||||
\ )
|
||||
call SpaceVim#layers#edit#add_ft_head_tamplate('zsh', [
|
||||
\ '#!/usr/bin/env zsh',
|
||||
\ ''
|
||||
\ ])
|
||||
\ '#!/usr/bin/env zsh',
|
||||
\ '',
|
||||
\ ''
|
||||
\ ])
|
||||
call SpaceVim#layers#edit#add_ft_head_tamplate('fish', [
|
||||
\ '#!/usr/bin/env fish',
|
||||
\ '',
|
||||
\ ''
|
||||
\ ])
|
||||
augroup spacevim_layer_lang_sh
|
||||
autocmd!
|
||||
autocmd FileType sh setlocal omnifunc=SpaceVim#plugins#bashcomplete#omnicomplete
|
||||
augroup END
|
||||
call SpaceVim#mapping#gd#add('sh', function('s:go_to_def'))
|
||||
call SpaceVim#mapping#gd#add('zsh', function('s:go_to_def'))
|
||||
call SpaceVim#mapping#gd#add('fish', function('s:go_to_def'))
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('sh', function('s:language_specified_mappings'))
|
||||
endfunction
|
||||
function! s:language_specified_mappings() abort
|
||||
@ -49,7 +60,7 @@ function! s:language_specified_mappings() abort
|
||||
endfunction
|
||||
|
||||
function! s:go_to_def() abort
|
||||
if SpaceVim#layers#lsp#check_filetype('sh')
|
||||
if SpaceVim#layers#lsp#check_filetype(&filetype)
|
||||
call SpaceVim#lsp#go_to_def()
|
||||
endif
|
||||
endfunction
|
||||
|
@ -599,6 +599,9 @@ function! s:winclose() abort " {{{
|
||||
let s:gwin = -1
|
||||
noautocmd execute s:winnr.'wincmd w'
|
||||
call winrestview(s:winv)
|
||||
if exists('*nvim_open_win')
|
||||
doautocmd WinEnter
|
||||
endif
|
||||
endif
|
||||
call s:remove_cursor_highlight()
|
||||
endfunction " }}}
|
||||
|
@ -18,7 +18,7 @@ lang: cn
|
||||
|
||||
## 模块简介
|
||||
|
||||
这一模块为 SpaceVim 提供了 Shell Script 开发支持。Shell Script 是指 Bash script 和 Zsh script。
|
||||
这一模块为 SpaceVim 提供了 Shell Script 开发支持。Shell Script 是指 bash script、zsh script 和 fish script。
|
||||
|
||||
## 功能特性
|
||||
|
||||
|
@ -18,7 +18,7 @@ description: "Shell script development layer, provides autocompletion, syntax ch
|
||||
|
||||
## Description
|
||||
|
||||
This layer is for shell script development. Shell script includes bash script and zsh script.
|
||||
This layer is for shell script development. Shell script includes bash, zsh and fish script.
|
||||
|
||||
## Features
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user