forked from karthikv/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
188 lines (161 loc) · 5.44 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
call plug#begin()
"languages
Plug 'pangloss/vim-javascript'
" Plug 'leafgarland/typescript-vim'
"scheme specific (remove after tycs)
" Plug 'taithethai/vim-scheme', { 'for': 'scheme', 'on': 'SchemeConnect' }
Plug 'guns/vim-sexp'
Plug 'tpope/vim-sexp-mappings-for-regular-people'
Plug 'luochen1990/rainbow'
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle<Paste>
"config/templating/extensions
" Plug 'Quramy/tsuquyomi' "typescript IDE /TSS
Plug 'alvan/vim-closetag'
Plug 'elzr/vim-json'
Plug 'mxw/vim-jsx'
Plug 'hashivim/vim-terraform'
Plug 'digitaltoad/vim-pug'
Plug 'tpope/vim-markdown'
Plug 'wavded/vim-stylus'
Plug 'slim-template/vim-slim'
" Plug 'neoclide/coc.nvim', {'branch': 'release'} /TSS
"misc
"jceb/vim-orgmode
Plug 'morhetz/gruvbox' "colorscheme
Plug 'w0rp/ale' "linting
Plug 'tomtom/tcomment_vim' "commenting blocks
Plug 'tpope/vim-surround' "change surrounding
Plug 'vim-airline/vim-airline' "status bar
Plug 'karthikv/tradeship-vim' "auto imports
Plug '/usr/local/opt/fzf' "fuzzy finder
Plug 'scrooloose/nerdtree' "filenav
Plug 'airblade/vim-gitgutter'
Plug 'Xuyuanp/nerdtree-git-plugin' "git for NERDtree
Plug 'wesQ3/vim-windowswap' "keybind is sww at first buffer, and sww to swap buffer
Plug 'ap/vim-css-color' "color preview
Plug 'mbbill/undotree' "undo tree :UndotreeToggle
Plug 'janko-m/vim-test' "test inside vim
" Plug 'Shougo/vimproc.vim', {'do' : 'make'} "vimproc dependency of tsuquyomi /TSS
Plug 'chrisbra/NrrwRgn' "<leader>nr for narrow highlighted content
Plug 'jremmen/vim-ripgrep' " :Rg for ripgrep in vim
" Plug 'vim-scripts/delimitMate.vim' "delimiter /TSS or delimiter
call plug#end()
"enable filetypes (already done by vim-plug, but in case that changes)
filetype plugin indent on
syntax enable
set nocompatible "no compatibility with vi
set omnifunc=syntaxcomplete#Complete "omni search
set ruler "display current cursor position in lower right corner
set hidden "switch between buffers without saving
set showcmd "show command on bottom right
set number "line numbers
set laststatus=2 "always show the status line
set incsearch "incremental searching
set nofoldenable "disable code folding
set mousehide "hide mouse when typing
set splitbelow "split windows below the current window
set showmode "show current mode
set completeopt=longest,menuone "code completion
set wildmenu "more useful command-line completion
set wildmode=list:longest "auto-completion menu
set mouse= "mouse selection shouldn't change vim mode; allows cmd + C to work
set rtp+=~/.fzf "for fzf file searching
"tabs default to two spaces
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
"smart indenting
" set smartindent
" set autoindent
"better line wrapping
set wrap
set textwidth=90
set formatoptions=qrn1
"case insensitive search
set ignorecase
set smartcase
"file types
au BufNewFile,BufRead *.less set filetype=less
au BufNewFile,BufRead *.epy set filetype=htmldjango
au BufNewFile,BufRead *.json set filetype=json
"gruvbox theme
set background=dark
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
set termguicolors
colorscheme gruvbox
"highlighting
highlight LineNr ctermfg=black
highlight Pmenu ctermbg=grey ctermfg=black
highlight PmenuSel ctermbg=red ctermfg=white
highlight Comment cterm=italic gui=italic
"completion
imap <C-j> <C-n>
imap <C-k> <C-p>
"easier window navigation
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
"helpful shortcuts
let mapleader='s'
nmap <Leader>l :vsplit<CR><C-l>
nmap <Leader>j :split<CR>
nmap <Leader>r :redraw!<CR>
nmap <Leader>s :set spell! spell?<CR>
nmap <Leader>h :set hls! hls?<CR>
nmap <Leader>2 :set ts=2 sts=2 sw=2 et<CR>
nmap <Leader>4 :set ts=4 sts=4 sw=4 et<CR>
"nmap <Leader>p :set invpaste paste?<CR>
nmap <Leader>v :source ~/.vimrc<CR>
nmap <C-p> :FZF<CR>
nmap <Leader>t :TestFile<CR>
nmap <Leader>h :UndoTreeToggle<CR>
"line movement
nmap <M-j> :m+<CR>==
nmap <M-k> :m-2<CR>==
imap <M-j> <Esc>:m+<CR>==gi
imap <M-k> <Esc>:m-2<CR>==gi
vmap <M-j> :m'>+<CR>gv=gv
vmap <M-k> :m-2<CR>gv=gv
"spelling corrections
iab teh the
iab Teh The
let g:javascript_plugin_flow = 1 "vim-javascript: enable flow highlighting
let g:jsx_ext_required = 0 "vim-jsx: make .jsx extension not requried
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'typescript': ['eslint'],
\}
" \ 'typescript': ['tsserver'],
let g:ale_fixers = {
\ 'javascript': ['eslint'],
\ 'typescript': ['eslint'],
\}
let g:ale_fix_on_save = 1
"tradeship: import on shortcut
nnoremap <C-A-i> :Tradeship<CR>
"automatically add end braces
let delimitMate_matchpairs = "(:),[:],{:},<:>"
let delimitMate_jump_expansion = 1
let delimitMate_expand_cr = 1
"NERDTree
autocmd vimenter * NERDTree
"close vim if NERDTree is the only window left open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"always show hidden files
let g:NERDTreeShowHidden=1
":Ntl runs :NERDTree ~/Lambdaschool/
" :command! Ntl NERDTree ~/Lambdaschool
"vim-test
let g:test#javascript#mocha#file_pattern = '.*\.spec\.js' "spec file recognition
let g:test#strategy = 'neovim' "use :terminal for testing
let g:test#javascript#mocha#options = '--require esm' "require esm for javascript testing
"tsuquyomi bindings
nmap <Leader>d :TsuquyomiSplitDefinition<CR>
let g:tsuquyomi_completion_detail = 1 "typescript extra completion details
let g:tsuquyomi_javascript_support = 1
let g:tsuquyomi_use_local_typescript = 0
let g:tsuquyomi_use_dev_node_module = 0
"Map escape to exit terminal mode
tnoremap <Esc> <C-\><C-n>