Created
June 18, 2019 02:35
-
-
Save deopard/2f0bb9dc92e5973b81f58377a2c56ec6 to your computer and use it in GitHub Desktop.
my_configs.vim
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 tabstop=2 | |
set shiftwidth=2 | |
set number | |
set cursorline | |
set relativenumber | |
set foldmethod=manual | |
set termguicolors | |
set splitbelow | |
set splitright | |
set clipboard=unnamed " use OS clipboard | |
color dracula | |
" vim-ruby | |
set nocompatible " We're running Vim, not Vi! | |
syntax on " Enable syntax highlighting | |
filetype on " Enable filetype detection | |
filetype indent on " Enable filetype-specific indenting | |
filetype plugin on " Enable filetype-specific plugins | |
"youcompleteme | |
let g:ycm_key_list_select_completion = ['<Down>', '<C-j>'] | |
let g:ycm_key_list_previous_completion = ['<Up>', '<C-k>'] | |
" Auto trim whitespace on save | |
autocmd FileType c,cpp,java,php,ruby,html autocmd BufWritePre <buffer> %s/\s\+$//e | |
" ctrl P | |
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' | |
let g:ctrlp_custom_ignore = { | |
\ 'dir': '\v[\/]\.(git|hg|svn)\|log$', | |
\ 'file': '\v\.(exe|so|dll)$', | |
\ 'link': 'some_bad_symbolic_links', | |
\ } | |
" vim ruby | |
if !exists( "*RubyEndToken" ) | |
function RubyEndToken() | |
let current_line = getline( '.' ) | |
let braces_at_end = '{\s*\(|\(,\|\s\|\w\)*|\s*\)\?$' | |
let stuff_without_do = '^\s*\(class\|if\|unless\|begin\|case\|for\|module\|while\|until\|def\)' | |
let with_do = 'do\s*\(|\(,\|\s\|\w\)*|\s*\)\?$' | |
if match(current_line, braces_at_end) >= 0 | |
return "\<CR>}\<C-O>O" | |
elseif match(current_line, stuff_without_do) >= 0 | |
return "\<CR>end\<C-O>O" | |
elseif match(current_line, with_do) >= 0 | |
return "\<CR>end\<C-O>O" | |
else | |
return "\<CR>" | |
endif | |
endfunction | |
endif | |
imap <buffer> <CR> <C-R>=RubyEndToken()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment