-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
167 lines (142 loc) · 5.27 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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugins
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
" ===for search===
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" ===for rails===
Plug 'tpope/vim-rails'
Plug 'thoughtbot/vim-rspec'
" ===for snipmate===
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
Plug 'garbas/vim-snipmate'
" ===for markdown===
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
" ===for visual===
Plug 'scrooloose/nerdtree'
Plug 'airblade/vim-gitgutter'
Plug 'itchyny/lightline.vim'
Plug 'Rigellute/shades-of-purple.vim'
"Plug 'ryanoasis/vim-devicons'
call plug#end()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Nerdtree Config
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <C-n> :NERDTreeToggle<CR>
let NERDTreeShowHidden=1 " Show hidden files
"let NERDTreeQuitOnOpen = 1 " Closes nerdtree when open file
let NERDTreeMinimalUI = 1 " MinimalUI
let NERDTreeDirArrows = 1
let g:NERDTreeDirArrowExpandable="+"
let g:NERDTreeDirArrowCollapsible="~"
let NERDTreeIgnore = ['^node_modules$', '\.git$']
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Initial Set
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " ward off unexpected things from distro
syntax on " Enable syntax highlighting
set spell " enable spell correction
set number " Turn on line numbers
set tabstop=4 " TAB becomes X spaces
set softtabstop=2 " TAB becomes X spaces in Vim
set shiftwidth=2 " TAB
set expandtab " Set the right amount of space to be a tab on insert
set pastetoggle=<F11> " paste/nopaste
set ai " Turn on auto indentation
set si " Turn on smart indent
set ru " Turn on the ruler
set bs=2 " Turn backspace on insert mode
set sb " split below
set spr " split right
set hls " highlight words from search
set ignorecase " ignore capital case on search
set noshowmode " hide default mode text under powerline
set noshowcmd " show cmd in the status line
set wildmenu " better cmd-line completion
set ttyfast " improve redraw of windows
set ttimeoutlen=10 " keycode delays timeout
set timeoutlen=500 " Mapping delays timeout
set updatetime=100 " Time to refresh scroll- improv markdown preview
set hidden " Allow hidden buffers, don't limit to 1 file per window/split
set cursorline " show line on curso
set encoding=UTF-8 " Set encoding
set backspace=indent,eol,start " Allow bs over autoindent, line breaks & start of insert action
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git etc.
set nobackup " Dont create backup files
set nowb " No write backup
set noswapfile " No swap file
set undolevels=1000 " Keep history undo
" Files to ignore
" Python
set wildignore+=*.pyc,*.pyo,*/__pycahce__/*a
" Temp files
set wildignore+=*.swp,~*
" Archives
set wildignore+=*.zip,*.tar
" Use clipboard as default register
set clipboard=unnamed
set clipboard=unnamedplus
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Map bindings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" esc in insert mode
inoremap jj <esc>
inoremap jj <esc>
" esc in command mode
cnoremap kj <C-C>
cnoremap jk <C-C>
" CrtP use FZ
nnoremap <C-p> :Files<CR>
" move line with Alt + j/k
nnoremap <A-j> :m .+1<CR>==
nnoremap <A-k> :m .-2<CR>==
inoremap <A-j> <Esc>:m .+1<CR>==gi
inoremap <A-k> <Esc>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv=gv
vnoremap <A-k> :m '<-2<CR>gv=gv
" move line with Alt + j/k
execute "set <M-j>=\ej"
execute "set <M-k>=\ek"
nnoremap <M-j> :m .+1<CR>==
nnoremap <M-k> :m .-2<CR>==
inoremap <M-j> <Esc>:m .+1<CR>==gi
inoremap <M-k> <Esc>:m .-2<CR>==gi
vnoremap <M-j> :m '>+1<CR>gv=gv
vnoremap <M-k> :m '<-2<CR>gv=gv
" move between slipts
nnoremap <C-J> <C-W><C-J> "Ctrl-j to move down a split
nnoremap <C-K> <C-W><C-K> "Ctrl-k to move up a split
nnoremap <C-L> <C-W><C-L> "Ctrl-l to moveright a split
nnoremap <C-H> <C-W><C-H> "Ctrl-h to move left a split
"Markdown Setup
nmap <C-M> <Plug>MarkdownPreviewToggle
let g:mkdp_auto_close = 0 " Auto close when chg from markdown
" ======================= Crazy stuff to be organized ========================
if &term =~ "ansi"
let &t_ti = "\<Esc>[?47h"
let &t_te = "\<Esc>[?47l"
endif
"powerline
"set rtp+=/Users/hito/Library/Python/2.7/lib/python/site-packages/powerline/bindings/vim/
set laststatus=2
"set t_Co=256
"""" enable 24bit true color
" If you have vim >=8.0 or Neovim >= 0.1.5
if (has("termguicolors"))
set termguicolors
endif
" Makes termcolors work on tmux
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
"Color scheme
colorscheme shades_of_purple
let g:shades_of_purple_lightline = 1
let g:lightline = { 'colorscheme': 'shades_of_purple' }
" Remove background background transparent
" hi! Normal ctermbg=NONE guibg=NONE
" hi! NonText ctermbg=NONE guibg=NONE guifg=NONE ctermfg=NONE