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