-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.vim
158 lines (123 loc) · 4.01 KB
/
init.vim
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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" Code Navigation and Search
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'mileszs/ack.vim'
" Syntax Highlighting and Language Support
Plugin 'sheerun/vim-polyglot'
Plugin 'neoclide/coc.nvim', {'branch': 'release'}
Plugin 'dense-analysis/ale'
" Code Editing and Refactoring
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-sleuth'
Plugin 'tpope/vim-repeat'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'junegunn/vim-easy-align'
Plugin 'tpope/vim-commentary'
" Version Control
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
" UI Enhancements
Plugin 'flazz/vim-colorschemes'
Plugin 'itchyny/lightline.vim'
" File Management
Plugin 'tpope/vim-vinegar'
" NerdTree
Plugin 'preservim/nerdtree'
" Miscellaneous
Plugin 'mbbill/undotree'
Plugin 'junegunn/goyo.vim'
Plugin 'Yggdroot/indentLine'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"
" Enable line numbers
set number
" Enable relative line numbers
set relativenumber
" Function to toggle between relative and absolute line numbers
function! ToggleNumber()
if &relativenumber
set norelativenumber
set number
else
set relativenumber
set number
endif
endfunction
" Set the leader key to space
let mapleader = " "
" Enable line numbers
set number
set relativenumber
" Function to toggle between relative and absolute line numbers
function! ToggleNumber()
if &relativenumber
set norelativenumber
set number
else
set relativenumber
set number
endif
endfunction
" Key binding to toggle line numbers
nnoremap <leader>l :call ToggleNumber()<CR>
" Save the current file with <leader>w
nnoremap <leader>w :w<CR>
" Quit Vim with <leader>q
nnoremap <leader>q :q<CR>
" Save and quit with <leader>x
nnoremap <leader>x :wq<CR>
" nnoremap <C-b> :NERDTreeToggle<CR>
" Open NERDTree with <leader>n
nnoremap <leader>n :NERDTreeToggle<CR>
" Highlight search
nnoremap // :nohlsearch<CR>
" Normal mode: Comment or uncomment the current line or selected lines
nnoremap <C-_> :Commentary<CR>
vnoremap <C-_> :Commentary<CR>
" For visual block mode
xnoremap <C-_> :Commentary<CR>
" Automatically go to the last known position when reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
" Show number of lines in each file in NERD
let g:NERDTreeFileLines = 1
" Close Vim if NERDTree is the only window remaining
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Map Ctrl+l to move to the right window
nnoremap <C-l> <C-w>l
" Map Ctrl+k to move to the upper window
nnoremap <C-k> <C-w>k
" Map Ctrl+j to move to the lower window
nnoremap <C-j> <C-w>j
" Map Ctrl+h to move to the left window
nnoremap <C-h> <C-w>h