Add arduino IDE config

This commit is contained in:
Eric Torres 2023-10-11 20:38:57 -07:00
parent 91539bd448
commit 4dc255bc69
2 changed files with 59 additions and 47 deletions

View File

@ -0,0 +1,11 @@
" Keybindings for sketches
nnoremap <buffer> <leader>aa <cmd>ArduinoAttach<CR>
nnoremap <buffer> <leader>av <cmd>ArduinoVerify<CR>
nnoremap <buffer> <leader>au <cmd>ArduinoUpload<CR>
nnoremap <buffer> <leader>aus <cmd>ArduinoUploadAndSerial<CR>
nnoremap <buffer> <leader>as <cmd>ArduinoSerial<CR>
nnoremap <buffer> <leader>ab <cmd>ArduinoChooseBoard<CR>
nnoremap <buffer> <leader>ap <cmd>ArduinoChooseProgrammer<CR>
" Status line
autocmd BufNewFile,BufRead *.ino let g:airline_section_x='%{MyStatusLine()}'

View File

@ -6,6 +6,7 @@ Plug 'dense-analysis/ale'
"Plug 'tweekmonster/deoplete-clang2' "Plug 'tweekmonster/deoplete-clang2'
Plug 'sbdchd/neoformat' Plug 'sbdchd/neoformat'
Plug 'junegunn/fzf.vim', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim', { 'do': { -> fzf#install() } }
Plug 'stevearc/vim-arduino'
"Plug 'vim-airline/vim-airline' "Plug 'vim-airline/vim-airline'
"Plug 'vim-airline/vim-airline-themes' "Plug 'vim-airline/vim-airline-themes'
@ -27,11 +28,11 @@ let g:airline_theme='simple'
" --------- Ale ---------- " --------- Ale ----------
let g:ale_linters = { let g:ale_linters = {
\ 'python': ['pylint'], \ 'python': ['pylint'],
\ 'vim': ['vint'], \ 'vim': ['vint'],
\ 'cpp': ['clang'], \ 'cpp': ['clang'],
\ 'c': ['clang'] \ 'c': ['clang']
\} \}
" ---------- Deoplete ---------- " ---------- Deoplete ----------
let g:deoplete#enable_at_startup = 1 let g:deoplete#enable_at_startup = 1
@ -48,28 +49,28 @@ set rtp+=/usr/local/opt/fzf
" Navigate to a tag " Navigate to a tag
function! s:tags_sink(line) function! s:tags_sink(line)
let parts = split(a:line, '\t\zs') let parts = split(a:line, '\t\zs')
let excmd = matchstr(parts[2:], '^.*\ze;"\t') let excmd = matchstr(parts[2:], '^.*\ze;"\t')
execute 'silent e' parts[1][:-2] execute 'silent e' parts[1][:-2]
let [magic, &magic] = [&magic, 0] let [magic, &magic] = [&magic, 0]
execute excmd execute excmd
let &magic = magic let &magic = magic
endfunction endfunction
function! s:tags() function! s:tags()
if empty(tagfiles()) if empty(tagfiles())
echohl WarningMsg echohl WarningMsg
echom 'Preparing tags' echom 'Preparing tags'
echohl None echohl None
call system('ctags -R') call system('ctags -R')
endif endif
call fzf#run({ call fzf#run({
\ 'source': 'cat '.join(map(tagfiles(), 'fnamemodify(v:val, ":S")')). \ 'source': 'cat '.join(map(tagfiles(), 'fnamemodify(v:val, ":S")')).
\ '| grep -v -a ^!', \ '| grep -v -a ^!',
\ 'options': '+m -d "\t" --with-nth 1,4.. -n 1 --tiebreak=index', \ 'options': '+m -d "\t" --with-nth 1,4.. -n 1 --tiebreak=index',
\ 'down': '40%', \ 'down': '40%',
\ 'sink': function('s:tags_sink')}) \ 'sink': function('s:tags_sink')})
endfunction endfunction
command! Tags call s:tags() command! Tags call s:tags()
@ -77,45 +78,45 @@ map <C-t> <esc>:Tags<cr>
" Search lines in all open buffers " Search lines in all open buffers
function! s:line_handler(l) function! s:line_handler(l)
let keys = split(a:l, ':\t') let keys = split(a:l, ':\t')
exec 'buf' keys[0] exec 'buf' keys[0]
exec keys[1] exec keys[1]
normal! ^zz normal! ^zz
endfunction endfunction
function! s:buffer_lines() function! s:buffer_lines()
let res = [] let res = []
for b in filter(range(1, bufnr('$')), 'buflisted(v:val)') for b in filter(range(1, bufnr('$')), 'buflisted(v:val)')
call extend(res, map(getbufline(b,0,"$"), 'b . ":\t" . (v:key + 1) . ":\t" . v:val ')) call extend(res, map(getbufline(b,0,"$"), 'b . ":\t" . (v:key + 1) . ":\t" . v:val '))
endfor endfor
return res return res
endfunction endfunction
command! FZFLines call fzf#run({ command! FZFLines call fzf#run({
\ 'source': <sid>buffer_lines(), \ 'source': <sid>buffer_lines(),
\ 'sink': function('<sid>line_handler'), \ 'sink': function('<sid>line_handler'),
\ 'options': '--extended --nth=3..', \ 'options': '--extended --nth=3..',
\ 'down': '60%' \ 'down': '60%'
\}) \})
" Select buffer " Select buffer
function! s:buflist() function! s:buflist()
redir => ls redir => ls
silent ls silent ls
redir END redir END
return split(ls, '\n') return split(ls, '\n')
endfunction endfunction
function! s:bufopen(e) function! s:bufopen(e)
execute 'buffer' matchstr(a:e, '^[ 0-9]*') execute 'buffer' matchstr(a:e, '^[ 0-9]*')
endfunction endfunction
nnoremap <silent> <f5> :call fzf#run({ nnoremap <silent> <f5> :call fzf#run({
\ 'source': reverse(<sid>buflist()), \ 'source': reverse(<sid>buflist()),
\ 'sink': function('<sid>bufopen'), \ 'sink': function('<sid>bufopen'),
\ 'options': '+m', \ 'options': '+m',
\ 'down': len(<sid>buflist()) + 2 \ 'down': len(<sid>buflist()) + 2
\ })<CR> \ })<CR>
" ---------- Neoformat ---------- " ---------- Neoformat ----------
" Override python formatter " Override python formatter