-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
executable file
·142 lines (115 loc) · 5.64 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
"==========================
" Basic settings
"==========================
set tabstop=4 " The width of a TAB is set to 2
set shiftwidth=4 " Indents will have a width of 4
set softtabstop=4 " Sets the number of columns for a TAB
set expandtab " Expand TABs to spaces
set autoindent
set smartindent " Auto indent based on syntax
set backspace=indent,eol,start " Fix Backspace and delete problems
set enc=utf-8 " encode
set fencs=ucs-bom,utf-8,iso-2022-jp,euc-jp,cp932,latin1
set formatoptions-=ro " Disable auto comment out when indent
set mouse=a " Use mouse wheel to scroll on all modes
set completeopt-=preview " Disable scratch preview window"
"==========================
" HotKeys settings
"==========================
" Toggle off/on
noremap <F4> :set hlsearch! hlsearch?<CR> " search highlighting
noremap <F5> :set number! number?<CR> " line
noremap <F6> :set paste! paste?<CR> " paste
noremap <F7> :IndentLinesToggle<CR> " indentline
" HotKeys for split
nnoremap hT <C-W><C-H>
nnoremap jt <C-W><C-J>
nnoremap jT <C-W><C-K>
nnoremap ht <C-W><C-L>
" NERDTree
map <C-e> :NERDTreeToggle<CR>
"==========================
" Have Vim jump to the last position when reopening a file
"==========================
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
"==========================
" Search settings
"==========================
set ignorecase " Ingnore capital alphabet
set hlsearch " Highlighe
set incsearch " Realtime searching
"==========================
" Appearance settings
"==========================
syntax on " Color for language
set background=dark " Dark theme
set guifont=Lucida_Console\ 16
set list " Display tabs as ^I
set listchars=tab:>- " Display tabs as characters
" set foldmethod=syntax " Syntax folding
" Tabe bar
set showtabline=2
hi TabLine guifg=#333333 guibg=#222222 gui=none ctermfg=254 ctermbg=238 cterm=none
hi TabLineSel guifg=#666666 guibg=#222222 gui=bold ctermfg=231 ctermbg=235 cterm=bold
hi TabLineFill guifg=#999999 guibg=#222222 gui=none ctermfg=254 ctermbg=238 cterm=none
" Change search highlight color
hi Search ctermbg=LightBlue
"==========================
" Last Status Line
"==========================
set laststatus=2 " set the bottom status bar
" " (0:表示しない、1:2つ以上ウィンドウがある時だけ表示)
" default the statusline when entering Vim
hi statusline guibg=White guifg=Black ctermbg=0 ctermfg=6
" Formats the statusline
set statusline=%f " file name
set statusline+=[%{strlen(&fenc)?&fenc:'none'}, " file encoding
"set statusline+=[ENC=%{&fileencoding}] " file encoding
set statusline+=%{&ff}] " file format
"set statusline+=%y " filetype
set statusline+=%h " help file flag
set statusline+=[%{getbufvar(bufnr('%'),'&mod')?'modified':'saved'}] " modified flag
"set statusline+=%m " 変更チェック表示
set statusline+=%r "read only flag
set statusline+=%w " プレビューウインドウなら[Prevew]と表示
set statusline+=\ %= " align left
set statusline+=Line:%l/%L " line X of Y [percent of file]
set statusline+=\ Col:%c " current column
set statusline+=\ [%p%%]\ " line X of Y [percent of file]
"set statusline+=\ Buf:%n " Buffer number
"set statusline+=\ [%b][0x%B]\ " ASCII and byte code under cursor
"==========================
" Automatically removing all trailing whitespace
" Every time the user issues a :w command, Vim will automatically remove all trailing whitespace before saving
"==========================
if $NODENAME != "icepp" && $NODENAME != "cern" " except icepp and lxplus
autocmd BufWritePre * %s/\s\+$//e
endif
"==========================
" Auto change indent width
"==========================
augroup fileTypeIndent
autocmd!
autocmd BufNewFile,BufRead *.rb,*.erb setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.html,*.css,*.scss,*.js,*.svg setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.cxx,*.cpp,*.C,*.h,*.ino setlocal tabstop=2 softtabstop=2 shiftwidth=2
augroup END
"==========================
" Plugins
"==========================
filetype plugin indent on
" This will be installed by setup.sh
"call plug#begin()
" " Display thin vertical lines at each indentation level for code indented with spaces
" Plug 'Yggdroot/indentLine'
" " You Complete Me
" Plug 'ycm-core/YouCompleteMe'
"call plug#end()
autocmd Filetype json let g:indentLine_setConceal = 0 " Must disable indentline for JSON file
let g:ycm_min_num_of_chars_for_completion = 3 " Minimum characters for auto completion
" Ale
" 保存時のみ実行する
let g:ale_lint_on_text_changed = 0