Skip to content

Instantly share code, notes, and snippets.

@yatish27
Created June 2, 2017 06:10
Show Gist options
  • Save yatish27/11f56fa27470a2f02c85c6c4fee54293 to your computer and use it in GitHub Desktop.
Save yatish27/11f56fa27470a2f02c85c6c4fee54293 to your computer and use it in GitHub Desktop.
" +++ Plugins
call plug#begin()
Plug 'tpope/vim-markdown'
" General display
Plug 'scrooloose/nerdtree'
" Git
Plug 'tpope/vim-fugitive'
Plug 'JamshedVesuna/vim-markdown-preview'
" Fuzzy finder
Plug 'ctrlpvim/ctrlp.vim'
" syntax checker
Plug 'vim-syntastic/syntastic'
" Better status bar
Plug 'vim-airline/vim-airline'
" Reload the file if it is changed externally
Plug 'djoshea/vim-autoread'
" AutoSave the file
Plug '907th/vim-auto-save'
Plug 'pangloss/vim-javascript'
" Plug 'millermedeiros/vim-esformatter'
Plug 'rking/ag.vim'
Plug 'majutsushi/tagbar'
Plug 'airblade/vim-gitgutter'
Plug 'shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" javascript Autocomplete
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' }
Plug 'fatih/vim-go'
call plug#end()
set nocompatible
" Basic commands
set backspace=2 " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
set visualbell
syntax on
filetype indent on
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab
set encoding=utf-8
set autoread
set noerrorbells
" It autosaves the buffers
let g:auto_save = 1
"++ Keymaps ++"
map! jj <esc>
"+++ git +++
map <leader>gst :Gstatus<cr>
map <leader>ga :Git add -A .<cr>
map <leader>gp :Gpush<cr>
map <leader>gca :Gcommit -a -v<cr>
let vim_markdown_preview_github=1
let vim_markdown_preview_browser='Google Chrome'
let vim_markdown_preview_hotkey='<C-M>'
source $HOME/.config/nvim/colors/vividchalk.vim
"+++ Display Settings +++
set t_Co=256
colorscheme vividchalk
set listchars=tab:\.\ ,trail:·
set list
set number
set showcmd
set showmode
set splitright
set splitbelow
set showmatch
set incsearch
set hlsearch
set ignorecase
set smartcase
set wildmenu
set lazyredraw " redraw only when we need to.
"+++ Lines & Columns +++
" It highlights the line of the cursor
set cursorline
set softtabstop=2
set autoindent
set smartindent
"+++ CtrlP +++
let g:ctrlp_max_height = 10
let g:ctrlp_mruf_max = 500
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
let g:ctrlp_cmd = 'CtrlP'
map <c-b> :CtrlPBuffer <cr>
map <c-d> :CtrlPBufTag <cr>
let g:ctrlp_by_filename = 1
" let g:ctrlp_by_filename = 0
" let g:ctrlp_match_window = 'top,order:ttb'
let g:ctrlp_switch_buffer = 'et'
let g:ctrlp_max_depth = 40
let g:ctrlp_working_path_mode = 'r'
let g:ctrlp_user_command = 'ag -Q -l --nocolor --hidden -g "" %s'
let g:ctrlp_use_caching = 0
let g:ctrlp_open_new_file = 'et'
map <leader>p :ClearCtrlPCache<cr>:CtrlP<enter>
let g:deoplete#enable_at_startup = 1
let g:deoplete#ignore_sources = {}
let g:deoplete#ignore_sources._ = ['member', 'tag']
let g:deoplete#max_list = 30
let g:deoplete#sources#go#align_class = 1
let g:deoplete#sources#go#sort_class = ['package', 'func', 'var', 'type', 'const']
call deoplete#custom#set('_', 'converters', ['converter_remove_overlap'])
"call deoplete#custom#set('go,neosnippet', 'disabled_syntaxes', ['Comment', 'String'])
" use <tab> to select the autocomplete options
inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
autocmd CompleteDone * pclose!
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag -Q -l --nocolor --hidden -g "" %s'
"
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
" "
if !exists(":Ag")
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
nnoremap \ :Ag<SPACE>
endif
endif
set modifiable
nnoremap K :grep! "\b<C-R><C-W>\b"<CR> :cw <CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment