BeyondCodeBootcamp / BeyondCodeBootcamp/vim-ale-hello-world
VimScript & Plugin Notes
- Dominant language
- Shell
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Just putting these somewhere so I don't lose them.
# vimscript 101
```text
' string
['a', 'b'] list
{ 'key': 'value' } map
" comment
\ escape previous newline+whitespace
# filepath
TitleCase function name
```
# How to add a fixer?
DO NOT use hyphens in the file name!! `ajscript_fmt.vim` vs `ajscript-fmt.vim`
See
`autoload/ale/fix/registry.vim`
```vim
# ale#fix#registry#Add(name, func, filetypes, desc, ...)
ale#fix#registry#Add(
\ 'ajscript-fmt',
\ 'ale#fixers#ajscript_fmt#Fix',
\ ['javascript', 'ajscript'],
\ 'Apply AJScript format to a file.'
\)
```
```text
\ 'ajscript-fmt': {
\ 'function': 'ale#fixers#ajscript_fmt#Fix',
\ 'suggested_filetypes': ['javascript', 'ajscript'],
\ 'description': 'Apply AJScript format to a file.',
\ },
```
```text
" g: global var
" a: function argument
" b: ?? variable
" l: function-local variable
" %t means current filename (says gpt)
" :h means dirname (head)
" :t means filename (tail)
```
```vim
function! ale#fixers#ajscript_fmt#GetCwd(buffer) abort
let l:config = ale#path#FindNearestFile(a:buffer, '.ajscript.json')
" Fall back to the directory of the buffer
return !empty(l:config) ? fnamemodify(l:config, ':h') : '%s:h'
endfunction
```
# LSP Server
```vim
call ale#linter#Define('filetype_here', {
\ 'name': 'any_name_you_want',
\ 'lsp': 'socket',
\ 'address': 'servername:1234',
\ 'project_root': '/path/to/root_of_project',
\})
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.