Skip to content

Instantly share code, notes, and snippets.

@mnuddindev
Last active November 9, 2022 13:10
Show Gist options
  • Select an option

  • Save mnuddindev/78b2e2fd86646a52b684a2ba98a8d7f8 to your computer and use it in GitHub Desktop.

Select an option

Save mnuddindev/78b2e2fd86646a52b684a2ba98a8d7f8 to your computer and use it in GitHub Desktop.
set rtp+=~/.vim/bundle/Vundle.vim
set shell=/bin/bash
call vundle#begin()
" let Vundle manage Vundle, required
"Plugin 'pangloss/vim-javascript'
"Plugin 'mxw/vim-jsx'
Plugin 'mattn/gist-vim'
Plugin 'mattn/webapi-vim'
Plugin 'luochen1990/rainbow'
"Plugin 'SirVer/ultisnips'
Plugin 'gmarik/Vundle.vim'
Plugin 'moorereason/vim-markdownfmt'
Plugin 'kristijanhusak/vim-carbon-now-sh'
Plugin 'fatih/molokai'
Plugin 'scrooloose/nerdtree'
"Plugin 'google/vim-maktaba'
"Plugin 'paulhybryant/foldcol'
"Plugin 'tomasr/molokai'
Plugin 'AndrewRadev/splitjoin.vim'
"Plugin 'fatih/vim-go'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'vim-airline/vim-airline'
"Plugin 'Raimondi/delimitMate'
"Plugin 'tpope/vim-surround'
Plugin 'mattn/emmet-vim'
Plugin 'tpope/vim-commentary'
"Plugin 'vim-syntastic/syntastic'
Plugin 'Yggdroot/indentLine'
"Plugin 'terryma/vim-multiple-cursors'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'tpope/vim-fugitive'
"Plugin 'airblade/vim-gitgutter'
"Plugin 'Shougo/deoplete.nvim'
Plugin 'roxma/nvim-yarp'
Plugin 'roxma/vim-hug-neovim-rpc'
"Plugin 'whatyouhide/vim-gotham'
Plugin 'StanAngeloff/php.vim'
Plugin 'stephpy/vim-php-cs-fixer'
Plugin 'ncm2/ncm2'
" All of your Plugins must be added before the following line
call vundle#end() " required
" Colorscheme
syntax enable
set t_Co=256
let g:rehash256 = 0
colorscheme molokai
"let g:material_theme_style = 'palenight'
let g:deoplete#enable_at_startup = 1
""""""""""""""""""""""
" Settings "
""""""""""""""""""""""
set directory^=$HOME/.vim/tmp// " swap file location
set nocompatible " Enables us Vim specific features
"set updatetime=1000 " Set update time of SameID
filetype off " Reset filetype detection first ...
filetype plugin indent on " ... and enable filetype detection
set ttyfast " Indicate fast terminal conn for faster redraw
set ttymouse=xterm2 " Indicate terminal type for mouse codes
set ttyscroll=7 " Speedup scrolling
set laststatus=2 " Show status line always
set encoding=utf-8 " Set default encoding to UTF-8
set autoread " Automatically read changed files
set autoindent " Enabile Autoindent
set backspace=indent,eol,start " Makes backspace key more powerful.
set incsearch " Shows the match while typing
set hlsearch " Highlight found searches
set noerrorbells " No beeps
set number " Show line numbers
set showcmd " Show me what I'm typing
"set noswapfile " Don't use swapfile
set nobackup " Don't" Create annoying backup files
set splitright " Vertical windows should be split to right
set splitbelow " Horizontal windows should split to bottom
set autowrite " Automatically save before :next, :make etc.
set hidden " Buffer should still exist if window is closed
set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats
set showmatch " Do not show matching brackets by flickering
set showmode " We show the mode with airline or lightline
set ignorecase " Search case insensitive...
set smartcase " ... but not it begins with upper case
set completeopt=menu,menuone " Show popup menu, even if there is one entry
set pumheight=10 " Completion window max size
set nocursorcolumn " Do not highlight column (speeds up highlighting)
set cursorline " Do not highlight cursor (speeds up highlighting)
set lazyredraw " Wait to redraw
" Enable folding
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=2
" Enable to copy to clipboard for operations like yank, delete, change and put
" http://stackoverflow.com/questions/20186975/vim-mac-how-to-copy-to-clipboard-without-pbcopy
if has('unnamedplus')
set clipboard^=unnamed
set clipboard^=unnamedplus
endif
" This enables us to undo files even if you exit Vim.
if has('persistent_undo')
set undofile
set undodir=~/.config/vim/tmp/undo//
endif
"airline
let g:airline_theme='kolor'
let g:airline#extensions#tabline#enabled = 0
let g:airline#extensions#tabline#formatter = 'default'
let g:airline_right_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_left_alt_sep= ''
let g:airline_left_sep = ''
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = '|'
" Rainbow
let g:rainbow_active = 1
""""""""""""""""""""""
" Mappings "
""""""""""""""""""""""
" Set leader shortcut to a comma ','. By default it's the backslash
let mapleader = ","
" Jump to next error with Ctrl-n and previous error with Ctrl-m. Close the
" quickfix window with <leader>a
nnoremap <leader>a :cclose<CR>
" Visual linewise up and down by default (and use gj gk to go quicker)
noremap <Up> gk
noremap <Down> gj
noremap j gj
noremap k gk
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
nnoremap n nzzzv
nnoremap N Nzzzv
" Act like D and C
nnoremap Y y$
" Enter automatically into the files directory
autocmd BufEnter * silent! lcd %:p:h
"""""""""""""""""""""
" Plugins "
"""""""""""""""""""""
" vim-go
let g:go_fmt_command = "goimports"
let g:go_autodetect_gopath = 1
let g:go_list_type = "quickfix"
"let g:go_auto_sameids = 1
"let g:go_auto_type_info = 1
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_generate_tags = 1
" Open :GoDeclsDir with ctrl-g
nmap <C-g> :GoDeclsDir<cr>
imap <C-g> <esc>:<C-u>GoDeclsDir<cr>
" sublime shortcut
nmap <C-s> :w<cr>
nmap <C-z> :undo<cr>
nmap <C-c> :copy<cr>
nmap <C-x> :delete<cr>
nmap <C-g> :!node %<cr>
vmap r "_dP
" CTRLP tag search
nnoremap <leader>. :CtrlPTag<cr>
" :sexplore
nnoremap <leader>p :tabedit ./<cr>
setlocal noexpandtab tabstop=4 shiftwidth=4
augroup go
autocmd!
autocmd BufWritePost *.go GitGutterAll
" Show by default 4 spaces for a tab
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4
" :GoBuild and :GoTestCompile
autocmd FileType go nmap <leader>b :<C-u>call <SID>build_go_files()<CR>
" :GoIfErr
autocmd FileType go nmap <leader>e :GoIfErr<CR>
" :cnext
autocmd FileType go nmap <leader>n :cnext<CR>
" :cnext
autocmd FileType go nmap <leader>m :cprevious<CR>
" :GoFmt
autocmd FileType go nmap <leader>f :GoFmt<CR>
" :GoTest
autocmd FileType go nmap <leader>t <Plug>(go-test)
" :GoRun
autocmd FileType go nmap <leader>r <Plug>(go-run)
" :GoDoc
autocmd FileType go nmap <Leader>d <Plug>(go-doc)
" :GoCoverageToggle
autocmd FileType go nmap <Leader>c <Plug>(go-coverage-toggle)
" :GoInfo
autocmd FileType go nmap <Leader>i <Plug>(go-info)
" :GoMetaLinter
autocmd FileType go nmap <Leader>l :GoLint<CR>
" :GoDef but opens in a vertical split
autocmd FileType go nmap <Leader>v <Plug>(go-def-vertical)
" :GoDef but opens in a horizontal split
autocmd FileType go nmap <Leader>s <Plug>(go-def-split)
" :GoAlternate commands :A, :AV, :AS and :AT
autocmd Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit')
autocmd Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit')
autocmd Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split')
autocmd Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe')
augroup END
" build_go_files is a custom function that builds or compiles the test file.
" It calls :GoBuild if its a Go file, or :GoTestCompile if it's a test file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
"set list lcs=tab:\|\
"let g:multi_cursor_start_key="<c-s>"
"let g:multi_cursor_select_all_key="<c-a>"
" gist
"
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1
let g:gist_show_privates = 1
let g:gist_post_private = 1
let g:gist_update_on_write = 2
"let g:gist_use_password_in_gitconfig = 1
"
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
set mouse=a
let g:user_emmet_leader_key=','
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment