Skip to content

Instantly share code, notes, and snippets.

@unknowntpo
Last active July 12, 2022 20:30
Show Gist options
  • Save unknowntpo/ae8a94ebf06cccc8330198c5f91e59cc to your computer and use it in GitHub Desktop.
Save unknowntpo/ae8a94ebf06cccc8330198c5f91e59cc to your computer and use it in GitHub Desktop.
"" syntax on
set number
" set the indent consistant to 4
set tabstop=8
set softtabstop=0 expandtab shiftwidth=4 smarttab
set laststatus=2
set clipboard+=unnamed
set hlsearch
" Folding
" Ref: https://unix.stackexchange.com/a/141104
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=2
" remap esc to jk
inoremap jk <Esc>
" Autocomplete bracket and parenthesis
inoremap ( ()<Esc>i
inoremap { {}<Esc>i
" Set ruler in statusbar
set ruler
" config Vundle plugin manager.
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" python formatter
" Ref: https://note.qidong.name/2019/01/yapf-and-isort/
" https://github.com/vim-autoformat/vim-autoformat
"Plugin 'Chiel92/vim-autoformat'
"let g:formatter_yapf_style = 'pep8'
"Plugin 'fisadev/vim-isort'
"au BufWrite * :Autoformat
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
" Color scheme"
" jay"
Plugin 'josuegaleas/jay'
syntax enable
set background=dark
colorscheme solarized
""""""""""""""""
" Plugin 'vim-gofmt'
"Plugin 'darrikonn/vim-gofmt'
" Plugin 'fatih/vim-go'
Plugin 'fatih/vim-go'
" https://github.com/rust-lang/rust.vim
Plugin 'rust-lang/rust.vim'
" auto format when we save a buffer.
let g:rustfmt_autosave = 1
" JS BEAUTIFIER
" Ref: https://coderwall.com/p/m2kp5q/invoke-js-beautify-in-vim
nnoremap <leader>ff :%!js-beautify -j -q -B -f -<CR>
" clang-format while saving change.
" Ref: https://vi.stackexchange.com/a/22985
function FormatBuffer()
if &modified && !empty(findfile('.clang-format', expand('%:p:h') . ';'))
let cursor_pos = getpos('.')
:%!clang-format
call setpos('.', cursor_pos)
endif
endfunction
autocmd BufWritePre *.h,*.hpp,*.c,*.cpp,*.vert,*.frag :call FormatBuffer()
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line remap esc tonoremap
" make backspace work again
" Ref: https://vi.stackexchange.com/questions/2162/why-doesnt-the-backspace-key-work-in-insert-mode
"set backspace=indent,eol,start
"syntax on
set number
" set the indent consistant to 4
set tabstop=8
set softtabstop=0 expandtab shiftwidth=4 smarttab
set laststatus=2
set clipboard+=unnamed
set hlsearch
" Folding
" Ref: https://unix.stackexchange.com/a/141104
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=2
" remap esc to jk
inoremap jk <Esc>
" Autocomplete bracket and parenthesis
inoremap ( ()<Esc>i
inoremap { {}<Esc>i
" Set ruler in statusbar
set ruler
" config Vundle plugin manager.
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" python formatter
" Ref: https://note.qidong.name/2019/01/yapf-and-isort/
" https://github.com/vim-autoformat/vim-autoformat
"Plugin 'Chiel92/vim-autoformat'
"let g:formatter_yapf_style = 'pep8'
"Plugin 'fisadev/vim-isort'
"au BufWrite * :Autoformat
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
" Color scheme"
" jay"
Plugin 'josuegaleas/jay'
syntax enable
set background=dark
colorscheme solarized
""""""""""""""""
" Plugin 'vim-gofmt'
"Plugin 'darrikonn/vim-gofmt'
" Plugin 'fatih/vim-go'
Plugin 'fatih/vim-go'
" Plugin yaml formatter
"https://github.com/tarekbecker/vim-yaml-formatter
Plugin 'tarekbecker/vim-yaml-formatter'
" https://github.com/rust-lang/rust.vim
Plugin 'rust-lang/rust.vim'
" auto format when we save a buffer.
let g:rustfmt_autosave = 1
Plugin 'easymotion/vim-easymotion'
nnoremap <Leader> <Plug>(easymotion-prefix)
" JS BEAUTIFIER
" Ref: https://coderwall.com/p/m2kp5q/invoke-js-beautify-in-vim
nnoremap <leader>ff :%!js-beautify -j -q -B -f -<CR>
" clang-format while saving change.
" Ref: https://vi.stackexchange.com/a/22985
function FormatBuffer()
if &modified && !empty(findfile('.clang-format', expand('%:p:h') . ';'))
let cursor_pos = getpos('.')
:%!clang-format
call setpos('.', cursor_pos)
endif
endfunction
autocmd BufWritePre *.h,*.hpp,*.c,*.cpp,*.vert,*.frag :call FormatBuffer()
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment