-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
54 lines (43 loc) · 1.46 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
set ruler
set laststatus=2
set statusline=%F " show filepath on status line
set number
" Highlight search terms, but can clear the highlights with <space>
set hlsearch
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" remap navigation keys
noremap j h
noremap k j
noremap i k
" for exiting and entering insert mode
inoremap hh <ESC>
noremap h i
" default color scheme (dark mode)
:colorscheme slate
function! Toggle_Light_Dark_Colorscheme()
if system('tmux show-environment THEME')[0:9] == 'THEME=dark'
:silent :!tmux set-environment THEME 'light'
:silent :!tmux source-file ~/.tmux_light.conf
else
:silent :!tmux set-environment THEME 'dark'
:silent :!tmux source-file ~/.tmux_dark.conf
endif
:call SetColorScheme()
endfunction
function! SetColorScheme()
" check if tmux colorsheme is light or dark, and pick for vim accordingly
if system('tmux show-environment THEME')[0:9] == 'THEME=dark'
colorscheme slate
else
colorscheme morning
endif
endfunction
" can call this with \o
nnoremap <Leader>o :call Toggle_Light_Dark_Colorscheme()<cr>
" I'm not sure which of these is working so I'll keep them all for now
" Still doesn't work when focus is gained though. In that case, you
" need to manually call the toggler with \o
autocmd BufEnter * :call SetColorScheme()
autocmd VimEnter * :call SetColorScheme()
autocmd FocusLost * :call SetColorScheme()
autocmd FocusGained * :call SetColorScheme()