Skip to content

Instantly share code, notes, and snippets.



Last active Jun 26, 2020
What would you like to do?
my .vimrc
syntax on
filetype plugin indent on
" expand tab 2 spaces
set expandtab
set tabstop=2
set softtabstop=2
" indenting with >
set shiftwidth=2
autocmd FileType c,cpp setlocal equalprg=clang-format
" map return key in insert mode to produce ctrl+y in (autocomplete) popup menu
inoremap <expr> <CR> pumvisible() ? "\<C-Y>" : "\<CR>"
" tab completion - tab on line beginning, else autocomplete
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
return "\<c-p>"
inoremap <expr> <tab> InsertTabWrapper()
inoremap <s-tab> <c-n>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment