1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:30:07 +08:00
SpaceVim/config/neovim.vim

88 lines
2.6 KiB
VimL
Raw Normal View History

2016-12-26 21:11:19 +08:00
function! s:GetVisual()
2018-07-28 10:58:12 +08:00
let [lnum1, col1] = getpos("'<")[1:2]
let [lnum2, col2] = getpos("'>")[1:2]
let lines = getline(lnum1, lnum2)
let lines[-1] = lines[-1][:col2 - 2]
let lines[0] = lines[0][col1 - 1:]
return lines
2016-12-26 21:11:19 +08:00
endfunction
function! REPLSend(lines)
2018-07-28 10:58:12 +08:00
call jobsend(g:last_terminal_job_id, add(a:lines, ''))
2016-12-26 21:11:19 +08:00
endfunction
" }}}
" Commands {{{
" REPL integration {{{
command! -range=% REPLSendSelection call REPLSend(s:GetVisual())
command! REPLSendLine call REPLSend([getline('.')])
" }}}
2017-06-27 15:19:48 +08:00
" https://github.com/syngan/vim-vimlint/issues/102
function! s:has(version) abort
2018-07-28 10:58:12 +08:00
return has(a:version)
2017-06-27 15:19:48 +08:00
endfunction
if !s:has('nvim-0.2.0')
2018-07-28 10:58:12 +08:00
let $NVIM_TUI_ENABLE_CURSOR_SHAPE = g:spacevim_terminal_cursor_shape
2017-06-27 15:19:48 +08:00
else
2018-07-28 10:58:12 +08:00
if g:spacevim_terminal_cursor_shape == 0
" prevent nvim from changing the cursor shape
set guicursor=
elseif g:spacevim_terminal_cursor_shape == 1
" enable non-blinking mode-sensitive cursor
set guicursor=n-v-c:block-blinkon0,i-ci-ve:ver25-blinkon0,r-cr:hor20,o:hor50
elseif g:spacevim_terminal_cursor_shape == 2
" enable blinking mode-sensitive cursor
set guicursor=n-v-c:block-blinkon10,i-ci-ve:ver25-blinkon10,r-cr:hor20,o:hor50
endif
2017-06-27 15:19:48 +08:00
endif
2018-07-28 10:58:12 +08:00
2016-12-26 21:11:19 +08:00
"silent! let &t_SI = "\<Esc>]50;CursorShape=1\x7"
"silent! let &t_SR = "\<Esc>]50;CursorShape=2\x7"
"silent! let &t_EI = "\<Esc>]50;CursorShape=0\x7"
" dark0 + gray
2017-02-27 23:40:55 +08:00
let g:terminal_color_0 = '#282828'
let g:terminal_color_8 = '#928374'
2016-12-26 21:11:19 +08:00
" neurtral_red + bright_red
2017-02-27 23:40:55 +08:00
let g:terminal_color_1 = '#cc241d'
let g:terminal_color_9 = '#fb4934'
2016-12-26 21:11:19 +08:00
" neutral_green + bright_green
2017-02-27 23:40:55 +08:00
let g:terminal_color_2 = '#98971a'
let g:terminal_color_10 = '#b8bb26'
2016-12-26 21:11:19 +08:00
" neutral_yellow + bright_yellow
2017-02-27 23:40:55 +08:00
let g:terminal_color_3 = '#d79921'
let g:terminal_color_11 = '#fabd2f'
2016-12-26 21:11:19 +08:00
" neutral_blue + bright_blue
2017-02-27 23:40:55 +08:00
let g:terminal_color_4 = '#458588'
let g:terminal_color_12 = '#83a598'
2016-12-26 21:11:19 +08:00
" neutral_purple + bright_purple
2017-02-27 23:40:55 +08:00
let g:terminal_color_5 = '#b16286'
let g:terminal_color_13 = '#d3869b'
2016-12-26 21:11:19 +08:00
" neutral_aqua + faded_aqua
2017-02-27 23:40:55 +08:00
let g:terminal_color_6 = '#689d6a'
let g:terminal_color_14 = '#8ec07c'
2016-12-26 21:11:19 +08:00
" light4 + light1
2017-02-27 23:40:55 +08:00
let g:terminal_color_7 = '#a89984'
let g:terminal_color_15 = '#ebdbb2'
2016-12-26 21:11:19 +08:00
augroup Terminal
2018-07-28 10:58:12 +08:00
au!
au TermOpen * let g:last_terminal_job_id = b:terminal_job_id | IndentLinesDisable
au WinEnter,BufWinEnter term://* startinsert | IndentLinesDisable
if has('timers')
au TermClose * let g:_spacevim_termclose_abuf = expand('<abuf>') | call timer_start(5, 'SpaceVim#mapping#close_term_buffer')
else
au TermClose * let g:_spacevim_termclose_abuf = expand('<abuf>') | call SpaceVim#mapping#close_term_buffer()
endif
2016-12-26 21:11:19 +08:00
augroup END
2016-12-26 21:11:19 +08:00
augroup nvimrc_aucmd
2018-07-28 10:58:12 +08:00
autocmd!
autocmd CursorHold,FocusGained,FocusLost * rshada|wshada
2016-12-26 21:11:19 +08:00
augroup END