Skip to content

Instantly share code, notes, and snippets.

@nesvand
Last active June 8, 2018 01:17
Show Gist options
  • Save nesvand/b00dd206c9447b895f840258cde11af4 to your computer and use it in GitHub Desktop.
Save nesvand/b00dd206c9447b895f840258cde11af4 to your computer and use it in GitHub Desktop.
Dotfiles
unsetopt BG_NICE
source ~/antigen.zsh
antigen use oh-my-zsh
antigen bundles <<EOBUNDLES
git
zsh-users/zsh-syntax-highlighting
zsh-users/zsh-autosuggestions
zsh-users/zsh-completions
mafredri/zsh-async
sindresorhus/pure
EOBUNDLES
antigen apply
neovim
serve
tern
typescript
prettier
" Nesvand NVIM config
" Import plugins {{{
call plug#begin('~/.local/share/nvim/plugged')
Plug 'ervandew/supertab'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'leafgarland/typescript-vim'
Plug 'mhartington/nvim-typescript', { 'do': './install.sh' }
Plug 'ternjs/tern_for_vim', { 'do': 'npm i --no-package-lock', 'for': ['javascript', 'javascript.jsx'] }
Plug 'othree/jspc.vim', { 'for': ['javascript', 'javascript.jsx'] }
Plug 'itchyny/lightline.vim'
Plug 'khalidchawtany/lightline-material.vim'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'carlitux/deoplete-ternjs', { 'for': ['javascript', 'javascript.jsx'] }
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-commentary'
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/nerdcommenter'
Plug 'terryma/vim-multiple-cursors'
Plug 'editorconfig/editorconfig-vim'
Plug 'godlygeek/tabular'
Plug 'myusuf3/numbers.vim'
Plug 'jdkanani/vim-material-theme'
Plug 'mileszs/ack.vim'
Plug 'junegunn/vim-easy-align'
call plug#end()
" }}}
" Plugin Config {{{
" Tabularize {{{
if exists(":Tabularize")
vnoremap <expr> <Leader>a" ":Tabularize /^\\s*\\S.*\zs\"<CR>"
nnoremap <expr> <Leader>a" ":Tabularize /^\\s*\\S.*\zs\"<CR>"
endif
" }}}
" numbers.vim {{{
let g:numbers_exclude = ['unite', 'tagbar', 'startify', 'gundo', 'vimshell', 'w3m', 'nerdtree']
" }}}
" Deoplete {{{
let g:deoplete#enable_at_startup = 1
let g:deoplete#omni#functions = {}
let g:deoplete#omni#functions.javascript = [
\ 'tern#Complete',
\ 'jspc#omni'
\]
set completeopt=longest,menuone,preview
let g:deoplete#sources = {}
let g:deoplete#sources['javascript.jsx'] = ['file', 'ultisnips', 'ternjs']
" }}}
" Tern {{{
let g:tern#command = ['tern']
let g:tern#arguments = ['--persistent']
" }}}
" SuperTab {{{
if exists('g:SuperTabDefaultCompletionType')
autocmd FileType javascript let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
let g:UltiSnipsExpandTrigger="<C-j>"
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
endif
" }}}
" Typescript-vim {{{
let g:typescript_indent_disable = 1
" }}}
" Lightline {{{
let g:lightline = {}
let g:lightline.colorscheme = 'material'
" }}}
" NERDTree {{{
if exists(':NERDTreeToggle')
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " Close NVIM if NERDTree is the only window left open
" Toggle NERD Tree open
map <C-o> :NERDTreeToggle<CR>
endif
" }}}
" ack.vim {{{
if executable('ag')
let g:ackprg = 'ag --vimgrep'
nnoremap <leader>a :Ack!<space>
endif
" }}}
" FZF {{{
if exists(':Files')
map ; :Files<CR>
endif
" }}}
" }}}
" Colours {{{
syntax enable " enable syntax
set termguicolors " Set true colour
set background=dark
colorscheme material-theme
" }}}
" UI {{{
set number " show line numbers
set lazyredraw " Don't update screen during macro and script execution
set showcmd " show command in bottom bar (not shown when using powerline)
set cursorline " show highlight for line under cursor
set wildmenu " visual autocomplete for the command menu
set showmatch " highlight matching [{()}]
set complete-=i " see :help 'complete' - turns off scanning 'included files'
" }}}
" Searching {{{
set incsearch " search as characters are entered
set hlsearch " highlight matches
" }}}
" Folding {{{
set foldenable " enable folding
set foldlevelstart=1 " open most folds by default
set foldnestmax=10 " 10 nested fold max
set foldmethod=indent " fold based on indent level
" }}}
" Leader {{{
let mapleader = "\<Space>" " use space as leader
" }}}
" General settings {{{
set list " Show whitespace chars
set listchars=tab:│\ ,eol:↲,nbsp:␣,trail:•,extends:⟩,precedes:⟨ ",tab:\ \         " defines how to show whitespace chars<Paste>
" }}}
" Key mappings {{{
" Don't be stupid and learn the movements
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" Turn off highlighted search results
nnoremap <leader><space> :nohlsearch<CR>
" Open/Close folds
nnoremap \ za
" move vertically by visual line
nnoremap j gj
nnoremap k gk
" move to beginning of/end of line
nnoremap B ^
nnoremap E $
nnoremap $ <NOP>
nnoremap ^ <NOP>
" }}}
" vim:foldmethod=marker:foldlevel=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment