Skip to content

Instantly share code, notes, and snippets.

@timgluz
Created April 8, 2020 09:38
Show Gist options
  • Save timgluz/36663fa130c39a1f0157e25e5aaf4d5a to your computer and use it in GitHub Desktop.
Save timgluz/36663fa130c39a1f0157e25e5aaf4d5a to your computer and use it in GitHub Desktop.
basic VIM config for Ruby, Rust
colorscheme default
set runtimepath^=~/.vim/bundle/ctrlp.vim
set rtp+=/usr/local/opt/fzf
"VIM user interface
syntax on
filetype plugin indent on
autocmd BufNewFile,BufReadPost *.cljx setfiletype clojure
autocmd BufNewFile,BufReadPost *.cljs setfiletype clojure
autocmd BufWritePre * :%s/\s\+$//e
au BufNewFile,BufRead *.bnf set filetype=bnf
au BufNewFile,BufRead *.ebnf set filetype=ebnf
set ruler "a;ways show current position
set hid "hide abandoned buffer
set modelines=0
set autoindent
"set smartindent
set expandtab ts=2 sw=2 ai
set smarttab
set bs=2
set relativenumber
set showmatch
set hlsearch "hilights search results
set incsearch
set magic "for regular expressions
set noerrorbells
set novisualbell
set wildmenu
" COLORs and Fonts
"syntax enable
set encoding=utf8
"Files, backups and undo
set nobackup
set nowb
set noswapfile
set autoread
" set numbering
:au FocusLost * :set number
:au FocusGained * :set relativenumber
let g:Powerline_symbols = 'fancy'
" Keyboard mappings
"for ctrlp
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra' " specify searching order r = nearest ancestor
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/classes/*,*.class,*/node_modules/*,*/bower_components/*,*/public/system/*,*/fixtures/* " MacOSX/Linux&Java
"set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn|target)$'
let g:ackprg = 'ag --nogroup --column'
set runtimepath^=~/.vim/bundle/ag
if executable('rg')
set grepprg=rg\ --color=never
let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
let g:ctrlp_use_caching = 0
endif
" This is the default extra key bindings
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
" Default fzf layout
" - down / up / left / right
let g:fzf_layout = { 'up': '~30%' }
" In Neovim, you can set up fzf window using a Vim command
let g:fzf_layout = { 'window': 'enew' }
let g:fzf_layout = { 'window': '-tabnew' }
let g:fzf_layout = { 'window': '10split enew' }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" Enable per-command history.
" CTRL-N and CTRL-P will be automatically bound to next-history and
" previous-history instead of down and up. If you don't like the change,
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
let g:fzf_history_dir = '~/.local/share/fzf-history'
" RUST related confs
let g:rustfmt_autosave = 1
set hidden
let g:racer_cmd = "/home/timosulg/.cargo/bin/racer"
let g:racer_experimental_completer = 1
au FileType rust nmap gd <Plug>(rust-def)
au FileType rust nmap gs <Plug>(rust-def-split)
au FileType rust nmap gx <Plug>(rust-def-vertical)
au FileType rust nmap <leader>gd <Plug>(rust-doc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment