Skip to content

Instantly share code, notes, and snippets.

@rashedInt32
Last active October 29, 2016 13:34
Show Gist options
  • Save rashedInt32/ddaa811676794a0cd50fb2322f7946d5 to your computer and use it in GitHub Desktop.
Save rashedInt32/ddaa811676794a0cd50fb2322f7946d5 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
so ~/.vim/plugins.vim
let $PATH = '/usr/local/bin:'.$PATH
" Configure backspace so it acts as it should act
"Accidentally pressing Shift K will no longer open stupid man entry
noremap K <nop>
noremap <D-s> <nop>
" Wtf is Ex Mode anyways? lets check
nnoremap Q <nop>
set backspace=indent,eol,start
" Prevent cursor from moving to beginning of line when switching buffers
set nostartofline
"set auto folding code disbable
:setlocal foldmethod=manual
set foldmethod=indent
set nofoldenable
set foldlevel=99
" Set to auto read when a file is changed from the outside
set autoread
"set autowrite all
set autowriteall
" Set coplete methon
set complete=.,w,b,u
" leader key set to comma ,
let mapleader=","
let g:mapleader=","
"change esc key to double semicolon
:imap jj <Esc>
" Efficient saving
nmap <leader>w :w!<cr>
"toggle fonding
nnoremap <space> za
"Always show current position
set ruler
"no beep
set visualbell
set noerrorbells
" Height of the command bar
set cmdheight=1
" A buffer becomes hidden when it is abandoned
set hid
" move to beginning/end of line
map B ^
map E $
" Treat long lines as break lines (useful when moving around in them)
map j gj
map k gk
set wrap
set linebreak
if exists('+colorcolumn')
" Highlight up to 255 columns (this is the current Vim max) beyond 'textwidth'
let &l:colorcolumn='+' . join(range(0, 254), ',+')
endif
" highlight last inserted text
nnoremap gV `[v`]
" open ag.vim
nnoremap <leader>a :Ag
" toggle gundo
nnoremap <leader>z :GundoToggle<CR>
"remove right scrollbar
set guioptions-=r
" Command Left/h & Right/l cycle between buffers
map <D-j> gT
map <D-k> gt
" map for jampint window
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" ================ Turn Off Swap Files ==============
set noswapfile
set nobackup
set nowb
" Auto indent pasted text
nnoremap p p=`]<C-o>
nnoremap P P=`]<C-o>
" Real time search and replace with preview
nnoremap <C-s> :OverCommandLine<CR>%s/
" vim mark multiple edit like sublime
let g:mark_multiple_trigger = "<C-n>"
let g:buftabs_only_basename=1
"font and line height
set linespace=4
set guifont=operator\ mono\ light:h15
"set guifont=Monoid\ Retina:h12
"set indentation
set autoindent
set cindent
set smarttab autoindent
set nonumber
set ts=2
set expandtab
" when using the >> or << commands, shift lines by 4 spaces
set shiftwidth=2
set cursorline
set showmatch
let python_highlight_all = 1
set ts=2 sw=2 expandtab
set list " show whitespace
set listchars=nbsp:⦸ " CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
set listchars+=tab:▷┅ " WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7)
" + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL (U+2505, UTF-8: E2 94 85)
set listchars+=extends:» " RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
set listchars+=precedes:« " LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB)
set listchars+=trail:• " BULLET (U+2022, UTF-8: E2 80 A2)
set nojoinspaces " don't autoinsert two spaces after '.', '?', '!' for join command
set noshowmatch " don't jump between matching brackets
highlight NonText ctermfg=8 guifg=gray
"auto closing tag configure
let delimitMate_expand_cr=2
" set paste mode
set pastetoggle=<F2>
"color shceme configuration
syntax enable
set t_Co=256
if (has("termguicolors"))
set termguicolors
endif
colorscheme deep-space
"set background=dark
"colorscheme quantum
"colorscheme OceanicNext
highlight LineNr guibg=bg
hi vertsplit guifg=bg guibg=bg
set foldcolumn=2
hi foldcolumn guibg=bg
hi CursorLineNR guibg=bg
"hi CursorColumn guibg=bg
hi CursorLine guibg=bg
highlight Comment gui=italic
highlight htmlArg gui=italic
"highlight htmlArg guifg=#26A69A
highlight htmlTag gui=italic
highlight htmlTag gui=none
"highlight javaScript guifg=#BB80B3
"highlight javaScript guifg=#9a95d7
"colorscheme solarized, sourcerer, phoenix, one-dark, hybrid_material,
"gotham256, heroku, spacegray, inori, itg_flat, railscasts, cabin, Hilal, OceanicNext
" Ultisnips requirement
let g:UltiSnipsEditSplit="vertical"
" Ultisnips Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<c-l>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
" Emmet plugin and exicution mode
let g:user_emmet_mode='a'
let g:user_emmet_leader_key=','
" Unite plugin setting
" recently edited file can be search by
nnoremap <Leader>m :Unite -buffer-name=recent -winheight=10 file_mru<cr>
" open buffer can be navigate by this
nnoremap <Leader>b :Unite -buffer-name=buffers -winheight=10 buffer<cr>
"------ Javascript Settings ------
" vim jsx setting
let g:jsx_ext_required = 0
let g:syntastic_javascript_eslint_exe = 'npm run eslint --'
let g:syntastic_javascript_checkers = ['eslint']
"Syntastic ignore error for js framework
"let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \"ng-"]
"let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \"@"]
let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \" "]
"let g:syntastic_mode_map = { 'passive_filetypes': ['js'] }
let g:syntastic_debug = 0
let g:syntastic_html_checkers=['']
" Set wildignore file for ctrl-p plugin search file
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.idea/*,*/.DS_Store,*.o,*.obj,*.bak,*.exe,*.py[co],*.swp,*~,*.pyc,.svn,*/.jpg,*/.png,*/.gif
let g:ctrlp_working_path_mode = 0
" ctrl p custom ignore folder and file
let g:ctrlp_extensions = ['buffertag', 'tag', 'line', 'dir', 'tmux'] "
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|png\|jpg\|gif\|svg'
let g:ctrlp_match_window = 'bottom,order:ttb'
let g:ctrlp_switch_buffer = 0
let g:ctrlp_by_filename = 1
let g:ctrlp_switch_buffer = 'Et'
let g:ctrlp_match_func = {'match' : 'matcher#cmatch' }
" open file new tab
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-t>'],
\ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
\ }
"let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
nnoremap <D-p> :CtrlP<CR>
"easy motion setup
let g:EasyMotion_startofline = 0 " keep cursor column when JK motion
let g:EasyMotion_do_mapping = 0 " Disable default mappings
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
nmap s <Plug>(easymotion-s)
nmap s <Plug>(easymotion-s2)
" Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
" JK motions: Line motions
map <Leader>f <Plug>(easymotion-j)
map <Leader>d <Plug>(easymotion-k)
map <Leader>l <Plug>(easymotion-lineforward)
map <Leader>h <Plug>(easymotion-linebackward)
"search word
let g:ackprg = 'ag --nogroup --nocolor --column'
set runtimepath^=~/.vim/bundle/ag
let g:ag_working_path_mode="r"
let g:grepper = {
\ 'tools': ['ag', 'git', 'grep'],
\ 'open': 0,
\ 'jump': 1,
\ }
" NERDTreeToggle
noremap <Leader>t :NERDTreeToggle<cr>
noremap <Leader>r :NERDTreeMirror<cr>
:set guioptions-=L
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.DS_Store$', '\.vim$', '\.swp$' , '\.pyc$']
if ! has("gui_running")
let g:loaded_airline = 1
endif
" vim airline
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_buffers = 0
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_theme='deep_space'
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = ' '
let g:airline_enable_branch = 1
let g:airline_enable_syntastic = 1
let g:airline#extensions#tabline#show_tab_nr = 0
let g:airline#extensions#tabline#show_tab_type = 0
let g:airline#extensions#tabline#show_close_button = 0
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#buffers_label = '@'
set laststatus=2
" neocomplete configure
"let g:neocomplete#enable_at_startup = 1
let g:cssColorVimDoNotMessMyUpdatetime = 1
" tried to work with vim and tern for vim
"set omnifunc=syntaxcomplete#Complete
"let g:tern_map_keys = 1
"let g:tern_show_argument_hints = 'on_move'
"vim destraction mode mapping
nnoremap dm :Goyo<CR>
let g:goyo_width = 100
let g:goyo_height = 90
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['black', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ]
" Rainbow parenthesis setting
let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
"indent and tab size for specific file
" Only do this part when compiled with support for autocommands
if has("autocmd")
" Enable file type detection
filetype on
" Syntax of these languages is fussy over tabs Vs spaces
autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Customisations based on house-style (arbitrary)
autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType javascript setlocal ts=2 sts=2 sw=2 noexpandtab
autocmd FileType elixir setlocal ts=2 sts=2 sw=2 noexpandtab
autocmd FileType javascript setlocal omnifunc=tern#Complete
autocmd FileType ruby setlocal expandtab shiftwidth=2 tabstop=2
endif
"Remove trailing and striping space from file
function! Preserve(command)
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
"for removing trailing space
nmap _$ :call Preserve("%s/\\s\\+$//e")<CR>
nmap _= :call Preserve("normal gg=G")<CR>
" move plugin settin
let g:move_key_modifier = 'C'
let g:move_map_keys = 0
nmap <C-i> <Plug>MoveLineUp
nmap <C-m> <Plug>MoveLineDown
vmap <C-i> <Plug>MoveBlockUp
vmap <C-m> <Plug>MoveBlockDown
" next indentation setup
nnoremap [ :IndentationGoUp<CR>
nnoremap ] :IndentationGoDown<CR>
" Matching word highlighting
nnoremap <silent> <leader>k :call InterestingWords('n')<cr>
nnoremap <silent> <leader>K :call UncolorAllWords()<cr>
nnoremap <silent> n :call WordNavigation('forward')<cr>
nnoremap <silent> N :call WordNavigation('backward')<cr>
" Easily get the current line git link
"command GitLink :echo gitlink#GitLink()
highlight Cursor guifg=#f9f9f9 guibg=#F57C00
" Change cursor shape between insert and normal mode in iTerm2.app
if $TERM_PROGRAM =~ "iTerm"
let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode
let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode
endif
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
" Quickly open/reload vim
nnoremap <leader>ev :vsplit $MYVIMRC<CR>
nnoremap <silent> <leader>es :source $MYVIMRC<CR>
set rtp+=~/.fzf
" How should we execute the search?
" --heading and --stats are required!
let g:side_search_prg = 'ag --word-regexp'
\. " --ignore='*.js.map'"
\. " --heading --stats -B 1 -A 4"
" Can use `vnew` or `new`
let g:side_search_splitter = 'vnew'
" I like 40% splits, change it if you don't
let g:side_search_split_pct = 0.4
" SideSearch current word and return to original window
nnoremap <Leader>ss :SideSearch <C-r><C-w><CR> | wincmd p
" Create an shorter `SS` command
command! -complete=file -nargs=+ SS execute 'SideSearch <args>'
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" elm setup for vim
let g:polyglot_disabled = ['elm']
let g:elm_detailed_complete = 1
let g:elm_format_autosave = 1
let g:elm_syntastic_show_warnings = 1
let g:elm_setup_keybindings = 0
" syntastic setup for elm
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
autocmd BufWrite *.elm setlocal filetype=elm
autocmd BufWritePost *.elm silent execute '!elm-format --yes %' | edit! | setlocal filetype=elm | redraw!
" ycm for elm
let g:ycm_semantic_triggers = {
\ 'elm' : ['.'],
\}
" some haskell setup
"let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
"let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
"let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
"let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
"let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
"let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
"
"let g:haskell_indent_if = 3
"let g:haskell_indent_case = 2
"let g:haskell_indent_let = 4
"let g:haskell_indent_where = 6
"let g:haskell_indent_do = 3
"let g:haskell_indent_in = 1
"let g:haskell_indent_guard = 2
"let g:cabal_indent_section = 2
" Make it so the ugly NonText" characters are hidden at the end of a file
" (the ~)
:hi NonText guifg=bg
"autocmd ColorScheme * highlight NonText ctermfg=bg guifg=bg
"
"
"
"
" Use deoplete.
let g:deoplete#enable_at_startup = 1
" Use deoplete.
let g:tern_request_timeout = 1
let g:tern_show_signature_in_pum = '0' " This do disable full signature type on autocomplete
" Use tern_for_vim.
let g:tern#command = ["tern"]
let g:tern#arguments = ["--persistent"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment