1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 07:00:04 +08:00

feat(grammarous): add grammarous key bindings

This commit is contained in:
wsdjeg 2023-03-29 18:01:18 +08:00
parent 8513066ee1
commit 2f132784aa
3 changed files with 21 additions and 0 deletions

View File

@ -454,6 +454,8 @@ function! SpaceVim#layers#core#statusline#get(...) abort
return '%#SpaceVim_statusline_a_bold# Python Doc %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
elseif bufname('%') == '__cheat_output__'
return '%#SpaceVim_statusline_a_bold# Vim Cheat %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
elseif bufname('%') == '[Grammarous]'
return '%#SpaceVim_statusline_a_bold# Grammarous Info %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep
elseif &filetype ==# 'gista-list'
return '%#SpaceVim_statusline_ia#'
\ . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#'

View File

@ -299,6 +299,20 @@ function! SpaceVim#layers#edit#config() abort
call SpaceVim#mapping#space#def('nmap', ['x', 'l', 'U'], '<Plug>UniquifyCaseSenstiveLines',
\ 'uniquify-lines (case-senstive)', 0, 1)
let g:_spacevim_mappings_space.x.g = {'name' : '+Grammarous'}
" | `<Plug>(grammarous-move-to-info-window)` | Move the cursor to the info window |
" | `<Plug>(grammarous-open-info-window)` | Open the info window for the error under the cursor |
" | `<Plug>(grammarous-reset)` | Reset the current check |
" | `<Plug>(grammarous-fixit)` | Fix the error under the cursor automatically |
" | `<Plug>(grammarous-fixall)` | Fix all the errors in a current buffer automatically |
" | `<Plug>(grammarous-close-info-window)` | Close the information window from checked buffer |
" | `<Plug>(grammarous-remove-error)` | Remove the error under the cursor |
" | `<Plug>(grammarous-disable-rule)` | Disable the grammar rule under the cursor |
" | `<Plug>(grammarous-move-to-next-error)` | Move cursor to the next error |
" | `<Plug>(grammarous-move-to-previous-error)` | Move cursor to the previous error |
call SpaceVim#mapping#space#def('nmap', ['x', 'g', 'n'], '<Plug>(grammarous-move-to-next-error)', 'move-cursor-to-next-error', 0, 1)
call SpaceVim#mapping#space#def('nmap', ['x', 'g', 'p'], '<Plug>(grammarous-move-to-previous-error)', 'move-cursor-to-previous-error', 0, 1)
let g:_spacevim_mappings_space.i = {'name' : '+Insertion'}
let g:_spacevim_mappings_space.i.l = {'name' : '+Lorem-ipsum'}
let g:_spacevim_mappings_space.i.p = {'name' : '+Passwords'}

View File

@ -133,6 +133,9 @@ endfunction
function! grammarous#info_win#open(e, bufnr)
execute g:grammarous#info_win_direction g:grammarous#info_window_height . 'new' '[Grammarous]'
" why need this, the statusline is not update when open info win first
" time
doautocmd WinEnter
let b:grammarous_preview_original_bufnr = a:bufnr
let b:grammarous_preview_error = a:e
call setline(1, s:get_info_buffer(a:e))
@ -145,6 +148,8 @@ function! grammarous#info_win#open(e, bufnr)
setlocal bufhidden=hide
setlocal buftype=nofile
setlocal readonly
setl winfixwidth
setl winfixheight
setlocal nolist
setlocal nobuflisted
setlocal noswapfile