Temp
This commit is contained in:
parent
c91668c8a9
commit
6b16dade7c
20 changed files with 207 additions and 90 deletions
|
|
@ -1,7 +1,7 @@
|
|||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
let s:loaded = 1
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
function! features#debug#run()
|
||||
|
|
@ -13,3 +13,7 @@ function! features#debug#run()
|
|||
echo "Nimble: " . g:nvim_nim_exec_nimble
|
||||
echo "Nimsuggest: " . g:nvim_nim_exec_nimsuggest
|
||||
endfunction
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
scriptencoding utf-8
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
let s:edb_terminal_job = -2
|
||||
|
||||
let s:NimDebugger = {
|
||||
|
|
@ -89,3 +95,7 @@ function! s:ParseTerminal()
|
|||
echoerr "WAAAT"
|
||||
echoerr &t_RV
|
||||
endfunction
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
let s:loaded = 1
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
let s:DefinitionImpl = {}
|
||||
|
|
@ -16,3 +16,7 @@ endfunction
|
|||
function! features#definition#run()
|
||||
call suggest#New("def", 0, 0, s:DefinitionImpl)
|
||||
endfunction
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
let s:loaded = 1
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
let s:InfoImpl = {}
|
||||
|
|
@ -56,3 +56,7 @@ endfunction
|
|||
function! features#info#run()
|
||||
call suggest#New("def", 0, 0, s:New(0))
|
||||
endfunction
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
let s:loaded = 1
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
function! features#outline#renderable(parsed)
|
||||
return {
|
||||
|
|
@ -13,6 +14,7 @@ endfunction
|
|||
|
||||
let s:window = -1
|
||||
let s:goto_table = {}
|
||||
let s:buffermap = {}
|
||||
let s:groups = {}
|
||||
let s:group_order = ["Types", "Routines", "Constants", "Globals", "Imports"]
|
||||
let s:symbols = {
|
||||
|
|
@ -62,6 +64,25 @@ function! s:CreateSymbolRow(symbol)
|
|||
return result
|
||||
endfunction
|
||||
|
||||
function! s:FindClosest()
|
||||
if len(s:goto_table) == 0
|
||||
return
|
||||
endif
|
||||
|
||||
echoerr join(sort(map(keys(s:buffermap), 'str2nr(v:val)'), "n"), ", ")
|
||||
let bline = line(".")
|
||||
let closest = 1
|
||||
for l in sort(map(keys(s:buffermap), 'str2nr(v:val)'), "n")
|
||||
if l < bline
|
||||
let closest = l
|
||||
else
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
echom closest
|
||||
endfunction
|
||||
|
||||
function! s:ConfigureOutlineBuffer()
|
||||
if s:IsOpen()
|
||||
return
|
||||
|
|
@ -101,6 +122,7 @@ endfunction
|
|||
|
||||
function! s:UpdateOutline(groups)
|
||||
let s:goto_table = {}
|
||||
let s:buffermap = {}
|
||||
let s:groups = a:groups
|
||||
call s:ConfigureOutlineBuffer()
|
||||
call s:RenderOutline()
|
||||
|
|
@ -109,11 +131,17 @@ endfunction
|
|||
function! s:RenderOutline()
|
||||
let wasFocused = s:IsFocused()
|
||||
|
||||
call s:FindClosest()
|
||||
|
||||
call s:Focus()
|
||||
if !s:IsFocused()
|
||||
return
|
||||
endif
|
||||
|
||||
let l = line(".")
|
||||
let c = line(".")
|
||||
let w0 = line("w0")
|
||||
|
||||
exec "silent vertical resize " . g:nvim_nim_outline_buffer_width
|
||||
|
||||
let rlines = []
|
||||
|
|
@ -127,6 +155,7 @@ function! s:RenderOutline()
|
|||
|
||||
for symbol in s:groups[groupname]
|
||||
let s:goto_table[len(rlines) + 1] = [symbol.line, symbol.col]
|
||||
let s:goto_table[symbol.line] = [len(rlines) + 1]
|
||||
call add(rlines, s:CreateSymbolRow(symbol))
|
||||
endfor
|
||||
call add(rlines, "")
|
||||
|
|
@ -140,6 +169,11 @@ function! s:RenderOutline()
|
|||
|
||||
exec ":" . len(rlines)
|
||||
normal! dG
|
||||
|
||||
call cursor(w0, 1)
|
||||
normal zt
|
||||
call cursor(l, 2)
|
||||
|
||||
if !wasFocused
|
||||
wincmd p
|
||||
endif
|
||||
|
|
@ -195,3 +229,6 @@ function! features#outline#run(isUpdating)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
let s:loaded = 1
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
let s:RenameImpl = {}
|
||||
|
||||
|
|
@ -36,3 +37,7 @@ function! features#rename#run(inProject)
|
|||
call suggest#New("use", 0, 1, s:RenameImpl)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
let s:loaded = 1
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
let s:repl_pid = -1
|
||||
let s:repl_window = -1
|
||||
|
|
@ -65,3 +66,7 @@ function! features#repl#stop()
|
|||
echom "No REPL running"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
let s:loaded = 1
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
let s:highlights = -1
|
||||
|
|
@ -56,3 +56,7 @@ function! features#usages#run(findInProject)
|
|||
call suggest#New("def", 0, 1, s:UsagesDefinitionImpl)
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
scriptencoding utf-8
|
||||
|
||||
|
||||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
scriptencoding utf-8
|
||||
|
||||
|
||||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
scriptencoding utf-8
|
||||
|
||||
|
||||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
scriptencoding utf-8
|
||||
|
||||
|
||||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
scriptencoding utf-8
|
||||
|
||||
|
||||
if exists("s:loaded")
|
||||
finish
|
||||
endif
|
||||
|
|
@ -95,7 +98,7 @@ endfunction
|
|||
|
||||
|
||||
function! util#StartQuery()
|
||||
echohl Comment | echo "..."
|
||||
" echohl Comment | echo "..."
|
||||
endfunction
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,2 @@
|
|||
if exists("g:nvim_nim_ftdetect_loaded")
|
||||
finish
|
||||
endif
|
||||
let g:nvim_nim_ftdetect_loaded = 1
|
||||
|
||||
au BufNewFile,BufRead *.nim setlocal filetype=nim
|
||||
au BufNewFile,BufRead *.nims setlocal filetype=nims
|
||||
scriptencoding utf-8
|
||||
au BufNewFile,BufRead *.nims,*.nim setlocal filetype=nim
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
if exists("b:loaded")
|
||||
finish
|
||||
endif
|
||||
let b:loaded = 1
|
||||
scriptencoding utf-8
|
||||
|
||||
|
||||
setlocal iskeyword=a-z,A-Z,48-57,128-255,_
|
||||
setlocal formatoptions-=t formatoptions+=l
|
||||
|
|
@ -16,41 +14,54 @@ setlocal errorformat=
|
|||
\%E%f(%l\\,\ %c)\ Error:\ %m,
|
||||
\%W%f(%l\\,\ %c)\ Warning:\ %m
|
||||
|
||||
command! NimDefinition :call features#definition#run()
|
||||
command! NimInfo :call features#info#run()
|
||||
command! NimWeb :call features#info#web()
|
||||
command! NimUsages :call features#usages#run(0)
|
||||
command! NimUsagesProject :call features#usages#run(1)
|
||||
command! NimRenameSymbol :call features#rename#run(0)
|
||||
command! NimRenameSymbolProject :call features#rename#run(1)
|
||||
command! NimDebug :call features#debug#run()
|
||||
command! NimOutline :call features#outline#run(0)
|
||||
command! -buffer -nargs=* -complete=buffer NimDefinition :call features#definition#run()
|
||||
command! -buffer -nargs=* -complete=buffer NimInfo :call features#info#run()
|
||||
command! -buffer -nargs=* -complete=buffer NimWeb :call features#info#web()
|
||||
command! -buffer -nargs=* -complete=buffer NimUsages :call features#usages#run(0)
|
||||
command! -buffer -nargs=* -complete=buffer NimUsagesProject :call features#usages#run(1)
|
||||
command! -buffer -nargs=* -complete=buffer NimRenameSymbol :call features#rename#run(0)
|
||||
command! -buffer -nargs=* -complete=buffer NimRenameSymbolProject :call features#rename#run(1)
|
||||
command! -buffer -nargs=* -complete=buffer NimDebug :call features#debug#run()
|
||||
command! -buffer -nargs=* -complete=buffer NimOutline :call features#outline#run(0)
|
||||
|
||||
command! NimEdb :call features#debugger#run()
|
||||
command! NimEdbStop :call features#debugger#stop()
|
||||
command! NimEdbContinue :call features#debugger#continue()
|
||||
command! NimEdbStepInto :call features#debugger#stepinto()
|
||||
command! NimEdbStepOver :call features#debugger#stepover()
|
||||
command! NimEdbSkipCurrent :call features#debugger#skipcurrent()
|
||||
command! NimEdbIgonore :call features#debugger#ignore()
|
||||
command! NimEdbContinue :call features#debugger#continue()
|
||||
command! NimEdbToggleBP :call features#debugger#togglebp()
|
||||
command! -buffer -nargs=* -complete=buffer NimEdb :call features#debugger#run()
|
||||
command! -buffer -nargs=* -complete=buffer NimEdbStop :call features#debugger#stop()
|
||||
command! -buffer -nargs=* -complete=buffer NimEdbContinue :call features#debugger#continue()
|
||||
command! -buffer -nargs=* -complete=buffer NimEdbStepInto :call features#debugger#stepinto()
|
||||
command! -buffer -nargs=* -complete=buffer NimEdbStepOver :call features#debugger#stepover()
|
||||
command! -buffer -nargs=* -complete=buffer NimEdbSkipCurrent :call features#debugger#skipcurrent()
|
||||
command! -buffer -nargs=* -complete=buffer NimEdbIgonore :call features#debugger#ignore()
|
||||
command! -buffer -nargs=* -complete=buffer NimEdbContinue :call features#debugger#continue()
|
||||
command! -buffer -nargs=* -complete=buffer NimEdbToggleBP :call features#debugger#togglebp()
|
||||
|
||||
command! NimREPL :call features#repl#start()
|
||||
command! NimREPLEvalFile :call features#repl#send(getline(0, line("$")))
|
||||
command! -range NimREPLEval :call features#repl#send(getline(getpos("'<")[1], getpos("'>")[1]))
|
||||
command! -buffer -nargs=* -complete=buffer NimREPL :call features#repl#start()
|
||||
command! -buffer -nargs=* -complete=buffer NimREPLEvalFile :call features#repl#send(getline(0, line("$")))
|
||||
command! -buffer -nargs=* -complete=buffer -range NimREPLEval :call features#repl#send(getline(getpos("'<")[1], getpos("'>")[1]))
|
||||
|
||||
nnoremap <buffer> <c-]> :NimDefinition<cr>
|
||||
nnoremap <buffer> gd :NimDefinition<cr>
|
||||
nnoremap <buffer> gt :NimInfo<cr>
|
||||
nnoremap <buffer> gT :NimWeb<cr>
|
||||
if exists('g:nvim_nim_enable_default_binds')
|
||||
nnoremap <buffer> <c-]> :NimDefinition<cr>
|
||||
nnoremap <buffer> gd :NimDefinition<cr>
|
||||
nnoremap <buffer> gt :NimInfo<cr>
|
||||
nnoremap <buffer> gT :NimWeb<cr>
|
||||
endif
|
||||
|
||||
onoremap <silent>af :<C-U>call util#SelectNimProc(0)<CR>
|
||||
onoremap <silent>if :<C-U>call util#SelectNimProc(1)<CR>
|
||||
vnoremap <silent>af :<C-U>call util#SelectNimProc(0)<CR><Esc>gv
|
||||
vnoremap <silent>if :<C-U>call util#SelectNimProc(1)<CR><Esc>gv
|
||||
if exists('g:nvim_nim_enable_custom_textobjects')
|
||||
onoremap <buffer> <silent>af :<C-U>call util#SelectNimProc(0)<CR>
|
||||
onoremap <buffer> <silent>if :<C-U>call util#SelectNimProc(1)<CR>
|
||||
vnoremap <buffer> <silent>af :<C-U>call util#SelectNimProc(0)<CR><Esc>gv
|
||||
vnoremap <buffer> <silent>if :<C-U>call util#SelectNimProc(1)<CR><Esc>gv
|
||||
endif
|
||||
|
||||
autocmd! BufReadPost,BufWritePost,CursorHold,InsertLeave,TextChanged,InsertEnter *.nim call highlighter#guard()
|
||||
autocmd! CursorHold,BufWritePost,FileWritePost *.nim call features#outline#run(1)
|
||||
autocmd! VimResized,WinEnter * call features#outline#render()
|
||||
call highlighter#guard()
|
||||
augroup nvim_nim_highlighter
|
||||
autocmd! BufReadPost,BufWritePost,CursorHold,InsertLeave,TextChanged,InsertEnter *.nim call highlighter#guard()
|
||||
augroup END
|
||||
|
||||
augroup nvim_nim_outline
|
||||
" autocmd! CursorHold,BufWritePost,FileWritePost *.nim call features#outline#run(1)
|
||||
autocmd! CursorHold,FileWritePost *.nim call features#outline#run(1)
|
||||
autocmd! VimResized,WinEnter * call features#outline#render()
|
||||
augroup END
|
||||
|
||||
if g:nvim_nim_highlighter_enable
|
||||
call highlighter#guard()
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
" scriptencoding utf-8
|
||||
"
|
||||
"
|
||||
" if exists("b:loaded")
|
||||
" finish
|
||||
" endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
scriptencoding utf-8
|
||||
|
||||
|
||||
if has('nvim')
|
||||
runtime! plugin/python_setup.vim
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
if exists("g:nvim_nim_loaded")
|
||||
scriptencoding utf-8
|
||||
|
||||
|
||||
if exists("g:loaded_nvim_nim")
|
||||
finish
|
||||
endif
|
||||
let g:nvim_nim_loaded = 1
|
||||
let g:loaded_nvim_nim = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! CheckDependency(command)
|
||||
if !executable(a:command)
|
||||
|
|
@ -28,25 +33,31 @@ if exists("g:ycm_semantic_triggers")
|
|||
let g:ycm_semantic_triggers["nim"] = ['.', '(']
|
||||
endif
|
||||
|
||||
let g:nvim_nim_exec_nim = CheckDependency("nim")
|
||||
let g:nvim_nim_exec_nimble = CheckDependency("nimble")
|
||||
let g:nvim_nim_exec_nimsuggest = CheckDependency("nimsuggest")
|
||||
let g:nvim_nim_exec_bash = CheckDependency("bash")
|
||||
let g:nvim_nim_deps_nim = FindNimModulesPath()
|
||||
let g:nvim_nim_deps_nimble = FindNimbleModulesPath()
|
||||
let g:nvim_nim_exec_nim = CheckDependency("nim")
|
||||
let g:nvim_nim_exec_nimble = CheckDependency("nimble")
|
||||
let g:nvim_nim_exec_nimsuggest = CheckDependency("nimsuggest")
|
||||
let g:nvim_nim_exec_bash = CheckDependency("bash")
|
||||
let g:nvim_nim_deps_nim = FindNimModulesPath()
|
||||
let g:nvim_nim_deps_nimble = FindNimbleModulesPath()
|
||||
|
||||
let g:nvim_nim_highlighter_enable = 0
|
||||
let g:nvim_nim_enable_async = 1
|
||||
let g:nvim_nim_highlight_builtin = 1
|
||||
let g:nvim_nim_highlight_use_unite = 0
|
||||
let g:nvim_nim_highlighter_enable = 0
|
||||
let g:nvim_nim_enable_async = 1
|
||||
let g:nvim_nim_highlight_builtin = 1
|
||||
let g:nvim_nim_highlight_use_unite = 0
|
||||
|
||||
let g:nvim_nim_outline_buffer = 1
|
||||
let g:nvim_nim_outline_buffer_width = 30
|
||||
let g:nvim_nim_outline_buffer = 1
|
||||
let g:nvim_nim_outline_buffer_width = 30
|
||||
|
||||
let g:nvim_nim_repl_height = 14
|
||||
let g:nvim_nim_repl_vsplit = 0
|
||||
let g:nvim_nim_repl_height = 14
|
||||
let g:nvim_nim_repl_vsplit = 0
|
||||
|
||||
let g:nvim_nim_enable_default_binds = 1
|
||||
let g:nvim_nim_enable_custom_textobjects = 1
|
||||
|
||||
let g:nvim_nim_highlighter_semantics = ["skConst", "skForVar", "skGlobalVar", "skGlobalLet", "skLet", "skModule", "skParam", "skTemp", "skVar"]
|
||||
|
||||
au BufNewFile,BufRead *.nim setlocal filetype=nim
|
||||
au BufNewFile,BufRead *.nims setlocal filetype=nims
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
scriptencoding utf-8
|
||||
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
scriptencoding utf-8
|
||||
|
||||
|
||||
syntax keyword nimoTypes Types
|
||||
syntax keyword nimoCallables Callables
|
||||
syntax keyword nimoCallables Routines
|
||||
syntax keyword nimoConstants Constants
|
||||
syntax keyword nimoGlobals Globals
|
||||
syntax keyword nimoImports Imports
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue