123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- set shell=powershell " Default Windows shell is cmd.exe
- set mouse=a " mouse on
- " Default directory
- cd ~
- set autochdir
- let s:prefix="<C-a>" " <prefix>
- let s:vmuxExit='<C-\><C-n>'
- " Use system clipboard
- set clipboard=unnamed
- " --- FUNCTIONS ---
- function Bind(key, ...)
- exe join(['tnoremap <silent>', s:prefix . a:key, s:vmuxExit, join(a:000, ' ')], ' ')
- exe join(['nnoremap <silent>', s:prefix . a:key, s:vmuxExit, join(a:000, ' ')], ' ')
- endfunction
- command! -nargs=+ -bar Bind :call Bind(<f-args>)
- function GoToTab(index)
- if a:index == tabpagenr()
- startinsert
- elseif a:index <= tabpagenr("$")
- call feedkeys(a:index . "gt")
- else
- echo "Can't find window: " . a:index
- startinsert
- endif
- endfunction
- function ModeName()
- let modes = {
- \ '__' : '------',
- \ 'n' : 'NORMAL',
- \ 'no' : 'OP PENDING',
- \ 'nov': 'OP PENDING CHAR',
- \ 'noV': 'OP PENDING LINE',
- \ 'no': 'OP PENDING BLOCK',
- \ 'niI': 'INSERT (NORMAL)',
- \ 'niR': 'REPLACE (NORMAL)',
- \ 'niV': 'V REPLACE (NORMAL)',
- \ 'v' : 'VISUAL',
- \ 'V' : 'VISUAL-LINE',
- \ '' : 'VISUAL-BLOCK',
- \ 's' : 'SELECT',
- \ 'S' : 'SELECT-LINE',
- \ '' : 'SELECT-BLOCK',
- \ 'i' : '',
- \ 'ic' : 'INSERT COMPL GENERIC',
- \ 'ix' : 'INSERT COMPL',
- \ 'R' : 'REPLACE',
- \ 'Rc' : 'REPLACE COMP GENERIC',
- \ 'Rv' : 'V REPLACE',
- \ 'Rx' : 'REPLACE COMP',
- \ 'c' : 'COMMAND',
- \ 'cv' : 'VIM EX',
- \ 'ce' : 'EX',
- \ 'r' : 'PROMPT',
- \ 'rm' : 'MORE PROMPT',
- \ 'r?' : 'CONFIRM',
- \ '!' : 'SHELL',
- \ 't' : '',
- \ 'multi' : 'MULTI',
- \ }
- return modes[mode()]
- endfunction
- " --- BINDINGS ---
- Bind % :vnew +term<Enter> " split window vertical
- Bind \" :new +term<Enter> " split window horizontal
- Bind x :q!<Enter> " close pane
- Bind X :qa!<Enter> " exit
- Bind [ " swich to normal mode
- Bind c :tabnew +term<Enter> " create tab
- Bind n gt " next tab
- Bind p gT " previos tab
- Bind : :call feedkeys(':')<Enter> " command mode
- " Window moving <prefix>h
- Bind j <C-w>j
- Bind h <C-w>h
- Bind H <C-w>H
- Bind J <C-w>J
- Bind k <C-w>k
- Bind K <C-w>K
- Bind l <C-w>l
- Bind L <C-w>L
- " Tab moving <prefix>1
- Bind 1 :call GoToTab(1)<Enter>
- Bind 2 :call GoToTab(2)<Enter>
- Bind 3 :call GoToTab(3)<Enter>
- Bind 4 :call GoToTab(4)<Enter>
- Bind 5 :call GoToTab(5)<Enter>
- Bind 6 :call GoToTab(6)<Enter>
- Bind 7 :call GoToTab(7)<Enter>
- Bind 8 :call GoToTab(8)<Enter>
- Bind 9 :call GoToTab(9)<Enter>
- Bind 0 :call GoToTab(10)<Enter>
- " --- AUTOCOMMANDS ---
- " Launch terminal on startup
- au VimEnter * term
- " Enter terminal mode automatically
- au BufWinEnter,WinEnter term://* startinsert
- " Close the window if the terminal is finished
- au TermClose * :q! | startinsert
- " --- UI ---
- " Transparent window borders
- hi VertSplit cterm=NONE
- " Hide UI
- set noshowmode
- set noruler
- set showtabline=0
- set noshowcmd
- " Statusline
- set laststatus=3 " single statusline
- set statusline= " reset statusline
- set statusline+=[%{tabpagenr()}/%{tabpagenr('$')}] " tab-number and count of tabs
- set statusline+=\ %{ModeName()} " current mode (not INSERT and TERMINAL)
- set statusline+=%= " float: right
- set statusline+=%{strftime('%R\ %d-%m-%Y')}\ " date and time
- " Transparent background for statusline
- hi StatusLine ctermbg=0 cterm=NONE
- " Start insert on startup
- startinsert
|