laptop
This commit is contained in:
parent
d8032cc35d
commit
e945735fa1
61 changed files with 344 additions and 550 deletions
1
home/minimal/nvim/dotfiles/after/ftplugin/markdown.vim
Normal file
1
home/minimal/nvim/dotfiles/after/ftplugin/markdown.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
setlocal shiftwidth=2
|
||||
11
home/minimal/nvim/dotfiles/autocommands.vim
Normal file
11
home/minimal/nvim/dotfiles/autocommands.vim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
augroup markdown
|
||||
autocmd!
|
||||
autocmd BufNewFile,BufRead *.Rmd,*.rmd set ft=rmd
|
||||
autocmd BufNewFile,BufRead *.md,*.markdown set ft=markdown
|
||||
autocmd BufNewFile,BufRead *.md,*.markdown set syntax=rmd
|
||||
augroup end
|
||||
|
||||
augroup netrw
|
||||
autocmd!
|
||||
autocmd FileType netrw setl bufhidden=wipe
|
||||
augroup end
|
||||
42
home/minimal/nvim/dotfiles/ftplugin/markdown.vim
Normal file
42
home/minimal/nvim/dotfiles/ftplugin/markdown.vim
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
setlocal spell
|
||||
setlocal textwidth=0
|
||||
setlocal syntax=rmd
|
||||
setlocal breakat-=@
|
||||
|
||||
setlocal makeprg=Rscript\ -e\ 'publishR::render(\\"%\\")'
|
||||
|
||||
nnoremap <localleader>oh :! xdg-open %:r.html<cr>
|
||||
nnoremap <localleader>op :! xdg-open %:r.pdf<cr>
|
||||
nnoremap <localleader>ow :! xdg-open %:r.docx<cr>
|
||||
|
||||
nnoremap <leader>t :TOC<cr>
|
||||
|
||||
xnoremap <silent> ic :<c-u>call InnerChunk()<cr>
|
||||
onoremap <silent> ic :<c-u>call InnerChunk()<cr>
|
||||
xnoremap <silent> ac :<c-u>call OuterChunk()<cr>
|
||||
onoremap <silent> ac :<c-u>call OuterChunk()<cr>
|
||||
|
||||
function OuterChunk()
|
||||
let chunk = FindChunk()
|
||||
execute "normal! " . chunk.start . "GV" . chunk.end . "G"
|
||||
endfunction
|
||||
|
||||
function InnerChunk()
|
||||
let chunk = FindChunk()
|
||||
execute "normal! " . chunk.start . "GjV" . chunk.end . "Gk"
|
||||
endfunction
|
||||
|
||||
function FindChunk()
|
||||
let view = winsaveview()
|
||||
normal! j
|
||||
?\v^ *```(\{.*\})=$
|
||||
let startFence = line(".")
|
||||
/\v^ *``` *
|
||||
let endFence = line(".")
|
||||
if startFence <= view.lnum && endFence >= view.lnum
|
||||
return {"start": startFence, "end": endFence}
|
||||
else
|
||||
echoerr "Not inside a chunk"
|
||||
endif
|
||||
call winrestview(view)
|
||||
endfunction
|
||||
1
home/minimal/nvim/dotfiles/ftplugin/nix.vim
Normal file
1
home/minimal/nvim/dotfiles/ftplugin/nix.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
setlocal makeprg=nixos-rebuild\ dry-build
|
||||
6
home/minimal/nvim/dotfiles/ftplugin/r.vim
Normal file
6
home/minimal/nvim/dotfiles/ftplugin/r.vim
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
nnoremap <localleader>i :! R CMD INSTALL `git rev-parse --show-toplevel`<cr>
|
||||
nnoremap <localleader>d :! R -e "devtools::document()"<cr>
|
||||
nnoremap <localleader>t :! R -e "devtools::test()"<cr>
|
||||
|
||||
" nnoremap <localleader>rl :vsplit \| :terminal R<cr><c-w><c-w>
|
||||
nnoremap <localleader>rl :silent exec "! tmux source-file ~/.config/tmux/rloft.conf"<cr>
|
||||
43
home/minimal/nvim/dotfiles/ftplugin/rmd.vim
Normal file
43
home/minimal/nvim/dotfiles/ftplugin/rmd.vim
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
runtime ftplugin/markdown.vim
|
||||
runtime ftplugin/r.vim
|
||||
|
||||
" let g:slime_cell_delimiter = "```"
|
||||
nmap <silent> snc <plug>SlimeMotionSendic/```{<cr>:noh<cr>j
|
||||
|
||||
nmap <silent> <localleader>pd :execute 'SlimeSend1 datapasta::tribble_construct() \|> clipr::write_clip()'<cr>:sleep500ms<cr>"*p
|
||||
nmap <silent> <localleader>pv :execute 'SlimeSend1 datapasta::vector_construct() \|> clipr::write_clip()'<cr>:sleep500ms<cr>"*p
|
||||
|
||||
nmap sc :set opfunc=SendAndPaste<CR>g@
|
||||
nmap sc<cr> ^:set opfunc=SendAndPaste<CR>g@$
|
||||
vmap sc :<C-U>call SendAndPaste(visualmode(), 1)<CR>
|
||||
|
||||
function! SendAndPaste(type, ...)
|
||||
|
||||
let v = winsaveview()
|
||||
let sel_save = &selection
|
||||
let &selection = "inclusive"
|
||||
let reg_save = @@
|
||||
|
||||
if a:0 " Invoked from Visual mode, use gv command.
|
||||
silent exe "normal! gvy"
|
||||
elseif a:type == 'line'
|
||||
silent exe "normal! '[V']y"
|
||||
else
|
||||
silent exe "normal! `[v`]y"
|
||||
endif
|
||||
|
||||
call slime#send(trim(@@) . " |> capture.output() |> clipr::write_clip()\r")
|
||||
|
||||
/```
|
||||
call append(line("."), ["", "```{r}", "```"])
|
||||
/```{r}
|
||||
sleep 500m
|
||||
let @*=substitute(@*, '\e\[[0-9;]*m', '', 'g')
|
||||
:put*
|
||||
call winrestview(v)
|
||||
let &selection = sel_save
|
||||
let @@ = reg_save
|
||||
endfunction
|
||||
|
||||
|
||||
:UltiSnipsAddFiletypes rmd.r.markdown
|
||||
2
home/minimal/nvim/dotfiles/ftplugin/tex.vim
Normal file
2
home/minimal/nvim/dotfiles/ftplugin/tex.vim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
setlocal makeprg=xelatex\ %
|
||||
nnoremap <localleader>op :! xdg-open %:r.pdf<cr>
|
||||
1
home/minimal/nvim/dotfiles/ftplugin/typescript.vim
Normal file
1
home/minimal/nvim/dotfiles/ftplugin/typescript.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
setlocal makeprg=tsx\ %
|
||||
4
home/minimal/nvim/dotfiles/syntax/rmd.vim
Normal file
4
home/minimal/nvim/dotfiles/syntax/rmd.vim
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
syn region math start=/\$\$/ end=/\$\$/
|
||||
syn match math_block '\$[^$].\{-}\$'
|
||||
hi link math Statement
|
||||
hi link math_block Statement
|
||||
Loading…
Add table
Add a link
Reference in a new issue