-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
97 lines (81 loc) · 1.89 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
" vim:set foldmethod=marker:
"-------------------------------------------------------------------------------
" General environment
"-------------------------------------------------------------------------------
" Baseline {{{
set nocompatible
set nobackup
set encoding=utf-8
set fileformats=unix,dos
set modeline
set modelines&
set wildmenu
" }}}
" Display {{{
syntax on
colorscheme elflord
set background=dark
set laststatus=2
set statusline=%<%F\ %w%h%m%r\ [%{&ff},%{&fenc}%Y]\ %=\ %-14.(%l,%c%V%)\ %P
highlight StatusLine ctermfg=Cyan
set showcmd
set showmode
set number
highlight LineNr ctermfg=DarkGray
" }}}
" Editing {{{
set backspace=indent,eol,start
set whichwrap=b,s,<,>,[,]
set pastetoggle=<F2>
set matchpairs+=<:>
set hlsearch
set incsearch
set ignorecase
set infercase
set smartcase
set clipboard=unnamed
" }}}
" Formatting {{{
set textwidth=80
set nowrap
set list listchars=tab:\ \ ,trail:\ ,extends:»,precedes:«
highlight SpecialKey ctermbg=Red
set shiftwidth=4
set softtabstop=4
set expandtab
set smarttab
set autoindent
set smartindent
" }}}
"-------------------------------------------------------------------------------
" Custom settings
"-------------------------------------------------------------------------------
" Mappings {{{
nnoremap <F3> :nohlsearch<CR>
nnoremap Y y$
nnoremap Q :confirm qa<CR>
cnoremap w!! w !sudo tee % >/dev/null
nnoremap <C-]> zh
nnoremap <C-\> zl
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k
nnoremap <C-H> <C-W>h
nnoremap <C-L> <C-W>l
imap <expr> <Tab> <SID>TabExpression()
smap <expr> <Tab> <SID>TabExpression()
" }}}
" Commands {{{
autocmd BufWritePre * :%s/\s\+$//e
autocmd BufWritePre * :%s/\($\n\s*\)\+\%$//e
" }}}
" Functions {{{
function! s:TabExpression()
let l:expr = "\<Tab>"
if pumvisible()
let l:expr = "\<C-N>"
elseif col('.') != 1 && getline('.')[col('.') - 2] !~ '\s'
let l:expr = "\<C-X>\<C-O>"
endif
return l:expr
endfunction
" }}}