-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
154 lines (120 loc) · 6.95 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
" ------------AmirSamimi configs from HERE--------------------------
:set number " Display line numbers on the left side
:set ls=2 " This makes Vim show a status line even when only one window is shown
:filetype plugin on " This line enables loading the plugin files for specific file types
:set tabstop=4 " Set tabstop to tell vim how many columns a tab counts for. Linux kernel code expects each tab to be eight columns wide.
:set expandtab " When expandtab is set, hitting Tab in insert mode will produce the appropriate number of spaces.
:set softtabstop=4 " Set softtabstop to control how many columns vim uses when you hit Tab in insert mode. If softtabstop is less than tabstop and expandtab is not set, vim will use a combination of tabs and spaces to make up the desired spacing. If softtabstop equals tabstop and expandtab is not set, vim will always use tabs. When expandtab is set, vim will always use the appropriate number of spaces.
:set shiftwidth=4 " Set shiftwidth to control how many columns text is indented with the reindent operations (<< and >>) and automatic C-style indentation.
:setlocal foldmethod=indent " Set folding method
:set t_Co=256 " makes Vim use 256 olors
:set nowrap " Don't Wrap lines!
":colorscheme molokai " Set colorScheme -----NOT SET YET IT {WAS MOLOKAI}------- I added holokai so comment it
"let g:molokai_original = 1
:set background=dark "holokai has gray and dark background, this choose dark, I Like it (hamid)
:set nocp " This changes the values of a LOT of options, enabling features which are not Vi compatible but really really nice
:set clipboard=unnamed
:set clipboard=unnamedplus "need to install vim-gnome or vim-gtk in ubuntu and debian
:set autoindent " Automatic indentation
:set cindent " This turns on C style indentation
:set si " Smart indent
:syntax enable " syntax highlighting
:set showmatch " Show matching brackets
:set hlsearch " Highlight in search
:set ignorecase " Ignore case in search
:set noswapfile " Avoid swap files
:set mouse=a " Mouse Integration
" I disable it, these days it bothered me, look for a better way in future
"" auto complete for ( , " , ' , [ , {
":inoremap ( ()<Left>
":inoremap " ""<Left>
":inoremap ` ``<Left>
":inoremap ' ''<Left>
":inoremap [ []<Left>
":inoremap { {}<Left>
"" auto comment and uncooment with F6 and F7 key
:autocmd FileType c,cpp,java,scala let b:comment_leader = '// '
:autocmd FileType sh,ruby,python let b:comment_leader = '# '
:noremap <silent> #6 :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> " commenting line with F6
:noremap <silent> #7 :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> " uncommenting line with F7
" :noremap <silent> #5 :!xterm -hold -e './%' <CR> <CR>" execute bash & python script with F5
:noremap <silent> #5 :!konsole --hold -e 'python ./%' <CR> <CR>" execute python script with F5
:noremap <silent> #3 :tabprevious<CR> " switch to previous tab with F3
:noremap <silent> #4 :tabnext<CR> " switch to next tab with F2
:map <F8> :setlocal spell! spelllang=en_us<CR> " check spelling with F8
:set pastetoggle =<F2> " Paste mode toggle with F2 Pastemode disable auto-indent and bracket auto-compelation and it helps you to paste code fro elsewhere .
":set arabicshape! # concatinate persian chars
"----------------------------------Plugins settings-------------------------------------
"here are plugins settings
"indentLine
let g:indentLine_char = '┆'
" autocomplpop setting
:set omnifunc=syntaxcomplete " This is necessary for acp plugin
:let g:acp_behaviorKeywordLength = 1 " Length of keyword characters before the cursor, which are needed to attempt keyword completion
" airline plugin setting
:let g:airline_theme='wombat' " set airline plugin theme
:let g:airline#extensions#tabline#enabled = 1 " showing tabs
:let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
"vim-airline-clock
:let g:airline#extensions#clock#format = '%c'
" NERDTree plugin setting
"toggle showing NERDTree with F9
:map <F9> :NERDTreeToggle<CR>
"open a NERDTree automatically when vim starts up if no files were specified
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Open file in new tab with ctrl + t
:let NERDTreeMapOpenInTab='<c-t>'
:set ttymouse=xterm2
"emmet used for html,css,js use [ctrl+y]+,
let g:user_emmet_leader_key='<c-y>'
"make Vim transpareint -->
""https://stackoverflow.com/questions/37712730/set-vim-background-transparent
""hi Normal guibg=NONE ctermbg=NONE
"vim-auto-save
let g:auto_save = 1 " enable AutoSave on Vim startup
let g:auto_save_silent = 1 " do not display the auto-save notification
let g:auto_save_events = ["InsertLeave", "TextChanged"] "save every change when leave insert mode(normal mode)
"more options in repository: https://github.com/907th/vim-auto-save
"YouCompleteMe
let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
let g:ycm_complete_in_comments = 1 " Completion in comments
let g:ycm_complete_in_strings = 1 " Completion in string
let g:ycm_min_num_of_chars_for_completion = 1
"link: https://code.djangoproject.com/wiki/UsingVimWithDjango#YouCompleteMe
"if not update: just run this command
" sudo apt install build-essential cmake python3-dev
"detail instruction in repo:https://github.com/Valloric/YouCompleteMe
"----------------------------Vim-Plug installation plugins--------------------------------
"Plugins will be downloaded under the specified directory.
call plug#begin('~/.vim/plugged')
Plug 'https://github.com/scrooloose/nerdtree.git'
Plug 'itchyny/lightline.vim'
Plug 'mattn/emmet-vim'
"Plug 'https://github.com/changyuheng/color-scheme-holokai-for-vim.git'
Plug 'patstockwell/vim-monokai-tasty'
Plug 'chiel92/vim-autoformat'
"Plug 'alvan/vim-closetag' "html closeTag, emmet-vim
Plug 'davidhalter/jedi-vim' "python autocompletion
Plug 'https://github.com/tc50cal/vim-terminal.git' "type :term
Plug 'https://github.com/907th/vim-auto-save' "autosave, it has settings above
"Plug 'https://github.com/Valloric/YouCompleteMe.git' "auto completion good for many lanugages, forked from 'jedi'
Plug 'https://github.com/tweekmonster/django-plus.vim.git'
Plug 'https://github.com/mjbrownie/django_completeme.git'
Plug 'ervandew/supertab' "Perform all your vim insert mode completions with Tab
Plug 'tpope/vim-surround'
"Plug 'plasticboy/vim-markdown'
"List ends here. Plugins become visible to Vim after this call.
call plug#end()