Skip to content

Instantly share code, notes, and snippets.

@evanhutomo
Last active October 7, 2022 12:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanhutomo/6ee59f57ece55fc67b4dd88eadffe0a9 to your computer and use it in GitHub Desktop.
Save evanhutomo/6ee59f57ece55fc67b4dd88eadffe0a9 to your computer and use it in GitHub Desktop.
" Set compatibility to Vim only.
set nocompatible
" Helps force plug-ins to load correctly when it is turned back on below.
filetype off
" Turn on syntax highlighting.
syntax on
syntax enable
" For plug-ins to load correctly.
filetype plugin indent on
" Turn off modelines
set modelines=0
set directory^=$HOME/.vim/tmp//
" Automatically wrap text that extends beyond the screen length.
set wrap
" Vim's auto indentation feature does not work properly with text copied from outside of Vim.
" Press the <F2> key to toggle paste mode on/off.
nnoremap <F2> :set invpaste paste?<CR>
imap <F2> <C-O>:set invpaste paste?<CR>
set pastetoggle=<F2>
" Uncomment below to set the max textwidth. Use a value corresponding to the width of your screen.
" set textwidth=79
set formatoptions=tcqrn1
set tabstop=4
set shiftwidth=4
set softtabstop=4
set noexpandtab
set noshiftround
set colorcolumn=110
highlight ColorColumn ctermbg=darkgray
" Display 5 lines above/below the cursor when scrolling with a mouse.
set scrolloff=5
" Fixes common backspaace problems
set backspace=indent,eol,start
" Speed up scrolling in Vim
set ttyfast
" Status bar
set laststatus=2
" Display options
set showmode
set showcmd
" Highlight matching pairs of brackets. Use the '%' character to jump between them.
set matchpairs+=<:>
" Display different types of white spaces.
set list
set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:·
" Show line numbers
set number
" Set status line display
" set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ [BUFFER=%n]\ %{strftime('%c')}
" Encoding
set encoding=utf-8
" Highlight matching search patterns
set hlsearch
" Enable incremental search
set incsearch
" Include matching uppercase words with lowercase search term
set ignorecase
" Include only uppercase words with uppercase search term
set smartcase
" Store info from no more than 100 files at a time, 9999 lines of text, 100kb of data. Useful for copying large amounts of data between files.
set viminfo='100,<9999,s100
" force .vimrc in secure
set exrc
set secure
" file type detection with nice doxygen highlighting
augroup project
autocmd!
autocmd! BufRead,BufNewFile *.h,*.c set filetype=c.doxygen
augroup END
" Map the <Space> key to toggle a selected fold opened/closed.
nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR>
vnoremap <Space> zf
" Automatically save and load folds
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview"
" Call the .vimrc.plug file
if filereadable(expand("~/.vimrc.plug"))
source ~/.vimrc.plug
endif
" important to make color scheme works
set termguicolors
colorscheme sorcerer
let g:airline_theme='seagull'
" netrw configuration
" NERDTree look like
"let g:netrw_banner = 0 " remove netrw banner
"let g:netrw_liststyle = 3
"let g:netrw_browse_split = 4
"let g:netrw_altv = 1
"let g:netrw_winsize = 15
"augroup ProjectDrawer
" autocmd!
" autocmd VimEnter * :Vexplore
"augroup END
" ctags conf
"set tags+=$HOME/Documents/python-projects/npyscreen/
set tags=tags
" C/C++ Build system configuration
set makeprg=make\ -C\ ../build\ -j9
nnoremap <F4> :make!<cr>
" C/C++ Launch system configuration
"nnoremap <F5> :!./programmuapa<cr>
" Autocomplete configuration
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Vundle
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
"Plugin 'tpope/vim-fugitive'
"Plugin 'Valloric/YouCompleteMe'
call vundle#end()
" Tab autocompletes
"function! Mosh_Tab_Or_Complete()
" if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
" return "\<C-N>"
" else
" return "\<Tab>"
"endfunction
":inoremap <Tab> <C-R>=Mosh_Tab_Or_Complete()<CR>
" vim-plug
call plug#begin('~/.vim/plugged')
Plug 'preservim/nerdtree'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'puremourning/vimspector'
Plug 'maralla/completor.vim' " ctags
call plug#end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment