This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
106 lines (81 loc) · 2.2 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
filetype off
set nocompatible
"syntax highlighting
syntax on
"numbers on left
set number
"turn hybrid line numbers on
set number relativenumber
set nu rnu
"bottom orientaion
set ruler
"disabling backup files
set nobackup
"disabling swap files creation
set noswapfile
"disabling bells sounds
set visualbell t_vb=
"tab settings
set tabstop=4
set shiftwidth=4
"set smarttab
"set autoindent
"set expandtab
"set smartindent
"autowidth
set textwidth=90
"numbers from left
set numberwidth=2
"highlight search
set hlsearch
"incremental highlight search
set incsearch
"backspace in insert mode
set backspace=indent,eol,start
" Plugins
set rtp+=$HOME/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
"Plugin for 'file manager' in vim
Plugin 'scrooloose/nerdtree'
"Plugin 'dhruvasagar/vim-table-mode' for tables
Plugin 'dhruvasagar/vim-table-mode'
"Plugin 'jiangmiao/auto-pairs' for brackets
Plugin 'jiangmiao/auto-pairs'
"Plugin 'tpope/vim-commentary' for comment
Plugin 'tpope/vim-commentary'
"Plugin youcompleteme
Plugin 'ycm-core/YouCompleteMe'
call vundle#end()
filetype plugin indent on
" End of plugins
"settings for table mode
function! s:isAtStartOfLine(mapping)
let text_before_cursor = getline('.')[0 : col('.')-1]
let mapping_pattern = '\V' . escape(a:mapping, '\')
let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\')
return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$')
endfunction
inoreabbrev <expr> <bar><bar>
\ <SID>isAtStartOfLine('\|\|') ?
\ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>'
inoreabbrev <expr> __
\ <SID>isAtStartOfLine('__') ?
\ '<c-o>:silent! TableModeDisable<cr>' : '__'
"end of settings for table mode
"mappings for nerdtree
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
"end of mappings for nerdtree
"global mappings
"write and exit by F2
map <F2> :x <CR>
"only write by F3
map <F3> :w <CR>
"only exit by F4
map <F4> :!q <CR>
".h to .cpp by F5
map <F5> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
" end of mappings