Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Satisfy vint style checking #18

Merged
merged 3 commits into from
Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Syntax highlighting for [YAGPDB](https://yagpdb.xyz) custom commands in (N)Vim.

[![CI](https://github.com/l-zeuch/yagpdb.vim/actions/workflows/ci.yml/badge.svg)](https://github.com/l-zeuch/yagpdb.vim/actions/workflows/ci.yml)

## Installing

Use your favorite plugin manager to install this plugin. [tpope/vim-pathogen](https://github.com/tpope/vim-pathogen), [VundleVim/Vundle.vim](https://github.com/VundleVim/Vundle.vim), [junegunn/vim-plug](https://github.com/junegunn/vim-plug), and [Shougo/dein.vim](https://github.com/Shougo/dein.vim) are some of the more popular ones. A lengthy discussion of these and other managers can be found on [vi.stackexchange.com](https://vi.stackexchange.com/questions/388/what-is-the-difference-between-the-vim-plugin-managers). Basic instructions are provided below, but please **be sure to read, understand, and follow all the safety rules that come with your ~~power tools~~ plugin manager.**
Expand Down
20 changes: 13 additions & 7 deletions ftplugin/yagpdbcc/functions.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,32 @@ inoremap {{ {{}}<left><left>
inoremap <expr> }} strpart(getline('.'), col('.')-1, 2) == "}}" ? "\<right>\<right>" : "}}"

" Make jumping between sections work nicely
" TODO: This sequence of two vint commands shouldn't be necessary, but their
" "next-line" syntax is broken. We'll update this when the PyPI version of
" vint is updated to include their fix. The proper line is:
" " vint: next-line -ProhibitUnusedVariable
" vint: -ProhibitUnusedVariable
function! s:NextSection(type, backwards, visual)
" vint: +ProhibitUnusedVariable
if a:visual
normal! gv
endif

if a:type == 1
let pattern = '\v%(\n\n^\S|%^)'
let flags = 'e'
let l:pattern = '\v%(\n\n^\S|%^)'
let l:flags = 'e'
elseif a:type == 2
let pattern = '\v%(\n\n^\S|%$)'
let flags = ''
let l:pattern = '\v%(\n\n^\S|%$)'
let l:flags = ''
endif

if a:backwards
let dir = '?'
let l:dir = '?'
else
let dir = '/'
let l:dir = '/'
endif

execute 'silent normal! ' . dir . pattern . dir . flags . "\r"
execute 'silent normal! ' . l:dir . l:pattern . l:dir . l:flags . '\r'
endfunction

noremap <script> <buffer> <silent> ]] :call <SID>NextSection(1, 0, 0)<cr>
Expand Down
4 changes: 2 additions & 2 deletions syntax/yagpdbcc/main.vim
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
" LRitzdorf <[email protected]>

" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
if exists('b:current_syntax')
finish
endif

Expand Down Expand Up @@ -136,4 +136,4 @@ syntax match yagpdbccTodo "\v<%(TODO|FIXME|HACK|XXX)>" contained
highlight default link yagpdbccTodo Todo


let b:current_syntax = "yagpdbcc"
let b:current_syntax = 'yagpdbcc'