Skip to content

Commit

Permalink
Improved statusline & unified some syntax OCD
Browse files Browse the repository at this point in the history
  • Loading branch information
hkjels committed Mar 16, 2013
1 parent dcf1ff5 commit 6cc5f41
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 15 deletions.
10 changes: 6 additions & 4 deletions vim/.vimrc.link
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ filetype plugin on
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files
set wildignore+=*.sw? " Vim swap files
set wildignore+=*.DS_Store " OSX bullshit
set wildignore+=*.DS_Store " MacOs meta-file
set wildignore+=*.luac " Lua byte code
set wildignore+=*.pyc " Python byte code
set wildignore+=**.class " Cursed Java class files
Expand All @@ -66,10 +66,11 @@ filetype plugin on
set directory=/tmp/ " swap files
set ffs=unix,dos,mac " default file types
set gdefault " search with global by default
set ignorecase " ignore case
set smartcase " ignore case if pattern is lowercase
set incsearch " show search matches as you type
set history=500 " remember more commands and search history
set undolevels=500 " use many muchos levels of undo
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set title " change the terminal's title
set visualbell " no bells!
set noerrorbells " no whistles!
Expand All @@ -94,8 +95,9 @@ filetype plugin on
let g:gist_detect_filetype = 2
let g:gist_show_privates = 1

" NERDTree
" ctrlp
let g:ctrlp_dont_split = 'NERD_tree_2'
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|target\|components'

" SnipMate
let g:snippets_dir = "~/.vim/bundle/snipmate-snippets"
Expand Down
21 changes: 19 additions & 2 deletions vim/aestetics.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
endif

set scrolloff=10
set sidescrolloff=10
set tabstop=2
set shiftwidth=2
set softtabstop=2
Expand All @@ -40,7 +39,6 @@
set smarttab
set autoindent
set smartindent
set cinkeys=0{,0},:,0#,!,!^F
set foldmethod=indent
set foldlevel=99
set splitbelow
Expand All @@ -54,6 +52,11 @@

set statusline =

set statusline+=%#identifier#
set statusline+=%1*
set statusline+=%{Branch()}
set statusline+=%*

" Filename

set statusline+=%#identifier#
Expand All @@ -63,20 +66,34 @@
" Flags
set statusline+=%2*
set statusline+=%h%m%r%w
set statusline+=%*

" Warning when file encoding is not utf-8
set statusline+=%#warningmsg#
set statusline+=%2*
set statusline+=\%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
set statusline+=%*

" Warning on syntax-error
set statusline+=%#warningmsg#
set statusline+=%2*
set statusline+=\%{SyntasticStatuslineFlag()}
set statusline+=%*

" Row & column
set statusline+=%*
set statusline+=%=
set statusline+=%<
set statusline+=%0*\ row:%l/%L\ \ col:%03c
set statusline+=%*

let g:syntastic_enable_signs = 1

fun! Branch()
let s:status = fugitive#statusline()
if (s:status != '')
return strpart(s:status, 4, strlen(s:status) - 5)
endif
return ''
endfun

24 changes: 19 additions & 5 deletions vim/languages.vim
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

" Some file types should wrap their text
function! s:setupWrapping()
set wrap
set linebreak
set textwidth=75
set nolist
endfunction

"------------------------
" Language configurations
"------------------------
Expand All @@ -11,36 +19,42 @@ augroup filetypedetect
au BufNewFile,BufRead *.conf set filetype=apache

" Csv
au BufNewFile,BufRead *.csv,*.dat set filetype=csv
au BufNewFile,BufRead *.{csv,dat,dsv} set filetype=csv

" Coffee-script
au BufNewFile,BufRead *.coffee set filetype=coffee

" Haskell
au BufNewFile,BufRead *.hs compiler ghc

" Ruby
au BufRead,BufNewFile Gemfile, Rakefile, Vagrantfile, Thorfile set filetype=ruby
au BufRead,BufNewFile Procfile, Guardfile, config.ru, *.rake set filetype=ruby

" Jade
au BufNewFile,BufRead *.jade set filetype=jade

" Markdown
au BufNewFile,BufRead *.md,*.markdown,*.mdown,*.mkd set filetype=markdown
au BufNewFile,BufRead *.{md,markdown,mdown,mkd} set filetype=markdown

" Stylus
au BufNewFile,BufRead *.styl set filetype=stylus

" JSON
au BufNewFile,BufRead *.json set filetype=javascript

augroup END


" Javascript
au FileType javascript set dictionary+=$HOME/.vim/bundle/vim-node/dict/node.dict

au FileType markdown call s:setupWrapping

" Haskell
let g:haddock_browser="open"
let g:haddock_browser_callformat = "%s %s"

" Html
au FileType html set matchpairs+=<:>

" Remove trailing whitespace
au FileType c,cpp,php,js,coffee,styl,jade au BufWritePre <buffer> :%s/\s\+$//e

12 changes: 8 additions & 4 deletions vim/map.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
let mapleader = ","
let g:mapleader = ","

" Better focus on search matches
nnoremap n nzzzv
nnoremap N Nzzzv
" Remove highlighted search-query with
nnoremap <CR> :nohlsearch<CR>
nnoremap <silent> <leader>/ :nohlsearch<CR>
" Sudo like a boss
cmap w!! w !sudo tee % >/dev/null
cmap x!! x !sudo tee % >/dev/null
" Normalize regular-expression searches
nnoremap / /\v
vnoremap / /\v
" Sudo like a boss
cmap w!! w !sudo tee % >/dev/null
cmap x!! x !sudo tee % >/dev/null
" Center screen on alternative navigation
nnoremap n nzz
nnoremap } }zz
Expand Down

0 comments on commit 6cc5f41

Please sign in to comment.