-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
119 lines (98 loc) · 2.47 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
set nu
set rnu
set ru
set cursorline
set et
set ts=4
set sw=4
set t_Co=256
set incsearch
set ignorecase
set smartcase
set wrap
set confirm
set mouse=a
function! GitBranch()
let l:filename = expand('%:p')
let g:git_branch = system('bash -c "echo -n $(git rev-parse --abbrev-ref HEAD)"')
endfunction
function! StatuslineGit()
if exists("g:git_branch")
return ' '.g:git_branch.' '
else
return ' not tracked '
endif
endfunction
autocmd BufEnter * call GitBranch()
autocmd ShellCmdPost * call GitBranch()
set statusline=
set statusline+=%#PmenuSel#
set statusline+=%{StatuslineGit()}
set statusline+=%#CursorColumn#
set statusline+=\ %f
set statusline+=\ %r
set statusline+=%m
set statusline+=%#identifier#
set statusline+=%=
set statusline+=\ %y
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
set statusline+=\[%{&fileformat}\]
set statusline+=%#LineNr#
set statusline+=\ %p%%
set statusline+=\ %l:%c
set laststatus=2
hi Comment ctermfg=green
hi MatchParen ctermbg=black ctermfg=cyan
hi CursorColumn term=bold ctermfg=black ctermbg=lightcyan cterm=bold
let mapleader = " "
inoremap jk <ESC>
inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {}<ESC>i
inoremap ' ''<ESC>i
inoremap " ""<ESC>i
inoremap <C-F> <C-X><C-F>
inoremap <C-D> <C-X><C-D>
inoremap <C-L> <C-X><C-L>
nnoremap <leader>n :set invnu invrnu<CR>
" Move to window using the <ctrl> hjkl keys
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Clear search with <esc> (vim has bug with follows)
" nnoremap <esc> :noh<CR><esc>
" Save file
nnoremap <C-s> :w<CR><esc>
" Better indenting
vnoremap < <gv
vnoremap > >gv
" Buffers
nnoremap <S-h> :bprevious<CR>
nnoremap <S-l> :bnext<CR>
nnoremap <leader>l :ls<CR>
" Better yank
noremap Y y$
" Move lines
nnoremap <Leader>j :m .+1<CR>==
nnoremap <Leader>k :m .-2<CR>==
vnoremap <Leader>j :<C-u>execute "'<,'>move '>+" . v:count1<cr>gv=gv
vnoremap <leader>k :<C-u>execute "'<,'>move '<-" . (v:count1 + 1)<cr>gv=gv
" Windows
nnoremap <leader>w <c-w>
nnoremap <leader>- <C-W>s
nnoremap <leader>\| <c-w>v
" Terminal (ctrl+/ -> C-_)
set termwinsize=10*200
nnoremap <leader>t :bo term<CR>
nnoremap <C-_> :bo term<CR>
tnoremap <C-_> <cmd>close!<CR>
tnoremap <ESC> <C-\><C-n>
" Clipboard
let clip = "/mnt/c/Windows/System32/clip.exe"
if executable(clip) == 1
augroup Clipboard
autocmd!
autocmd TextYankPost * if v:event.operator == 'y' && v:event.regname == '' | call system(clip, @") | endif
augroup END
endif