-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
executable file
·153 lines (121 loc) · 4.43 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
set nocompatible
set inccommand=nosplit
set viminfo+=n~/.cache/vim/viminfo
set runtimepath+=~/.config/vim
"" Leader shortcuts
let mapleader=" " " leader string is coma
"" Imports
source $HOME/.config/vim/src/plugins.vim " load all plugins first
source $HOME/.config/vim/src/ag_rg_fzf.vim
source $HOME/.config/vim/src/airline.vim
source $HOME/.config/vim/src/autopairs.vim
source $HOME/.config/vim/src/devicons.vim
source $HOME/.config/vim/src/json.vim
source $HOME/.config/vim/src/nerdtree.vim
source $HOME/.config/vim/src/nvim_compe.vim
source $HOME/.config/vim/src/nvim_lsp.vim
source $HOME/.config/vim/src/python_config.vim
"" Must haves
set autoread
set autowrite
set backspace=indent,eol,start
set updatetime=250
set encoding=UTF-8
set hidden " have unwritten changes to a file and open a new file
set wrap " don't wrap lines
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set visualbell " don't beep
set noerrorbells " don't beep
set nobackup
set noswapfile
set mouse=c
set wildignore=*.swp,*.bak,*/*.pyc,*/*.class,*/.cls
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " Linux/MacOSX
set wildignore+=*/vendor/**
set wildignore+=*/node_modules/**
set wildignore+=*/__pycache__/*
if !has('nvim')
set balloondelay=2500 " Balloon Config
set termguicolors
endif
"" Colors
set background=dark
colorscheme space-vim-dark " awesome colorscheme
syntax enable " enable syntax highlighting
"" Spaces and Tabs
set tabstop=4 " visualization of spaces in a tab
set softtabstop=3 " number of spaces in tab when editing
set shiftwidth=4 " number of spaces to use for autoindenting
set expandtab " tabs are interpreted as spaces
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
"" UI config
set number " display line numbers
set cursorline " highlight current line
set wildmenu " visual autocomplete for command menu
set lazyredraw " redraw only when needed
set showmatch " shows the matching brackets [{()}]
set ruler " shows column & line number & cursor position
"" Searching
set incsearch " search as characters are entered
set hlsearch " highlight search terms
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase, case-sensitive otherwise
nmap <silent> <Leader>/ :nohlsearch<CR>
vnoremap // y/<C-R>"<CR> " search for visually select text using '//'
"" Folding
" za opens/closes the fold around the current block.
" There are different methods to fold a document
" kindly find it on help (:help foldmethod).
set nofoldenable " enable folding
set foldmethod=indent
set foldnestmax=10
set foldlevel=1
"" File specific configurations
filetype plugin indent on " load filetype-specific indent files
"" Cursor Movement Shortcuts
nnoremap j gj
nnoremap k gk
nnoremap <S-b> ^
nnoremap <S-e> $
tnoremap <Esc> <C-\><C-n>
"" File explorer
let g:netrw_liststyle=3
"" Window remapping
map <C-h> <C-w><C-h>
map <C-j> <C-w><C-j>
map <C-k> <C-w><C-k>
map <C-l> <C-w><C-l>
"" Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>ez :e ~/.zshrc<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
"" Changing cursor shape on insert mode
if has("unix")
let s:uname = system("uname")
if s:uname == "Darwin\n"
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
endif
"" Open terminal in horizontal split
nnoremap <silent> <leader>t :call OpenTerminal()<CR>
function! OpenTerminal()
silent execute 'botright 12 split' | exe 'terminal'
endfunction
if has("autocmd")
autocmd TermOpen * :startinsert
endif
if has("autocmd")
au VimEnter,InsertLeave * silent execute '!echo -ne "\e[1 q"' | redraw!
au InsertEnter,InsertChange *
\ if v:insertmode == 'i' |
\ silent execute '!echo -ne "\e[5 q"' | redraw! |
\ elseif v:insertmode == 'r' |
\ silent execute '!echo -ne "\e[3 q"' | redraw! |
\ endif
au VimLeave * silent execute '!echo -ne "\e[ q"' | redraw!
endif