Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
119 lines
3.1 KiB
VimL
119 lines
3.1 KiB
VimL
"=============================================================================
|
|
" window.vim --- window api for vim and neovim
|
|
" Copyright (c) 2016-2023 Wang Shidong & Contributors
|
|
" Author: Wang Shidong < wsdjeg@outlook.com >
|
|
" URL: https://spacevim.org
|
|
" License: GPLv3
|
|
"=============================================================================
|
|
|
|
""
|
|
" @section vim#window, api-vim-window
|
|
" @parentsection api
|
|
" @subsection Intro
|
|
"
|
|
" `vim#window` API provides some basic functions for setting and getting config
|
|
" of vim window.
|
|
"
|
|
" @subsection Functions
|
|
"
|
|
" get_cursor({winid})
|
|
"
|
|
" Gets the cursor position in the window {winid}, to get the ID of a window,
|
|
" checkout |window-ID|.
|
|
"
|
|
" set_cursor({winid}, {pos})
|
|
"
|
|
" Sets the cursor position to {pos} in the window {winid}.
|
|
"
|
|
" is_float({winid})
|
|
"
|
|
" Check if the window is a floating windows, return `v:true` if the window
|
|
" is a floating window.
|
|
"
|
|
" winexists({winid})
|
|
"
|
|
" Check if the window with {winid} exists in current tabpage.
|
|
|
|
let s:self = {}
|
|
|
|
if exists('*nvim_win_get_cursor')
|
|
function! s:self.get_cursor(winid) abort
|
|
return nvim_win_get_cursor(a:winid)
|
|
endfunction
|
|
elseif get(g:, '_spacevim_if_lua', 0)
|
|
function! s:self.get_cursor(winid) abort
|
|
lua require("spacevim.api.vim.window").get_cursor(vim.eval("a:winid"))
|
|
endfunction
|
|
else
|
|
function! s:self.get_cursor(winid) abort
|
|
|
|
endfunction
|
|
endif
|
|
|
|
if exists('*nvim_win_set_cursor')
|
|
function! s:self.set_cursor(winid, pos) abort
|
|
return nvim_win_set_cursor(a:winid, a:pos)
|
|
endfunction
|
|
elseif exists('*win_execute')
|
|
function! s:self.set_cursor(win, pos) abort
|
|
" @fixme use g` to move to cursor line
|
|
" this seem to be a bug of vim
|
|
" https://github.com/vim/vim/issues/5022
|
|
call win_execute(a:win, ':call cursor(' . a:pos[0] . ', ' . a:pos[1] . ')')
|
|
" call win_execute(a:win, ':' . a:pos[0])
|
|
call win_execute(a:win, ':normal! g"')
|
|
endfunction
|
|
elseif get(g:, '_spacevim_if_lua', 0)
|
|
function! s:self.set_cursor(winid, pos) abort
|
|
lua require("spacevim.api.vim.window").set_cursor(vim.eval("a:winid"), vim.eval("a:pos"))
|
|
endfunction
|
|
else
|
|
function! s:self.set_cursor(winid, pos) abort
|
|
endfunction
|
|
endif
|
|
|
|
if has('nvim')
|
|
function! s:self.is_float(winid) abort
|
|
if a:winid > 0 && exists('*nvim_win_get_config')
|
|
try
|
|
return has_key(nvim_win_get_config(a:winid), 'col')
|
|
catch
|
|
return 0
|
|
endtry
|
|
else
|
|
return 0
|
|
endif
|
|
endfunction
|
|
else
|
|
function! s:self.is_float(winid) abort
|
|
if a:winid > 0 && exists('*popup_getoptions')
|
|
try
|
|
return has_key(popup_getoptions(a:winid), 'col')
|
|
catch /^Vim\%((\a\+)\)\=:E993/
|
|
return 0
|
|
endtry
|
|
else
|
|
return 0
|
|
endif
|
|
endfunction
|
|
endif
|
|
|
|
function! s:self.win_count() abort
|
|
if has('nvim') && exists('*nvim_win_get_config')
|
|
return len(filter(range(1, winnr('$')), '!has_key(nvim_win_get_config(win_getid(v:val)), "col")'))
|
|
else
|
|
return winnr('$')
|
|
endif
|
|
endfunction
|
|
|
|
function! s:self.winexists(winid) abort
|
|
if !exists('win_id2tabwin')
|
|
return 0
|
|
endif
|
|
return win_id2tabwin(a:winid)[0] == tabpagenr()
|
|
endfunction
|
|
|
|
function! SpaceVim#api#vim#window#get() abort
|
|
return deepcopy(s:self)
|
|
endfunction
|