Skip to content

Commit

Permalink
Folding
Browse files Browse the repository at this point in the history
  • Loading branch information
codebeige committed Feb 23, 2013
1 parent 905e8de commit c3d2507
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
15 changes: 15 additions & 0 deletions vim/after/ftplugin/coffee.vim
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,15 @@
function! CoffeeScriptFolds()
if getline(v:lnum) =~ '->\s*$'
return ">" . indent(v:lnum) / 2
endif
return "="
endfunction

function! CoffeeScriptFoldText()
let foldsize = v:foldend - v:foldstart
return getline(v:foldstart) . " [" . foldsize . " lines] "
endfunction

setlocal foldmethod=expr
setlocal foldexpr=CoffeeScriptFolds()
setlocal foldtext=CoffeeScriptFoldText()
8 changes: 5 additions & 3 deletions vimrc
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
" Make it a real vim " Make it a real vim
set nocompatible set nocompatible


" Load bundles """ Load bundles
silent! call pathogen#infect() silent! call pathogen#infect()
silent! call pathogen#helptags() silent! call pathogen#helptags()


Expand Down Expand Up @@ -166,9 +166,9 @@ autocmd User Rails/spec/**/*_spec.rb UltiSnipsAddFiletypes rspec.rails.ruby
autocmd User Rake map <leader>r :Rake<cr> autocmd User Rake map <leader>r :Rake<cr>
" CoffeScript " CoffeScript
autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
autocmd BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab autocmd BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab
autocmd BufNewFile,BufReadPost *_spec.js.coffee UltiSnipsAddFiletypes mocha.coffee autocmd BufNewFile,BufReadPost *_spec.js.coffee UltiSnipsAddFiletypes mocha.coffee
autocmd BufNewFile,BufReadPost *.coffee normal zR


" Smartinput " Smartinput
call smartinput#map_to_trigger('i', '#', '#', '#') call smartinput#map_to_trigger('i', '#', '#', '#')
Expand All @@ -189,7 +189,7 @@ autocmd BufNewFile,BufReadPost *.mkd,*.md,*.markdown,*.mdown,*.html,*.xhtml map
" RagTag " RagTag
let g:ragtag_global_maps = 1 let g:ragtag_global_maps = 1


"" Scripts & commands """ Scripts & commands


" processing " processing
let processing_doc_path="/Applications/Processing.app/Contents/Resources/Java/modes/java/reference" let processing_doc_path="/Applications/Processing.app/Contents/Resources/Java/modes/java/reference"
Expand Down Expand Up @@ -228,3 +228,5 @@ autocmd User Rails/*.js.coffee nmap <buffer> <leader>ka :!open http://localhost:
" disable automatic linebreaks " disable automatic linebreaks
autocmd FileType vim set textwidth=0 autocmd FileType vim set textwidth=0

" vim: set fdm=expr fde=getline(v\:lnum)=~'"""'?'>1'\:'=':

0 comments on commit c3d2507

Please sign in to comment.