Compare commits

...

6 Commits

Author SHA1 Message Date
5d3264a3ce Arduino improvements
Spacing
2023-11-17 09:42:30 +01:00
feaa7b7ca0 Increase number of occasions where telescope is used 2023-11-17 09:41:51 +01:00
a2ae5af2bb Fix fugitive in lightline 2023-11-12 18:01:06 +01:00
a981a1b5a3 Add vim-arduino 2023-11-12 17:46:58 +01:00
78930eb2d6 More markdown math shorthands 2023-11-12 17:46:58 +01:00
891a610718 Replace vim-picker with telescope 2023-11-12 17:46:05 +01:00

View File

@ -92,11 +92,16 @@
" Fuzzy finding " Fuzzy finding
" Plug 'jhawthorn/fzy' " Install this systemwide (or configure a manual " Plug 'jhawthorn/fzy' " Install this systemwide (or configure a manual
" location. See below) " location. See below)
Plug 'srstevenson/vim-picker'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
Plug 'jesseleite/vim-agriculture' Plug 'jesseleite/vim-agriculture'
" vim-telescope, dependencies, and related plugins
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'branch': '0.1.x' }
Plug 'nvim-telescope/telescope-ui-select.nvim'
Plug 'stevearc/dressing.nvim'
" line indentation guides " line indentation guides
Plug 'Yggdroot/indentLine' Plug 'Yggdroot/indentLine'
@ -189,6 +194,11 @@
" Automatically switch fcitx5 modes based on the current vim mode " Automatically switch fcitx5 modes based on the current vim mode
Plug 'rlue/vim-barbaric' Plug 'rlue/vim-barbaric'
" Arduino integration
if system('command -v arduino-cli') != ""
Plug 'stevearc/vim-arduino'
endif
" vim-test - run perl-tests from inside the editor " vim-test - run perl-tests from inside the editor
Plug 'janko-m/vim-test' Plug 'janko-m/vim-test'
@ -309,20 +319,26 @@ tnoremap <Esc> <C-\><C-n>
\ 'active': { \ 'active': {
\ 'left': [ \ 'left': [
\ [ 'mode', 'paste' ], \ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified', 'lastmodified' ], \ [ 'gitbranch', 'arduino_board', 'arduino_programmer', 'arduino_serial_baud', 'arduino_port', 'readonly', 'filename', 'modified', 'lastmodified' ],
\ ], \ ],
\ }, \ },
\ 'component': { \ 'component': {
\ 'lineinfo': ' %3l:%-2v', \ 'lineinfo': ' %3l:%-2v',
\ 'readonly': '%{ &readonly ? "" : "" }', \ 'readonly': '%{ &readonly ? "" : "" }',
\ 'gitbranch': '%{exists("*fugitive#head") && fugitive#head()!=""?"".fugitive#head():""}', \ 'gitbranch': '%{ exists("*FugitiveHead") && FugitiveHead()!="" ? "".FugitiveHead() : "" }',
\ 'lastmodified': '%{ (localtime()-getftime(expand("%:p")) < 60) ? "".localtime()-getftime(expand("%:p")) : "" }', \ 'lastmodified': '%{ (localtime()-getftime(expand("%:p")) < 60) ? "".localtime()-getftime(expand("%:p")) : "" }',
\ 'arduino_board': '%{ &filetype=="arduino" ? "Board: " . ( !empty(g:arduino_board) ? g:arduino_board : "not set" ) : "" }',
\ 'arduino_serial_baud': '%{ &filetype=="arduino" ? "Serial baud: " . ( !empty(g:arduino_serial_baud) ? g:arduino_serial_baud : "not set") : "" }',
\ 'arduino_port': '%{ &filetype=="arduino" ? "Port: " . ( !empty(arduino#GetPort()) ? arduino#GetPort() : "not set" ) : "" }',
\ }, \ },
\ 'component_visible_condition': { \ 'component_visible_condition': {
\ 'readonly': '(&filetype!="help" && &readonly)', \ 'readonly': '(&filetype!="help" && &readonly)',
\ 'modified': '(&filetype!="help" && (&modified||!&modifiable))', \ 'modified': '(&filetype!="help" && (&modified||!&modifiable))',
\ 'gitbranch': '(exists("*fugitive#head") && fugitive#head()!="")', \ 'gitbranch': '(exists("*FugitiveHead") && FugitiveHead()!="")',
\ 'lastmodified': '((localtime()-getftime(expand("%:p"))) < 60)', \ 'lastmodified': '((localtime()-getftime(expand("%:p"))) < 60)',
\ 'arduino_board': '(&filetype=="arduino")',
\ 'arduino_serial_baud': '(&filetype=="arduino")',
\ 'arduino_port': '(&filetype=="arduino")',
\ }, \ },
\ 'separator': { \ 'separator': {
\ 'left': '', \ 'left': '',
@ -487,46 +503,28 @@ if !(has('win32') || has('win64'))
" nnoremap ¬ :PickerEdit ~/jobxx/<cr> " nnoremap ¬ :PickerEdit ~/jobxx/<cr>
endif endif
function! CallPickerEdit() function! FuzzyFileFinder()
let l:IsInGitRepo = system('git rev-parse --is-inside-work-tree') let l:IsInGitRepo = system('git rev-parse --is-inside-work-tree')
if l:IsInGitRepo =~ 'true' if l:IsInGitRepo =~ 'true'
let l:GitRepoDir = system('git rev-parse --show-toplevel') let l:GitRepoDir = system('git rev-parse --show-toplevel')
execute 'PickerEdit ' . l:GitRepoDir execute 'Telescope find_files cwd=' . l:GitRepoDir->fnameescape()
else else
execute 'PickerEdit ' . glob('~/') execute 'Telescope find_files cwd=' . glob('~/')->fnameescape()
" TODO: Verify if this works
" if $USER =~ '^knyff$'
" " TODO: Make PickerEdit work on windows
" execute 'PickerEdit C:\User\' . $USER
" PickerEdit C:\User\knyff\
" else
" PickerEdit ~/
" endif
endif endif
endfunction endfunction
function! CallPickerPDF() nnoremap ¬ :call FuzzyFileFinder()<cr>
let l:IsInGitRepo = system('git rev-parse --is-inside-work-tree')
if l:IsInGitRepo =~ 'true' function! OpenPDFInsteadOfBuffer()
" TODO: Make this work echo expand('%')->fnameescape()
" let l:CurrBufNr = bufnr('%') call system('zathura ' . expand('%')->fnameescape() . ' &')
let l:GitRepoDir = system('git rev-parse --show-toplevel') bd
call picker#File('git ls-files --cached --exclude-standard --others', 'te zathura', l:GitRepoDir)
" execute 'b '.l:CurrBufNr
else
" let l:OldBufNr = bufnr('%')
" echo bufnr('%')
execute 'tabedit'
call picker#File('find ' . glob('~/') . ' -type f', 'te zathura')
" let l:CurrBufNr = bufnr('%')
" echo bufnr('%')
" execute 'tabclose'
" execute 'b '.l:CurrBufNr
endif
endfunction endfunction
nnoremap ¬ :call CallPickerEdit()<cr> augroup OpenExternalFiles
nnoremap ¿ :call CallPickerPDF()<cr> au!
au FileType pdf call OpenPDFInsteadOfBuffer()
augroup END
endif endif
" NeoMake {{{ " NeoMake {{{
@ -828,6 +826,7 @@ augroup CustomCommentDefinitions
autocmd FileType c setlocal commentstring=\/\/\ %s autocmd FileType c setlocal commentstring=\/\/\ %s
autocmd FileType cpp setlocal commentstring=\/\/\ %s autocmd FileType cpp setlocal commentstring=\/\/\ %s
autocmd FileType cuda setlocal commentstring=\/\/\ %s autocmd FileType cuda setlocal commentstring=\/\/\ %s
autocmd FileType arduino setlocal commentstring=\/\/\ %s
autocmd FileType openscad setlocal commentstring=\/\/\ %s autocmd FileType openscad setlocal commentstring=\/\/\ %s
autocmd FileType nix setlocal commentstring=#\ %s autocmd FileType nix setlocal commentstring=#\ %s
autocmd FileType dot setlocal commentstring=\/\/\ %s autocmd FileType dot setlocal commentstring=\/\/\ %s
@ -962,6 +961,10 @@ augroup END
\ "\\quo": "\\operatorname*{quo}", \ "\\quo": "\\operatorname*{quo}",
\ "\\rem": "\\operatorname*{rem}", \ "\\rem": "\\operatorname*{rem}",
\ "\\conv": "\\operatorname*{conv}", \ "\\conv": "\\operatorname*{conv}",
\ "\\lightning": "↯",
\ "\\mdeg": "\\operatorname*{mdeg}",
\ "\\lm": "\\operatorname*{lm}",
\ "\\lt": "\\operatorname*{lt}",
\ }, \ },
\ }, \ },
\ 'uml': {}, \ 'uml': {},
@ -1150,6 +1153,8 @@ nnoremap <Space> :nohl<CR>
autocmd FileType * let b:swap_completefunc = '' autocmd FileType * let b:swap_completefunc = ''
autocmd FileType tex :SwapList font_sizes tiny scriptsize footnotesize small normalsize large Large LARGE huge Huge autocmd FileType tex :SwapList font_sizes tiny scriptsize footnotesize small normalsize large Large LARGE huge Huge
autocmd FileType tex :SwapList sectioning part chapter section subsection subsubsection paragraph subparagraph autocmd FileType tex :SwapList sectioning part chapter section subsection subsubsection paragraph subparagraph
autocmd FileType arduino :SwapList HIGHLOW HIGH LOW
autocmd FileType arduino :SwapList pinMode OUTPUT INPUT INPUT_PULLUP
autocmd BufEnter * let g:default_swap_list = [ autocmd BufEnter * let g:default_swap_list = [
\ {'name':'yes/no', 'options': ['yes','no']}, \ {'name':'yes/no', 'options': ['yes','no']},
\ {'name':'Yes/No', 'options': ['Yes','No']}, \ {'name':'Yes/No', 'options': ['Yes','No']},
@ -1267,6 +1272,12 @@ if executable("rg")
set grepformat=%f:%l:%c:%m set grepformat=%f:%l:%c:%m
endif endif
" vim-arduino {{{
let g:arduino_serial_cmd = 'picocom {port} -b {baud} -q'
let g:arduino_cli_args = '' " default: '-v'
let g:arduino_auto_baud = 1
" }}}
if $USER =~ "^jry$" && $HOSTNAME =~ "gnu" if $USER =~ "^jry$" && $HOSTNAME =~ "gnu"
" Setup Perl language server " Setup Perl language server
" See https://github.com/neovim/nvim-lspconfig " See https://github.com/neovim/nvim-lspconfig