" vim: filetype=vim " ============================== " Universal (Works on any OS... probably) Configuration " ============================== " ----- Vim Initial Config set encoding=utf-8 set hls set number relativenumber set ignorecase set smartcase set mouse=a set background=dark " set complete+=kspell " set completeopt=menuone,longest " set list lcs=trail:·,tab:··\|,nbsp:· hi VertSplit cterm=NONE ctermbg=0 ctermfg=0 hi NonText ctermfg=0 hi Folded ctermfg=White hi Folded ctermbg=Black " hi! EndOfBuffer ctermbg=NONE ctermfg=8 set fillchars=eob:\ syntax on filetype indent plugin on map :NERDTreeToggle let mapleader=" " " ----- Folding stuff set foldnestmax=10 " don't fold by default set nofoldenable set foldlevel=1 " python autocmd FileType python setlocal foldmethod=indent " ----- Mapping " Norm but in shortcut vnoremap . :normal . " Map ctrl + u as U noremap U " Map U as redo (ctrl + r) noremap U " Yank and Put to/from clipboard/primary noremap "+y noremap "+p noremap "+y noremap "+P " Shortcut to comment a line " means ctrl+/ for vim, for some reason... map gcc vmap gc imap gc " Clear last search result map c :noh " TwiddleCase function! TwiddleCase(str) if a:str ==# toupper(a:str) let result = tolower(a:str) elseif a:str ==# tolower(a:str) let result = substitute(a:str,'\(\<\w\+\>\)', '\u\1', 'g') else let result = toupper(a:str) endif return result endfunction vnoremap ~ y:call setreg('', TwiddleCase(@"), getregtype(''))gv""Pgv " ----- 'vim -b' = edit binary using xxd-format! augroup Binary au! au BufReadPre *.bin let &bin=1 au BufReadPost *.bin if &bin | %!xxd au BufReadPost *.bin set ft=xxd | endif au BufWritePre *.bin if &bin | %!xxd -r au BufWritePre *.bin endif au BufWritePost *.bin if &bin | %!xxd au BufWritePost *.bin set nomod | endif augroup END " ----- indent for corresponding extension autocmd BufEnter *.py set ai sw=4 ts=4 sta et fo=croql " in C files, tabs looks like 4 spaces, but it's actually tabs autocmd BufEnter *.c set ai sw=4 ts=4 sta noet fo=croql autocmd BufEnter *.md set ai sw=3 ts=3 sta et fo=croql autocmd Filetype html set ai sw=4 ts=4 sta et fo=croql autocmd Filetype css set ai sw=4 ts=4 sta et fo=croql autocmd Filetype javascript set ai sw=4 ts=4 sta et fo=croql autocmd Filetype vue set ai sw=4 ts=4 sta et fo=croql " ----- Auto refresh vimrc augroup myvimrc au! au BufWritePost vimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif au BufWritePost vim_nix so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif au BufWritePost vim_plug so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif au BufWritePost vim_uni so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif au BufWritePost vim_win so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif augroup END " ----- Discord Rich Presences API let g:vimsence_client_id = '733622032901603388' let g:vimsence_small_text = 'Neovim' let g:vimsence_small_image = 'nvim' " let g:vimsence_large_image = 'ts' let g:vimsence_editing_details = 'Editing {}' let g:vimsence_editing_state = 'Workspace: {}' let g:vimsence_file_explorer_text = 'In NERDTree' let g:vimsence_file_explorer_details = 'Looking for files' " Split opens at the bottom and right set splitbelow splitright " Split navigation shortcuts map h map j map k map l " Complete menu mappings " Up and Down act like ctrl+p and ctrl+n inoremap pumvisible() ? "" : "" inoremap pumvisible() ? "" : "" " Enter to complete inoremap pumvisible() ? "" : "" " Left or Right to cancel " inoremap pumvisible() ? "" : "" " inoremap pumvisible() ? "" : "" " Tab act like ctrl+p and ctrl+n inoremap pumvisible() ? "" : "" inoremap pumvisible() ? "" : ""