Last active
October 14, 2021 10:29
-
-
Save jorgegorka/2965592 to your computer and use it in GitHub Desktop.
vim configuration file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set hlsearch "Highlight searches | |
set incsearch "Incremental search | |
set ls=2 "Always show status line in all windows | |
set autoindent "Auto indent on new line | |
set smartindent | |
set expandtab "tabs to spaces | |
set tabstop=2 "Tabs are 2 spaces in width | |
set shiftwidth=2 "Autodindent to 2 spaces width | |
set scrolloff=10 "Start scrolling when 10 lines close to the bottom | |
set ruler "Shows current file position | |
set statusline=%<%f\ %h%m%y%r%=%-14.(%l,%c%V%)\ %P | |
set cursorcolumn "Highlight current column | |
set cursorline "Highlight current row | |
set novisualbell "Don't shake the screen | |
set number "show line numbers | |
set title "Change title of window based on file | |
set ttyfast "Smoother display for fast terminals | |
set hidden "Don't close buffers when changing files | |
set fileencoding=utf8 "Unicode man | |
set nocompatible "Get all of vim's awesomeness | |
set backspace=indent,eol,start "Allow backspacing over tabs end of lines and start of insert | |
set wildmode=longest,list "Better tab completion of filenames (like bash) | |
set wildmenu "as above | |
set wildignore+=node_modules/**,tmp/**,*.tmp | |
set rtp+=/usr/local/opt/fzf | |
"Allows use of %/ for current directory | |
cmap %/ %:p:h/ | |
"256 coloras | |
if $COLORTERM == 'gnome-terminal' | |
set t_Co=256 | |
endif | |
set background=dark "Tell vim I'm using a dark background | |
colorscheme desert | |
syntax on "syntax highlighting | |
" autocomplete | |
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1 | |
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1 | |
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1 | |
"custom colors | |
hi CursorLine ctermbg=234 term=none cterm=none | |
hi clear CursorColumn | |
hi CursorColumn ctermbg=234 | |
hi LineNr ctermfg=237 ctermbg=233 | |
hi Visual term=bold cterm=italic | |
"indent guides | |
let g:indent_guides_auto_colors = 0 | |
let g:indent_guides_guide_size = 1 | |
let g:indent_guides_start_level = 1 | |
hi IndentGuidesEven ctermbg=black | |
hi IndentGuidesOdd ctermbg=grey | |
let mapleader = "," "Leader from \ to , - means stuff like Command-T plugin becomes ,+t rather than \+t | |
let g:ackprg = 'ag --nogroup --nocolor --column' | |
filetype plugin indent on "Detect filetype indentations | |
"Custom filetypes | |
au BufNewFile,BufRead *.ctp set filetype=html | |
au BufNewFile,BufRead *.ui set filetype=ruby | |
au BufNewFile,BufRead Fudgefile set filetype=ruby | |
"Tabs and traling space highlighting and sorting out - :retab sorts out tabs | |
set list lcs=tab:·⁖,trail:¶ | |
autocmd BufWritePre * :%s/\s\+$//e | |
"Emacs indenting | |
map <Tab> == | |
"NERDTree toggle | |
map <c-T> :NERDTreeToggle<CR> | |
"Easy file switching | |
nnoremap <leader>. <C-^> | |
"Ctrl-P fuzzy matching | |
let g:ctrlp_map = '<leader><leader>' | |
let g:ctrlp_working_path_mode = 0 | |
:command! -range=% Snip '<,'>w! /tmp/snippet | |
:command! Unsnip r /tmp/snippet | |
:command! Q qa! | |
:command! WQ wqa! | |
" Get yankring out of the way | |
let g:yankring_history_dir = '~/.vim/tmp' | |
" Set minium window size | |
set wmh=0 | |
" Maximise or minimise current window | |
if bufwinnr(1) | |
map [ <C-W>= | |
map ] <C-W>_ | |
endif | |
"http://vim.wikia.com/wiki/VimTip906 | |
nnoremap <F2> :set invpaste paste?<CR> | |
set pastetoggle=<F2> | |
set showmode | |
"Toggle Highlights http://stackoverflow.com/questions/657447/vim-clear-last-search-highlighting | |
nnoremap <F3> :set hlsearch!<CR> | |
"Toggle text wrap | |
nnoremap <F4> :set wrap!<CR> | |
"Select open file in nerdtree | |
map <Leader>f :NERDTreeFind<CR> | |
"NERDTree toggle | |
map <c-U> :FZF<CR> | |
" Start NERDTree when Vim starts with a directory argument. | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') | | |
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif | |
" Open nerd tree on the right side | |
let g:NERDTreeWinPos = "right" | |
" Set specific linters | |
let g:ale_linters = { 'javascript': ['eslint'], 'ruby': ['rubocop'],} | |
" Only run linters named in ale_linters settings. | |
let g:ale_linters_explicit = 1 | |
let g:airline#extensions#ale#enabled = 1 | |
let g:ale_sign_column_always = 1 | |
let g:ale_set_highlights = 0 | |
" Vim-rspec mappigns | |
map <Leader>t :call RunCurrentSpecFile()<CR> | |
map <Leader>s :call RunNearestSpec()<CR> | |
map <Leader>l :call RunLastSpec()<CR> | |
map <Leader>a :call RunAllSpecs()<CR> | |
let g:rspec_runner = "os_x_iterm2" | |
let g:rspec_command = "!bundle exec rspec {spec}" | |
execute pathogen#infect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment