Skip to content

Instantly share code, notes, and snippets.

@samstickland
Last active December 17, 2024 20:05
Show Gist options
  • Save samstickland/070abdcd79030d7f4aea9c3b802ac09e to your computer and use it in GitHub Desktop.
Save samstickland/070abdcd79030d7f4aea9c3b802ac09e to your computer and use it in GitHub Desktop.
Vim Config
let mapleader = " "
"Vundle
set nocompatible
filetype off
"filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'thoughtbot/vim-rspec'
Plugin 'airblade/vim-gitgutter'
Plugin 'avakhov/vim-yaml'
Plugin 'slim-template/vim-slim.git'
Plugin 'tpope/vim-rails'
Plugin 'w0rp/ale'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-ruby/vim-ruby'
Plugin 'hail2u/vim-css3-syntax'
Plugin 'cakebaker/scss-syntax.vim'
Plugin 'preservim/nerdtree'
call vundle#end()
syntax enable
filetype plugin indent on
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
" vim-css3-syntax config
augroup VimCSS3Syntax
autocmd!
autocmd FileType css setlocal iskeyword+=-
augroup END
" Backspace works as expected
set backspace=indent,eol,start
set ruler
set pastetoggle=<F2>
set expandtab
set shiftwidth=2
set softtabstop=2
set si
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
"Enable folding
set foldmethod=indent
set foldenable
set foldlevel=100
"Save and restore folding information
"autocmd BufWinLeave *.* mkview
"autocmd BufWinEnter *.* silent loadview
"Highlight overly long longs in a light grey
hi ColorColumn guibg=#000000 ctermbg=0
highlight ColorColumn ctermbg=235 guibg=#2c2d27
let &colorcolumn="80,".join(range(100,999),",")
" Copy up to 1000 lines
set viminfo='20,<1000
"Git commit template
autocmd Filetype gitcommit setlocal spell textwidth=72
" Ale Customisation
let g:ale_echo_msg_format = '[%linter%] %s'
let g:airline#extensions#ale#enabled = 1
let g:rspec_command = "!clear && echo 'bundle exec rspec {spec}' && bundle exec rspec {spec}"
"Rails-vim customisation
let g:rails_projections = {
\ "app/concepts/**/cell/*.rb": {
\ "command": "cell",
\ "affinity": "cell",
\ "alternative": "spec/concepts/{dirname}/cell/{basename}_spec.rb",
\ "related": "app/concepts/{dirname}/view/{basename}.slim"
\ }
\ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment