add filetype specific configuration

This commit is contained in:
Felix Van der Jeugt 2015-12-29 21:26:04 +01:00
parent 6b6b979583
commit 02a9dbd2f4
6 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,4 @@
" Interactive
nnoremap <buffer> <Leader>i :terminal cabal exec -- ghci -Wall '%'<CR>

View 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

View 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()

View 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

View File

@ -0,0 +1,4 @@
" Interactive
nnoremap <buffer> <Leader>i :terminal bash --init-file './%'<CR>

View 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