diff options
-rw-r--r-- | .vimrc | 3 | ||||
-rw-r--r-- | README.md | 29 | ||||
-rw-r--r-- | i3/.i3blocks.conf (renamed from .i3blocks.conf) | 0 | ||||
-rwxr-xr-x | i3/blocks/audio (renamed from .i3-blocks/blocks/audio) | 0 | ||||
-rwxr-xr-x | i3/blocks/bandwidth (renamed from .i3-blocks/blocks/bandwidth) | 0 | ||||
-rwxr-xr-x | i3/blocks/battery (renamed from .i3-blocks/blocks/battery) | 0 | ||||
-rwxr-xr-x | i3/blocks/bluetooth (renamed from .i3-blocks/blocks/bluetooth) | 0 | ||||
-rwxr-xr-x | i3/blocks/brightness (renamed from .i3-blocks/blocks/brightness) | 0 | ||||
-rwxr-xr-x | i3/blocks/cmus (renamed from .i3-blocks/blocks/cmus) | 0 | ||||
-rwxr-xr-x | i3/blocks/countdown (renamed from .i3-blocks/blocks/countdown) | 0 | ||||
-rwxr-xr-x | i3/blocks/cpu (renamed from .i3-blocks/blocks/cpu) | 0 | ||||
-rwxr-xr-x | i3/blocks/datetime (renamed from .i3-blocks/blocks/datetime) | 0 | ||||
-rwxr-xr-x | i3/blocks/display (renamed from .i3-blocks/blocks/display) | 0 | ||||
-rwxr-xr-x | i3/blocks/feed (renamed from .i3-blocks/blocks/feed) | 0 | ||||
-rwxr-xr-x | i3/blocks/firewall (renamed from .i3-blocks/blocks/firewall) | 0 | ||||
-rwxr-xr-x | i3/blocks/ip-address (renamed from .i3-blocks/blocks/ip-address) | 0 | ||||
-rwxr-xr-x | i3/blocks/keymap (renamed from .i3-blocks/blocks/keymap) | 0 | ||||
-rwxr-xr-x | i3/blocks/keystate (renamed from .i3-blocks/blocks/keystate) | 0 | ||||
-rwxr-xr-x | i3/blocks/launcher (renamed from .i3-blocks/blocks/launcher) | 0 | ||||
-rwxr-xr-x | i3/blocks/load (renamed from .i3-blocks/blocks/load) | 0 | ||||
-rwxr-xr-x | i3/blocks/locale (renamed from .i3-blocks/blocks/locale) | 0 | ||||
-rwxr-xr-x | i3/blocks/mail (renamed from .i3-blocks/blocks/mail) | 0 | ||||
-rwxr-xr-x | i3/blocks/memory (renamed from .i3-blocks/blocks/memory) | 0 | ||||
-rwxr-xr-x | i3/blocks/microphone (renamed from .i3-blocks/blocks/microphone) | 0 | ||||
-rwxr-xr-x | i3/blocks/network (renamed from .i3-blocks/blocks/network) | 0 | ||||
-rwxr-xr-x | i3/blocks/notifier (renamed from .i3-blocks/blocks/notifier) | 0 | ||||
-rwxr-xr-x | i3/blocks/packages (renamed from .i3-blocks/blocks/packages) | 0 | ||||
-rwxr-xr-x | i3/blocks/playerctl (renamed from .i3-blocks/blocks/playerctl) | 0 | ||||
-rwxr-xr-x | i3/blocks/process (renamed from .i3-blocks/blocks/process) | 0 | ||||
-rwxr-xr-x | i3/blocks/scroll (renamed from .i3-blocks/blocks/scroll) | 0 | ||||
-rwxr-xr-x | i3/blocks/space (renamed from .i3-blocks/blocks/space) | 0 | ||||
-rwxr-xr-x | i3/blocks/ssid (renamed from .i3-blocks/blocks/ssid) | 0 | ||||
-rwxr-xr-x | i3/blocks/temperature (renamed from .i3-blocks/blocks/temperature) | 0 | ||||
-rwxr-xr-x | i3/blocks/trash (renamed from .i3-blocks/blocks/trash) | 0 | ||||
-rwxr-xr-x | i3/blocks/usb (renamed from .i3-blocks/blocks/usb) | 0 | ||||
-rwxr-xr-x | i3/blocks/user (renamed from .i3-blocks/blocks/user) | 0 | ||||
-rwxr-xr-x | i3/blocks/vpn (renamed from .i3-blocks/blocks/vpn) | 0 | ||||
-rwxr-xr-x | i3/blocks/weather (renamed from .i3-blocks/blocks/weather) | 0 | ||||
-rwxr-xr-x | i3/blocks/webcam (renamed from .i3-blocks/blocks/webcam) | 0 | ||||
-rw-r--r-- | i3/blocks/window (renamed from .i3-blocks/blocks/window) | 0 | ||||
-rw-r--r-- | vim/.vimrc | 541 |
41 files changed, 571 insertions, 2 deletions
@@ -1,3 +1,6 @@ +execute pathogen#infect() +autocmd vimenter * NERDTree + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " MiniVim " Details on : https://github.com/sd65/MiniVim @@ -1,2 +1,27 @@ -- i3-gaps -- i3blocks +# i3 + +## packages + - i3-gaps + - i3blocks + +## files paths + - config -> ~/.config/i3/config + - myconf.sh -> ~/.config/i3/myconf.sh + - who.sh -> ~/.config/i3/who.sh + - blocks/* -> ~/.i3-blocks/blocks/ + - .i3blocks.conf -> ~/.i3blocks.conf + +# vim + +## files paths + - .vimrc -> ~/.vimrc + +## khal + +## files paths + -khal.conf -> ~/.config/khal/khal.conf + +## khard + +## files paths + - khard.conf -> ~/.config/khard/khard.conf diff --git a/.i3blocks.conf b/i3/.i3blocks.conf index 2be3871..2be3871 100644 --- a/.i3blocks.conf +++ b/i3/.i3blocks.conf diff --git a/.i3-blocks/blocks/audio b/i3/blocks/audio index c401c68..c401c68 100755 --- a/.i3-blocks/blocks/audio +++ b/i3/blocks/audio diff --git a/.i3-blocks/blocks/bandwidth b/i3/blocks/bandwidth index f0b18cf..f0b18cf 100755 --- a/.i3-blocks/blocks/bandwidth +++ b/i3/blocks/bandwidth diff --git a/.i3-blocks/blocks/battery b/i3/blocks/battery index 3058f36..3058f36 100755 --- a/.i3-blocks/blocks/battery +++ b/i3/blocks/battery diff --git a/.i3-blocks/blocks/bluetooth b/i3/blocks/bluetooth index c9673a5..c9673a5 100755 --- a/.i3-blocks/blocks/bluetooth +++ b/i3/blocks/bluetooth diff --git a/.i3-blocks/blocks/brightness b/i3/blocks/brightness index f6294e4..f6294e4 100755 --- a/.i3-blocks/blocks/brightness +++ b/i3/blocks/brightness diff --git a/.i3-blocks/blocks/cmus b/i3/blocks/cmus index f4d15b3..f4d15b3 100755 --- a/.i3-blocks/blocks/cmus +++ b/i3/blocks/cmus diff --git a/.i3-blocks/blocks/countdown b/i3/blocks/countdown index 311a3b7..311a3b7 100755 --- a/.i3-blocks/blocks/countdown +++ b/i3/blocks/countdown diff --git a/.i3-blocks/blocks/cpu b/i3/blocks/cpu index 2cb27ad..2cb27ad 100755 --- a/.i3-blocks/blocks/cpu +++ b/i3/blocks/cpu diff --git a/.i3-blocks/blocks/datetime b/i3/blocks/datetime index 178073f..178073f 100755 --- a/.i3-blocks/blocks/datetime +++ b/i3/blocks/datetime diff --git a/.i3-blocks/blocks/display b/i3/blocks/display index 9071900..9071900 100755 --- a/.i3-blocks/blocks/display +++ b/i3/blocks/display diff --git a/.i3-blocks/blocks/feed b/i3/blocks/feed index 0030939..0030939 100755 --- a/.i3-blocks/blocks/feed +++ b/i3/blocks/feed diff --git a/.i3-blocks/blocks/firewall b/i3/blocks/firewall index 6fe26f6..6fe26f6 100755 --- a/.i3-blocks/blocks/firewall +++ b/i3/blocks/firewall diff --git a/.i3-blocks/blocks/ip-address b/i3/blocks/ip-address index d91ab56..d91ab56 100755 --- a/.i3-blocks/blocks/ip-address +++ b/i3/blocks/ip-address diff --git a/.i3-blocks/blocks/keymap b/i3/blocks/keymap index f25ee98..f25ee98 100755 --- a/.i3-blocks/blocks/keymap +++ b/i3/blocks/keymap diff --git a/.i3-blocks/blocks/keystate b/i3/blocks/keystate index e1543d7..e1543d7 100755 --- a/.i3-blocks/blocks/keystate +++ b/i3/blocks/keystate diff --git a/.i3-blocks/blocks/launcher b/i3/blocks/launcher index 1e39432..1e39432 100755 --- a/.i3-blocks/blocks/launcher +++ b/i3/blocks/launcher diff --git a/.i3-blocks/blocks/load b/i3/blocks/load index 448876f..448876f 100755 --- a/.i3-blocks/blocks/load +++ b/i3/blocks/load diff --git a/.i3-blocks/blocks/locale b/i3/blocks/locale index e517c44..e517c44 100755 --- a/.i3-blocks/blocks/locale +++ b/i3/blocks/locale diff --git a/.i3-blocks/blocks/mail b/i3/blocks/mail index 66b1d0a..66b1d0a 100755 --- a/.i3-blocks/blocks/mail +++ b/i3/blocks/mail diff --git a/.i3-blocks/blocks/memory b/i3/blocks/memory index 866e7c3..866e7c3 100755 --- a/.i3-blocks/blocks/memory +++ b/i3/blocks/memory diff --git a/.i3-blocks/blocks/microphone b/i3/blocks/microphone index 76ff3f9..76ff3f9 100755 --- a/.i3-blocks/blocks/microphone +++ b/i3/blocks/microphone diff --git a/.i3-blocks/blocks/network b/i3/blocks/network index cb06e87..cb06e87 100755 --- a/.i3-blocks/blocks/network +++ b/i3/blocks/network diff --git a/.i3-blocks/blocks/notifier b/i3/blocks/notifier index 35c94f1..35c94f1 100755 --- a/.i3-blocks/blocks/notifier +++ b/i3/blocks/notifier diff --git a/.i3-blocks/blocks/packages b/i3/blocks/packages index 923d479..923d479 100755 --- a/.i3-blocks/blocks/packages +++ b/i3/blocks/packages diff --git a/.i3-blocks/blocks/playerctl b/i3/blocks/playerctl index 6d613ed..6d613ed 100755 --- a/.i3-blocks/blocks/playerctl +++ b/i3/blocks/playerctl diff --git a/.i3-blocks/blocks/process b/i3/blocks/process index 078a241..078a241 100755 --- a/.i3-blocks/blocks/process +++ b/i3/blocks/process diff --git a/.i3-blocks/blocks/scroll b/i3/blocks/scroll index 677a7fc..677a7fc 100755 --- a/.i3-blocks/blocks/scroll +++ b/i3/blocks/scroll diff --git a/.i3-blocks/blocks/space b/i3/blocks/space index 6e78d19..6e78d19 100755 --- a/.i3-blocks/blocks/space +++ b/i3/blocks/space diff --git a/.i3-blocks/blocks/ssid b/i3/blocks/ssid index d95c721..d95c721 100755 --- a/.i3-blocks/blocks/ssid +++ b/i3/blocks/ssid diff --git a/.i3-blocks/blocks/temperature b/i3/blocks/temperature index 0c4b858..0c4b858 100755 --- a/.i3-blocks/blocks/temperature +++ b/i3/blocks/temperature diff --git a/.i3-blocks/blocks/trash b/i3/blocks/trash index b567a54..b567a54 100755 --- a/.i3-blocks/blocks/trash +++ b/i3/blocks/trash diff --git a/.i3-blocks/blocks/usb b/i3/blocks/usb index e294e7d..e294e7d 100755 --- a/.i3-blocks/blocks/usb +++ b/i3/blocks/usb diff --git a/.i3-blocks/blocks/user b/i3/blocks/user index f9391ad..f9391ad 100755 --- a/.i3-blocks/blocks/user +++ b/i3/blocks/user diff --git a/.i3-blocks/blocks/vpn b/i3/blocks/vpn index 8e54938..8e54938 100755 --- a/.i3-blocks/blocks/vpn +++ b/i3/blocks/vpn diff --git a/.i3-blocks/blocks/weather b/i3/blocks/weather index 4eb3efe..4eb3efe 100755 --- a/.i3-blocks/blocks/weather +++ b/i3/blocks/weather diff --git a/.i3-blocks/blocks/webcam b/i3/blocks/webcam index 3c8eae9..3c8eae9 100755 --- a/.i3-blocks/blocks/webcam +++ b/i3/blocks/webcam diff --git a/.i3-blocks/blocks/window b/i3/blocks/window index 9ef155a..9ef155a 100644 --- a/.i3-blocks/blocks/window +++ b/i3/blocks/window diff --git a/vim/.vimrc b/vim/.vimrc new file mode 100644 index 0000000..fde799d --- /dev/null +++ b/vim/.vimrc @@ -0,0 +1,541 @@ +execute pathogen#infect() +autocmd vimenter * NERDTree + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" MiniVim +" Details on : https://github.com/sd65/MiniVim +let g:UseCustomKeyBindings = get(g:, 'UseCustomKeyBindings', "1") +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +""" General options +syntax enable " Enable syntax highlights +set ttyfast " Faster refraw +set mouse=nv " Mouse activated in Normal and Visual Mode +set shortmess+=I " No intro when starting Vim +set smartindent " Smart... indent +set expandtab " Insert spaces instead of tabs +set softtabstop=2 " ... and insert two spaces +set shiftwidth=2 " Indent with two spaces +set incsearch " Search as typing +set hlsearch " Highlight search results +set cursorline " Highligt the cursor line +set showmatch " When a bracket is inserted, briefly jump to the matching one +set matchtime=3 " ... during this time +set virtualedit=onemore " Allow the cursor to move just past the end of the line +set history=100 " Keep 100 undo +set wildmenu " Better command-line completion +set scrolloff=10 " Always keep 10 lines after or before when scrolling +set sidescrolloff=5 " Always keep 5 lines after or before when side scrolling +set noshowmode " Don't display the current mode +set gdefault " The substitute flag g is on +set hidden " Hide the buffer instead of closing when switching +set backspace=indent,eol,start " The normal behaviour of backspace +set showtabline=2 " Always show tabs +set laststatus=2 " Always show status bar +set number " Show the line number +set updatetime=1000 +set ignorecase " Search insensitive +set smartcase " ... but smart +let &showbreak="\u21aa " " Show a left arrow when wrapping text +set encoding=utf-8 " The encoding displayed. +set fileencoding=utf-8 " The encoding written to file. +set synmaxcol=300 " Don't try to highlight long lines +set guioptions-=T " Don't show toolbar in Gvim +set iskeyword+=\- " Complete words containing a dash +" Open all cmd args in new tabs +execute ":silent tab all" + +""" Prevent lag when hitting escape +set ttimeoutlen=0 +set timeoutlen=1000 +au InsertEnter * set timeout +au InsertLeave * set notimeout + +""" When opening a file : - Reopen at last position - Display info +function! GetFileInfo() + let permissions = getfperm(expand('%:p')) + echon &filetype . ", " . GetFileSize() . ", " . permissions +endfunction +function! GetFileSize() + let bytes = getfsize(expand('%:p')) + if bytes <= 0 + return "" + elseif bytes > 1024*1000*1000 + return (bytes / 1024*1000*1000) . "GB" + elseif bytes > 1024*1000 + return (bytes / 1024*1000) . "MB" + elseif bytes > 1024 + return (bytes / 1024) . "KB" + else + return bytes . "B" + endif +endfunction +au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | call GetFileInfo() + +""" Custom backup and swap files +let myVimDir = expand("$HOME/.vim") +let myBackupDir = myVimDir . '/backup' +let mySwapDir = myVimDir . '/swap' +function! EnsureDirExists (dir) + if !isdirectory(a:dir) + call mkdir(a:dir,'p') + endif +endfunction +call EnsureDirExists(myVimDir) +call EnsureDirExists(myBackupDir) +call EnsureDirExists(mySwapDir) +set backup +set backupskip=/tmp/* +set backupext=.bak +let &directory = mySwapDir +let &backupdir = myBackupDir +set writebackup + +""" Smart Paste +let &t_ti .= "\<Esc>[?2004h" +let &t_te .= "\<Esc>[?2004l" +function! XTermPasteBegin(ret) + set pastetoggle=<f29> + set paste + return a:ret +endfunction +execute "set <f28>=\<Esc>[200~" +execute "set <f29>=\<Esc>[201~" +map <expr> <f28> XTermPasteBegin("i") +imap <expr> <f28> XTermPasteBegin("") +vmap <expr> <f28> XTermPasteBegin("c") +cmap <f28> <nop> +cmap <f29> <nop> + +""" Key mappings +if g:UseCustomKeyBindings + +" Helper functions +function! CreateShortcut(keys, cmd, where, ...) + let keys = "<" . a:keys . ">" + if a:where =~ "i" + let i = (index(a:000,"noTrailingIInInsert") > -1) ? "" : "i" + let e = (index(a:000,"noLeadingEscInInsert") > -1) ? "" : "<esc>" + execute "imap " . keys . " " . e . a:cmd . i + endif + if a:where =~ "n" + execute "nmap " . keys . " " . a:cmd + endif + if a:where =~ "v" + let k = (index(a:000,"restoreSelectionAfter") > -1) ? "gv" : "" + let c = a:cmd + if index(a:000,"cmdInVisual") > -1 + let c = ":<C-u>" . strpart(a:cmd,1) + endif + execute "vmap " . keys . " " . c . k + endif +endfunction +function! TabIsEmpty() + return winnr('$') == 1 && len(expand('%')) == 0 && line2byte(line('$') + 1) <= 2 +endfunction +function! MyQuit() + if TabIsEmpty() == 1 + q! + else + if &modified + if (confirm("YOU HAVE UNSAVED CHANGES! Wanna quit anyway?", "&Yes\n&No", 2)==1) + q! + endif + else + q + endif + endif +endfunction +function! MySave() + let cantSave = "echo \"Can't save the file: \" . v:exception | return" + let notSaved = "redraw | echo 'This buffer was NOT saved!' | return" + try + silent w + catch /:E45:\|:E505:\|:E212:/ + if (confirm("This buffer is read only! Wanna save it anyway?", "&Yes\n&No", 2)==1) + try + silent w! + catch /:E212:/ + if (confirm("Can't open the file, do you want to save it as root?", "&Yes\n&No", 2)==1) + try + w !sudo tee % > /dev/null + edit! + catch + exe cantSave + endtry + else + exe notSaved + endif + catch + exe cantSave + endtry + else + exe notSaved + endif + catch /:E32:/ + if (confirm("This buffer has no file to be saved in! Wanna choose it?", "&Yes\n&No", 2)==1) + call feedkeys("\<Esc>:w ") + else + exe notSaved + endif + catch + exe cantSave + endtry + let time = strftime("%T") + let file = expand('%:p') + let permissions = getfperm(file) + echom file . " saved at " . time | redraw + echohl iGreen | echon " SAVED " + echohl Green | echon " " . GetFileSize() . ", " . time . ", " . permissions + echohl None +endfunction +function! OpenLastBufferInNewTab() + redir => ls_output + silent exec 'ls' + redir END + let ListBuffers = reverse(split(ls_output, "\n")) + for line in ListBuffers + let title = split(line, "\"")[1] + if title !~ "\[No Name" + execute "tabnew +" . split(line, " ")[0] . "buf" + break + endif + endfor +endfunction +function! ToggleColorColumn() + if &colorcolumn != 0 + windo let &colorcolumn = 0 + else + windo let &colorcolumn = 80 + endif +endfunction +function! MyPasteToggle() + set invpaste + echo "Paste" (&paste) ? "On" : "Off" +endfunction +function! OpenNetrw() + if TabIsEmpty() == 1 + Explore + else + Texplore + endif +endfunction +function! MenuNetrw() + let c = input("What to you want to do? (M)ake a dir, Make a (F)ile, (R)ename, (D)elete : ") + if (c == "m" || c == "M") + normal d + elseif (c == "f" || c == "F") + normal % + elseif (c == "r" || c == "R") + normal R + elseif (c == "d" || c == "D") + normal D + endif +endfunction + +" Usefull shortcuts to enter insert mode +nnoremap <CR> i<CR> +nnoremap <Backspace> i<Backspace> +nnoremap <Space> i<Space> + +" Ctrl A - Begin Line +call CreateShortcut("C-a", "0", "inv") + +" Ctrl E - End Line +call CreateShortcut("C-e", "$l", "inv") + +" Ctrl S - Save +call CreateShortcut("C-s", ":call MySave()<CR>", "nv", "cmdInVisual", "restoreSelectionAfter") +call CreateShortcut("C-s", ":call MySave()<CR>i<Right>", "i", "noTrailingIInInsert") + +" Home - Go To Begin +call CreateShortcut("Home", "gg", "inv") + +" End - Go To End +call CreateShortcut("End", "G", "inv") + +" Ctrl K - Delete Line +call CreateShortcut("C-k", "dd", "in") +call CreateShortcut("C-k", "d", "v") + +" Ctrl Q - Duplicate Line +call CreateShortcut("C-q", "mjyyp`jjl", "i") +call CreateShortcut("C-q", "mjyyp`jj", "n") +call CreateShortcut("C-q", "y`]p", "v") + +" Ctrl Down - Pagedown +call CreateShortcut("C-Down", "15j", "inv") + +" Ctrl Up - Pageup +call CreateShortcut("C-Up", "15k", "inv") + +" Ctrl Right - Next Word +call CreateShortcut("C-Right", "w", "nv") + +" Ctrl Left - Previous Word +call CreateShortcut("C-Left", "b", "nv") + +" Ctrl F - Find +call CreateShortcut("C-f", "/", "in", "noTrailingIInInsert") + +" Ctrl H - Search and Replace +call CreateShortcut("C-h", ":%s/", "in", "noTrailingIInInsert") + +" Ctrl G - Search and Replace on the line only +call CreateShortcut("C-g", ":s/", "in", "noTrailingIInInsert") + +" Ctrl L - Delete all lines +call CreateShortcut("C-l", "ggdG", "in") + +" Pageup - Move up Line +call CreateShortcut("PageUp", ":m-2<CR>", "in") +call CreateShortcut("PageUp", "dkP", "v") + +" Pagedown - Move down Line +call CreateShortcut("PageDown", ":m+<CR>", "in") +call CreateShortcut("PageDown", "dp", "v") + +" Ctrl C - Quit +call CreateShortcut("C-c", ":call MyQuit()<CR>", "inv", "cmdInVisual") + +" Tab - Indent +call CreateShortcut("Tab", ">>", "n") +call CreateShortcut("Tab", ">", "v", "restoreSelectionAfter") + +" Shift Tab - UnIndent +call CreateShortcut("S-Tab", "<<", "in") +call CreateShortcut("S-Tab", "<", "v", "restoreSelectionAfter") + +" Ctrl Z - Undo +call CreateShortcut("C-z", "u", "in") + +" Ctrl R - Redo +call CreateShortcut("C-r", "<C-r>", "in") + +" Ctrl D - Suppr (the key) +call CreateShortcut("C-d", "<del>", "iv", "noLeadingEscInInsert", "noTrailingIInInsert") +call CreateShortcut("C-d", "x", "n") + +" Ctrl T - New tab +call CreateShortcut("C-t", ":tabnew<CR>i", "inv", "noTrailingIInInsert", "cmdInVisual") + +" Alt Right - Next tab +call CreateShortcut("A-Right", "gt", "inv") + +" Alt Left - Previous tab +call CreateShortcut("A-Left", "gT", "inv") + +" F2 - Paste toggle +call CreateShortcut("f2",":call MyPasteToggle()<CR>", "n") + +" F3 - Line numbers toggle +call CreateShortcut("f3",":set nonumber!<CR>", "in") + +" F4 - Panic Button +call CreateShortcut("f4","mzggg?G`z", "inv") + +" F6 - Toggle color column at 80th char +call CreateShortcut("f6",":call ToggleColorColumn()<CR>", "inv") + +" Ctrl O - Netrw (:Explore) +call CreateShortcut("C-o",":call OpenNetrw()<CR>", "inv", "noTrailingIInInsert", "cmdInVisual") +let g:netrw_banner=0 " Hide banner +let g:netrw_list_hide='\(^\|\s\s\)\zs\.\S\+' " Hide hidden files +autocmd FileType netrw call KeysInNetrw() +function! KeysInNetrw() + " Right to enter + nmap <buffer> <Right> <CR> + " Left to go up + nmap <buffer> <Left> - + " l - Display info + nmap <buffer> l qf + " n - Menu + nmap <buffer> n :call MenuNetrw()<CR> +endfunction + +endif " End custom key bindings + +""" Custom commands + +" :UndoCloseTab - To undo close tab +command! UndoCloseTab call OpenLastBufferInNewTab() + +" :RemoveTrailingSpaces - To remove unwanted space(s) at the end of lines +command! RemoveTrailingSpaces %s/\s\+$ + +""" Colors and Statusline + +let defaultAccentColor=161 +let colorsAndModes= { + \ 'i' : 39, + \ 'v' : 82, + \ 'V' : 226, + \ '' : 208, +\} +let defaultAccentColorGui='#d7005f' +let colorsAndModesGui= { + \ 'i' : '#00afff', + \ 'v' : '#5fff00', + \ 'V' : '#ffff00', + \ '' : '#ff8700', +\} +function! ChangeAccentColor() + let accentColor=get(g:colorsAndModes, mode(), g:defaultAccentColor) + let accentColorGui=get(g:colorsAndModesGui, mode(), g:defaultAccentColorGui) + execute 'hi User1 ctermfg=0 guifg=#000000 ctermbg=' . accentColor . ' guibg=' . accentColorGui + execute 'hi User2 ctermbg=0 guibg=#2e3436 ctermfg=' . accentColor . ' guifg=' . accentColorGui + execute 'hi User3 ctermfg=0 guifg=#000000 cterm=bold gui=bold ctermbg=' . accentColor . ' guibg=' . accentColorGui + execute 'hi TabLineSel ctermfg=0 cterm=bold ctermbg=' . accentColor + execute 'hi TabLine ctermbg=0 ctermfg=' . accentColor + execute 'hi CursorLineNr ctermfg=' . accentColor . ' guifg=' . accentColorGui + return '' +endfunction +function! ReadOnly() + return (&readonly || !&modifiable) ? 'Read Only ' : '' +endfunction +function! Modified() + return (&modified) ? 'Modified' : 'Not modified' +endfunction +let g:currentmode={ + \ 'n' : 'Normal', + \ 'no' : 'N·Operator Pending', + \ 'v' : 'Visual', + \ 'V' : 'V·Line', + \ '' : 'V·Block', + \ 's' : 'Select', + \ 'S' : 'S·Line', + \ '^S' : 'S·Block', + \ 'i' : 'Insert', + \ 'R' : 'Replace', + \ 'Rv' : 'VReplace', + \ 'c' : 'Command', + \ 'cv' : 'Vim Ex', + \ 'ce' : 'Ex', + \ 'r' : 'Prompt', + \ 'rm' : 'More', + \ 'r?' : 'Confirm', + \ '!' : 'Shell', + \ 't' : 'Terminal', +\} +set statusline= +set statusline+=%{ChangeAccentColor()} +set statusline+=%1*\ ***%{toupper(g:currentmode[mode()])}***\ " Current mode +set statusline+=%2*\ %<%F\ " Filepath +set statusline+=%2*\ %= " To the right +set statusline+=%2*\ %{toupper((&fenc!=''?&fenc:&enc))}\[%{&ff}] " Encoding & Fileformat +set statusline+=%2*\ %{Modified()}\ %{ReadOnly()} " Flags +set statusline+=%1*\ \%l/%L(%P)-%c\ " Position +" Speed up the redraw +au InsertLeave * call ChangeAccentColor() +au CursorHold * let &ro = &ro + +"""" Color Scheme + +"" Placed here for convenience. +"" Copied from sickill Monokai on Github, +"" and slightly modified. + +set background=dark +highlight clear +syntax reset +set t_Co=256 +hi Green ctermfg=34 ctermbg=NONE cterm=NONE guifg=#00af00 guibg=NONE gui=NONE +hi iGreen ctermfg=0 ctermbg=34 cterm=NONE guifg=#000000 guibg=#00af00 gui=NONE +hi Cursor ctermfg=235 ctermbg=231 cterm=NONE guifg=#272822 guibg=#f8f8f0 gui=NONE +hi Visual ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#49483e gui=NONE +hi CursorLine ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE +hi CursorColumn ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE +hi ColorColumn ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE +hi LineNr ctermfg=102 ctermbg=237 cterm=NONE guifg=#90908a guibg=#3c3d37 gui=NONE +hi VertSplit ctermfg=241 ctermbg=241 cterm=NONE guifg=#64645e guibg=#64645e gui=NONE +hi MatchParen ctermfg=197 ctermbg=NONE cterm=underline guifg=#f92672 guibg=NONE gui=underline +hi StatusLine ctermfg=231 ctermbg=241 cterm=bold guifg=#f8f8f2 guibg=#64645e gui=bold +hi StatusLineNC ctermfg=231 ctermbg=241 cterm=NONE guifg=#f8f8f2 guibg=#64645e gui=NONE +hi Pmenu ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi PmenuSel ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#49483e gui=NONE +hi IncSearch ctermfg=235 ctermbg=186 cterm=NONE guifg=#272822 guibg=#e6db74 gui=NONE +hi Search ctermfg=NONE ctermbg=NONE cterm=underline guifg=NONE guibg=NONE gui=underline +hi Directory ctermfg=161 ctermbg=NONE cterm=NONE guifg=#d7005f guibg=NONE gui=NONE +hi Folded ctermfg=242 ctermbg=235 cterm=NONE guifg=#75715e guibg=#272822 gui=NONE +hi SignColumn ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE +hi Normal ctermfg=231 ctermbg=235 cterm=NONE guifg=#f8f8f2 guibg=#272822 gui=NONE +hi Boolean ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE +hi Character ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE +hi Comment ctermfg=242 ctermbg=NONE cterm=NONE guifg=#75715e guibg=NONE gui=NONE +hi Conditional ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi Constant ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi Define ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi DiffAdd ctermfg=231 ctermbg=64 cterm=bold guifg=#f8f8f2 guibg=#46830c gui=bold +hi DiffDelete ctermfg=88 ctermbg=NONE cterm=NONE guifg=#8b0807 guibg=NONE gui=NONE +hi DiffChange ctermfg=NONE ctermbg=NONE cterm=NONE guifg=#f8f8f2 guibg=#243955 gui=NONE +hi DiffText ctermfg=231 ctermbg=24 cterm=bold guifg=#f8f8f2 guibg=#204a87 gui=bold +hi ErrorMsg ctermfg=231 ctermbg=197 cterm=NONE guifg=#f8f8f0 guibg=#f92672 gui=NONE +hi WarningMsg ctermfg=231 ctermbg=197 cterm=NONE guifg=#f8f8f0 guibg=#f92672 gui=NONE +hi Float ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE +hi Function ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE +hi Identifier ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic +hi Keyword ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi Label ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE +hi NonText ctermfg=59 ctermbg=236 cterm=NONE guifg=#49483e guibg=#31322c gui=NONE +hi Number ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE +hi Operator ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi PreProc ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi Special ctermfg=231 ctermbg=NONE cterm=NONE guifg=#f8f8f2 guibg=NONE gui=NONE +hi SpecialKey ctermfg=59 ctermbg=237 cterm=NONE guifg=#49483e guibg=#3c3d37 gui=NONE +hi Statement ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi StorageClass ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic +hi String ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE +hi Tag ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi Title ctermfg=231 ctermbg=NONE cterm=bold guifg=#f8f8f2 guibg=NONE gui=bold +hi Todo ctermfg=95 ctermbg=NONE cterm=inverse,bold guifg=#75715e guibg=NONE gui=inverse,bold +hi Type ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline guifg=NONE guibg=NONE gui=underline +hi rubyClass ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi rubyFunction ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE +hi rubyInterpolationDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi rubySymbol ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE +hi rubyConstant ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic +hi rubyStringDelimiter ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE +hi rubyBlockParameter ctermfg=208 ctermbg=NONE cterm=NONE guifg=#fd971f guibg=NONE gui=italic +hi rubyInstanceVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi rubyInclude ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi rubyGlobalVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi rubyRegexp ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE +hi rubyRegexpDelimiter ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE +hi rubyEscape ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE +hi rubyControl ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi rubyClassVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi rubyOperator ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi rubyException ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi rubyPseudoVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi rubyRailsUserClass ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic +hi rubyRailsARAssociationMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE +hi rubyRailsARMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE +hi rubyRailsRenderMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE +hi rubyRailsMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE +hi erubyDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi erubyComment ctermfg=95 ctermbg=NONE cterm=NONE guifg=#75715e guibg=NONE gui=NONE +hi erubyRailsMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE +hi htmlTag ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi htmlEndTag ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi htmlTagName ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi htmlArg ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi htmlSpecialChar ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE +hi javaScriptFunction ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic +hi javaScriptRailsFunction ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE +hi javaScriptBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi yamlKey ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE +hi yamlAnchor ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi yamlAlias ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi yamlDocumentHeader ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE +hi cssURL ctermfg=208 ctermbg=NONE cterm=NONE guifg=#fd971f guibg=NONE gui=italic +hi cssFunctionName ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE +hi cssColor ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE +hi cssPseudoClassId ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE +hi cssClassName ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE +hi cssValueLength ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE +hi cssCommonAttr ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE +hi cssBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE +hi TabLineFill cterm=bold ctermbg=0 +" Final redraw +call ChangeAccentColor() |