Skip to content

Commit

Permalink
Fix bash file references in .bash_custom
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasSmyth committed Apr 15, 2018
1 parent d8c33f7 commit f56fb70
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
8 changes: 4 additions & 4 deletions dotfiles/.bash_custom
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ case $- in
esac

# set custom aliases
if [ -f ~/.custom/bash_aliases.sh ]; then
source ~/.custom/bash_aliases.sh
if [ -f ~/.custom/bash_aliases ]; then
source ~/.custom/bash_aliases
fi

# set custom functions
if [ -f ~/.custom/bash_functions.sh ]; then
source ~/.custom/bash_functions.sh
if [ -f ~/.custom/bash_functions ]; then
source ~/.custom/bash_functions
fi

# files to source
Expand Down
8 changes: 8 additions & 0 deletions dotfiles/.vim/filetype.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile *.k setfiletype k
au! BufRead,BufNewFile *.q setfiletype q
au! BufRead,BufNewFile *.s setfiletype sql
augroup END
17 changes: 12 additions & 5 deletions dotfiles/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ set foldmethod=marker foldnestmax=10 nofoldenable foldlevel=2 " option
"" functions

" function to toggle number behaviour
function! NumberToggle()
fun! NumberToggle()
let save_pos = getpos(".")
if(&relativenumber == 1)
set norelativenumber
Expand All @@ -45,10 +45,10 @@ function! NumberToggle()
set number
endif
call setpos('.', save_pos)
endfunc
endfun

" fill with spaces up to comment column
function! SpaceToComment( str )
fun! SpaceToComment( str )
let tw = &colorcolumn " set tw to the desired comment column
if tw==0 | let tw = 81 | endif
" strip trailing spaces first
Expand All @@ -61,7 +61,14 @@ function! SpaceToComment( str )
.s/$/\=(' '.repeat(a:str, reps))/
normal $
endif
endfunction
endfun

fun! StripTrailingWhitespace()
if &ft =~ 'markdown' " Don't strip on these filetypes
return
endif
if ! &bin | silent! %s/\s\+$//ge | endif " strip whitespace
endfun


"" key mapping
Expand All @@ -81,7 +88,7 @@ nnoremap <M-m> :call SpaceToComment(' ')<CR>

"" auto commands

autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif " auto remove trailing whitespace
autocmd BufRead,BufWrite * call StripTrailingWhitespace() " auto remove trailing whitespace

augroup JumpCursorOnEdit " restore cursor position on reopen
au!
Expand Down

0 comments on commit f56fb70

Please sign in to comment.