add filetype specific configuration
This commit is contained in:
parent
6b6b979583
commit
02a9dbd2f4
4
config/nvim/ftplugin/haskell.vim
Normal file
4
config/nvim/ftplugin/haskell.vim
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
" Interactive
|
||||
nnoremap <buffer> <Leader>i :terminal cabal exec -- ghci -Wall '%'<CR>
|
||||
|
14
config/nvim/ftplugin/markdown.vim
Normal file
14
config/nvim/ftplugin/markdown.vim
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
" Making and showing html
|
||||
nnoremap <buffer> <Leader>c :terminal markdown '%:p' > '%:p:r.html'<CR>
|
||||
nnoremap <buffer> <Leader>i :!rifle '%:p:r.html'<CR>
|
||||
|
||||
setlocal textwidth=0
|
||||
setlocal wrapmargin=0
|
||||
setlocal colorcolumn=0
|
||||
setlocal wrap
|
||||
setlocal linebreak
|
||||
setlocal nolist
|
||||
|
||||
nmap <buffer> j gj
|
||||
nmap <buffer> k gk
|
40
config/nvim/ftplugin/python.vim
Normal file
40
config/nvim/ftplugin/python.vim
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
" Interactive
|
||||
nnoremap <buffer> <Leader>i :terminal python -i '%'<CR>
|
||||
|
||||
" Lint
|
||||
function Pylint()
|
||||
silent !pylint --reports=n --output-format=parseable '%' > /tmp/errors.err 2> /dev/null
|
||||
cfile
|
||||
silent !rm /tmp/errors.err
|
||||
redraw!
|
||||
copen
|
||||
endfunction
|
||||
|
||||
nnoremap <buffer> <Leader>x :call Pylint()<CR>
|
||||
|
||||
" Folding
|
||||
function PythonFold(lnum)
|
||||
if getline(a:lnum-1) =~ '^\s*def\s' || getline(a:lnum-1) =~ '^\s*class\s'
|
||||
return indent(a:lnum-1) / 4 + 1
|
||||
endif
|
||||
if getline(a:lnum) =~ '^\s*def\s' || getline(a:lnum) =~ '^\s*class\s'
|
||||
return indent(a:lnum) / 4
|
||||
endif
|
||||
if getline(a:lnum+1) =~ '^\s*def\s' || getline(a:lnum+1) =~ '^\s*class\s'
|
||||
return indent(a:lnum + 1) / 4
|
||||
endif
|
||||
if getline(a:lnum+1) =~ '^\S.*$'
|
||||
return '0'
|
||||
endif
|
||||
return '='
|
||||
endfunction
|
||||
|
||||
function PythonFoldText()
|
||||
return repeat(' ', indent(v:foldstart - 1) + 4) . '+'
|
||||
endfunction
|
||||
|
||||
setlocal foldmethod=expr
|
||||
setlocal foldexpr=PythonFold(v:lnum)
|
||||
setlocal foldtext=PythonFoldText()
|
||||
|
33
config/nvim/ftplugin/ruby.vim
Normal file
33
config/nvim/ftplugin/ruby.vim
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
" Interactive
|
||||
nnoremap <buffer> <Leader>i :!irb -Ilib -r ./%<CR><CR>
|
||||
|
||||
" Indent
|
||||
setlocal tabstop=2
|
||||
setlocal shiftwidth=2
|
||||
|
||||
" Folding
|
||||
function RubyFold(lnum)
|
||||
if getline(a:lnum) =~ '^\s*def\s' || getline(a:lnum) =~ '^\s*class\s' || getline(a:lnum) =~ '^\s*module\s'
|
||||
return indent(a:lnum) / 2 + 1
|
||||
endif
|
||||
if getline(a:lnum) =~ '^\s*end'
|
||||
return indent(a:lnum) / 2 + 1
|
||||
endif
|
||||
if getline(a:lnum - 1) =~ '^\s*end'
|
||||
return indent(a:lnum - 1) / 2
|
||||
endif
|
||||
return '='
|
||||
endfunction
|
||||
|
||||
function RubyFoldText()
|
||||
return getline(v:foldstart) . ' +'
|
||||
endfunction
|
||||
|
||||
setlocal foldmethod=expr
|
||||
setlocal foldexpr=RubyFold(v:lnum)
|
||||
setlocal foldtext=RubyFoldText()
|
||||
|
||||
" Use rake as makeprogram
|
||||
setlocal makeprg=rake
|
||||
|
4
config/nvim/ftplugin/sh.vim
Normal file
4
config/nvim/ftplugin/sh.vim
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
" Interactive
|
||||
nnoremap <buffer> <Leader>i :terminal bash --init-file './%'<CR>
|
||||
|
13
config/nvim/ftplugin/tex.vim
Normal file
13
config/nvim/ftplugin/tex.vim
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
" Make a pdf
|
||||
nnoremap <buffer> <Leader>c :terminal pdflatex -shell-escape '%'<CR><CR>
|
||||
nnoremap <buffer> <Leader>i :!rifle '%:p:r.pdf'<CR><CR>
|
||||
|
||||
" Indent
|
||||
setlocal tabstop=2
|
||||
setlocal shiftwidth=2
|
||||
setlocal softtabstop=2
|
||||
|
||||
" Folding
|
||||
setlocal foldmethod=marker
|
||||
|
Loading…
Reference in New Issue
Block a user