mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-25 09:00:05 +08:00
commit
b8739be24b
@ -41,7 +41,11 @@ function! SpaceVim#layers#lang#python#config() abort
|
||||
|
||||
" }}}
|
||||
|
||||
call SpaceVim#plugins#runner#reg_runner('python', 'python %s')
|
||||
call SpaceVim#plugins#runner#reg_runner('python',
|
||||
\ {
|
||||
\ 'exe' : function('s:getexe'),
|
||||
\ 'opt' : [],
|
||||
\ })
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('python', function('s:language_specified_mappings'))
|
||||
call SpaceVim#layers#edit#add_ft_head_tamplate('python',
|
||||
\ ['#!/usr/bin/env python',
|
||||
@ -99,3 +103,13 @@ function! s:language_specified_mappings() abort
|
||||
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
func! s:getexe()
|
||||
let line = getline(1)
|
||||
if line =~ '^#!'
|
||||
let exe = split(line)
|
||||
let exe[0] = exe[0][2:]
|
||||
return exe
|
||||
endif
|
||||
return ['python']
|
||||
endf
|
||||
|
@ -7,8 +7,9 @@
|
||||
"=============================================================================
|
||||
|
||||
|
||||
function! SpaceVim#plugins#highlight#start()
|
||||
function! SpaceVim#plugins#highlight#start() abort
|
||||
let state = SpaceVim#api#import('transient_state')
|
||||
let stack = []
|
||||
call state.set_title('Highlight Transient State')
|
||||
call state.defind_keys(
|
||||
\ {
|
||||
@ -20,10 +21,19 @@ function! SpaceVim#plugins#highlight#start()
|
||||
\ }
|
||||
\ )
|
||||
call state.open()
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:next_item() abort
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:previous_item() abort
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:toggle_item() abort
|
||||
|
||||
endfunction
|
||||
|
||||
" function() wrapper
|
||||
if v:version > 703 || v:version == 703 && has('patch1170')
|
||||
|
@ -60,7 +60,15 @@ endfunction
|
||||
function! s:remove_cursor_highlight() abort
|
||||
call clearmatches()
|
||||
endfunction
|
||||
|
||||
""
|
||||
" public API for iedit mode
|
||||
" >
|
||||
" KEY:
|
||||
" expr match expression
|
||||
" word match word
|
||||
" stack cursor pos stack
|
||||
" <
|
||||
" if only argv 1 is given, use selected word as pattern
|
||||
function! SpaceVim#plugins#iedit#start(...)
|
||||
let save_tve = &t_ve
|
||||
let save_cl = &l:cursorline
|
||||
@ -81,6 +89,7 @@ function! SpaceVim#plugins#iedit#start(...)
|
||||
let symbol = argv.expr
|
||||
elseif has_key(argv, 'word')
|
||||
let symbol = argv.word
|
||||
elseif has_key(argv, 'stack')
|
||||
endif
|
||||
elseif type(argv) == 0 && argv == 1
|
||||
normal! gv"ky
|
||||
@ -93,10 +102,12 @@ function! SpaceVim#plugins#iedit#start(...)
|
||||
call setpos('.', curpos)
|
||||
let begin = get(a:000, 1, 1)
|
||||
let end = get(a:000, 2, line('$'))
|
||||
if use_expr
|
||||
call s:parse_symbol(begin, end, symbol, 1)
|
||||
else
|
||||
call s:parse_symbol(begin, end, symbol)
|
||||
if empty(s:stack)
|
||||
if use_expr
|
||||
call s:parse_symbol(begin, end, symbol, 1)
|
||||
else
|
||||
call s:parse_symbol(begin, end, symbol)
|
||||
endif
|
||||
endif
|
||||
call s:highlight_cursor()
|
||||
redrawstatus!
|
||||
|
@ -57,6 +57,17 @@ function! s:async_run(runner) abort
|
||||
\ 'on_stderr' : function('s:on_stderr'),
|
||||
\ 'on_exit' : function('s:on_compile_exit'),
|
||||
\ })
|
||||
elseif type(a:runner) == type({})
|
||||
let exe = call(a:runner.exe, [])
|
||||
let cmd = exe + a:runner.opt + [bufname('%')]
|
||||
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 3, 0, ['[Running] ' . join(cmd), '', repeat('-', 20)])
|
||||
let s:lines += 3
|
||||
let s:start_time = reltime()
|
||||
let s:job_id = s:JOB.start(cmd,{
|
||||
\ 'on_stdout' : function('s:on_stdout'),
|
||||
\ 'on_stderr' : function('s:on_stderr'),
|
||||
\ 'on_exit' : function('s:on_exit'),
|
||||
\ })
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -561,6 +561,16 @@ SpaceVim#logger#setLevel({level}) *SpaceVim#logger#setLevel()*
|
||||
SpaceVim#logger#setOutput({file}) *SpaceVim#logger#setOutput()*
|
||||
Set the log output file of SpaceVim. Default is empty.
|
||||
|
||||
SpaceVim#plugins#iedit#start() *SpaceVim#plugins#iedit#start()*
|
||||
public API for iedit mode
|
||||
>
|
||||
KEY:
|
||||
expr match expression
|
||||
word match word
|
||||
stack cursor pos stack
|
||||
<
|
||||
if only argv 1 is given, use selected word as pattern
|
||||
|
||||
==============================================================================
|
||||
LAYERS *SpaceVim-layers*
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user