Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ alias cds="cd ~/Source/pl/"
PS1="\[$(tput bold)\](\t)[\[$(tput setaf 6)\]\u@\h\[$(tput setaf 2)\] \w]>\[$(tput sgr0)\]"

# Source the git bash completion file
if [ -f /etc/bash_completion.d/git ]; then
source /etc/bash_completion.d/git
if [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
source /usr/local/etc/bash_completion.d/git-completion.bash
source /usr/local/etc/bash_completion.d/git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWSTASHSTATE=1
PS1='\[$(tput bold)\](\t)[\[\e[1;32m\]\u@\[\[\e[1;32m\]\h\e[0m\]\[$(tput bold)\]]\e[0m\]\[\e[1;34m\]\[$(__git_ps1)\e[0m\] [\w]: '
PS1="\[$(tput bold)\](\t)[\[$(tput setaf 6)\]\u@\h\[$(tput setaf 2)\] \$(__git_ps1 \" (%s)\") \w]>\[$(tput sgr0)\]"
fi

export PS1
Expand Down
54 changes: 54 additions & 0 deletions .vim/autoload/coffee.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <kchmck@gmail.com>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

" Set up some common global/buffer variables.
function! coffee#CoffeeSetUpVariables()
" Path to coffee executable
if !exists('g:coffee_compiler')
let g:coffee_compiler = 'coffee'
endif

" Options passed to coffee with make
if !exists('g:coffee_make_options')
let g:coffee_make_options = ''
endif

" Path to cake executable
if !exists('g:coffee_cake')
let g:coffee_cake = 'cake'
endif

" Extra options passed to cake
if !exists('g:coffee_cake_options')
let g:coffee_cake_options = ''
endif

" Path to coffeelint executable
if !exists('g:coffee_linter')
let g:coffee_linter = 'coffeelint'
endif

" Options passed to CoffeeLint
if !exists('g:coffee_lint_options')
let g:coffee_lint_options = ''
endif

" Pass the litcoffee flag to tools in this buffer if a litcoffee file is open.
" Let the variable be overwritten so it can be updated if a different filetype
" is set.
if &filetype == 'litcoffee'
let b:coffee_litcoffee = '--literate'
else
let b:coffee_litcoffee = ''
endif
endfunction

function! coffee#CoffeeSetUpErrorFormat()
CompilerSet errorformat=Error:\ In\ %f\\,\ %m\ on\ line\ %l,
\Error:\ In\ %f\\,\ Parse\ error\ on\ line\ %l:\ %m,
\SyntaxError:\ In\ %f\\,\ %m,
\%f:%l:%c:\ error:\ %m,
\%-G%.%#
endfunction
82 changes: 82 additions & 0 deletions .vim/compiler/coffee.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <kchmck@gmail.com>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

" All this is needed to support compiling filenames with spaces, quotes, and
" such. The filename is escaped and embedded into the `makeprg` setting.
"
" Because of this, `makeprg` must be updated on every file rename. And because
" of that, `CompilerSet` can't be used because it doesn't exist when the
" rename autocmd is ran. So, we have to do some checks to see whether `compiler`
" was called locally or globally, and respect that in the rest of the script.

if exists('current_compiler')
finish
endif

let current_compiler = 'coffee'
call coffee#CoffeeSetUpVariables()

" Pattern to check if coffee is the compiler
let s:pat = '^' . current_compiler

" Get a `makeprg` for the current filename.
function! s:GetMakePrg()
return g:coffee_compiler .
\ ' -c' .
\ ' ' . b:coffee_litcoffee .
\ ' ' . g:coffee_make_options .
\ ' $*' .
\ ' ' . fnameescape(expand('%'))
endfunction

" Set `makeprg` and return 1 if coffee is still the compiler, else return 0.
function! s:SetMakePrg()
if &l:makeprg =~ s:pat
let &l:makeprg = s:GetMakePrg()
elseif &g:makeprg =~ s:pat
let &g:makeprg = s:GetMakePrg()
else
return 0
endif

return 1
endfunction

" Set a dummy compiler so we can check whether to set locally or globally.
exec 'CompilerSet makeprg=' . current_compiler
" Then actually set the compiler.
call s:SetMakePrg()
call coffee#CoffeeSetUpErrorFormat()

function! s:CoffeeMakeDeprecated(bang, args)
echoerr 'CoffeeMake is deprecated! Please use :make instead, its behavior ' .
\ 'is identical.'
sleep 5
exec 'make' . a:bang a:args
endfunction

" Compile the current file.
command! -bang -bar -nargs=* CoffeeMake
\ call s:CoffeeMakeDeprecated(<q-bang>, <q-args>)

" Set `makeprg` on rename since we embed the filename in the setting.
augroup CoffeeUpdateMakePrg
autocmd!

" Update `makeprg` if coffee is still the compiler, else stop running this
" function.
function! s:UpdateMakePrg()
if !s:SetMakePrg()
autocmd! CoffeeUpdateMakePrg
endif
endfunction

" Set autocmd locally if compiler was set locally.
if &l:makeprg =~ s:pat
autocmd BufWritePre,BufFilePost <buffer> call s:UpdateMakePrg()
else
autocmd BufWritePre,BufFilePost call s:UpdateMakePrg()
endif
augroup END
17 changes: 17 additions & 0 deletions .vim/ftdetect/ansible.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function! s:isAnsible()
let filepath = expand("%:p")
let filename = expand("%:t")
if filepath =~ '\v/(tasks|roles)/.*\.ya?ml$' | return 1 | en
if filepath =~ '\v/(group|host)_vars/' | return 1 | en
if filename =~ '\v(playbook|site)\.ya?ml$' | return 1 | en

let shebang = getline(1)
if shebang =~# '^#!.*/bin/env\s\+ansible-playbook\>' | return 1 | en
if shebang =~# '^#!.*/bin/ansible-playbook\>' | return 1 | en

return 0
endfunction

:au BufNewFile,BufRead *.yml set ft=ansible
:au BufNewFile,BufRead *.j2 set ft=ansible_template
:au BufNewFile,BufRead hosts set ft=ansible_hosts
17 changes: 17 additions & 0 deletions .vim/ftdetect/coffee.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
" Language: CoffeeScript
" Maintainer: Mick Koch <kchmck@gmail.com>
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL

autocmd BufNewFile,BufRead *.coffee set filetype=coffee
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
autocmd BufNewFile,BufRead *._coffee set filetype=coffee

function! s:DetectCoffee()
if getline(1) =~ '^#!.*\<coffee\>'
set filetype=coffee
endif
endfunction

autocmd BufNewFile,BufRead * call s:DetectCoffee()
1 change: 1 addition & 0 deletions .vim/ftdetect/syslog.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.log set filetype=syslog
3 changes: 3 additions & 0 deletions .vim/ftdetect/terraform.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
au BufRead,BufNewFile *.tf setlocal filetype=terraform
au BufRead,BufNewFile *.tfvars setlocal filetype=terraform
au BufRead,BufNewFile *.tfstate setlocal filetype=javascript
4 changes: 4 additions & 0 deletions .vim/ftplugin/ansible.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
" Slow yaml highlighting workaround
if exists('+regexpengine') && ('&regexpengine' == 0)
setlocal regexpengine=1
endif
9 changes: 9 additions & 0 deletions .vim/ftplugin/ansible_hosts.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if exists("b:did_ftplugin")
finish
else
let b:did_ftplugin = 1
endif

setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions-=c

let b:undo_ftplugin = "setl comments< commentstring< formatoptions<"
Loading