Last active
June 13, 2022 21:10
-
-
Save plicatibu/aa0e6322f1d3c7b936f1ca63c9d04006 to your computer and use it in GitHub Desktop.
My current .vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vim: set foldmarker={,} foldlevel=1 foldmethod=marker spell ft=vim: | |
" Márcio Andrey Oliveira's .vimrc File | |
" | |
" "zo" to open folds, "zc" to close, "zn" to disable. | |
" | |
" Last modified: Mon Jun 13, 2022 06:03PM | |
" Clear all autocommands | |
" {{{ Clear all autocommands | |
autocmd! | |
" }}} | |
" What OS is Vim running on? { | |
let myos = "" | |
if has("win32") || has("win64") | |
let myos = "mswindows" | |
elseif has("win32unix") | |
let myos = "cygwin" | |
elseif has("macunix") || has("osxdarwin") | |
let myos = "macos" | |
elseif has("linux") | |
let myos = "linux" | |
elseif has("unix") | |
let myos = "linux" | |
endif | |
" } | |
" General { | |
" How many lines of history to remember | |
set history=1000 | |
" maximum number of changes that can be undone | |
set undolevels=1000 | |
" support all three, in this order | |
" none of these should be word dividers, so make them not be | |
set iskeyword+=_,$,@,%,# | |
" Encoding {{ | |
"""set termencoding=utf-8 | |
"""set encoding=utf-8 | |
" scriptencoding must be AFTER encoding | |
scriptencoding utf-8 | |
" }} | |
set number | |
set completeopt=menu | |
set nowrap | |
" give as 5 lines of context at the top of the screen. | |
set scrolloff=5 | |
" turn on colouring syntax | |
syntax on | |
" Mouse {{ | |
" Use mouse to select and resize windows, etc. | |
if has('mouse') | |
set mouse=v " Enable mouse in several mode | |
set mousemodel=popup " Set the behaviour of mouse | |
endif | |
" }} | |
" Clipboard {{ | |
if has("clipboard") | |
set clipboard+=unnamed | |
" Enable clipboard sharing between Vim and Windows | |
set clipboard+=unnamedplus | |
endif | |
" }} | |
" Draws a vertical line in the cursor column | |
set colorcolumn=0 | |
" Give more space for displaying messages | |
set cmdheight=2 | |
" Create the vertical splits to the right side | |
set splitright | |
" Create the vertical splits to the below side | |
"set splitbelow | |
" Time in milliseconds to wait for a mapped sequence to complete, | |
" see https://unix.stackexchange.com/q/36882/221410 for more info | |
set timeoutlen=500 | |
" For CursorHold events | |
set updatetime=800 | |
" } | |
" Files { | |
" File and script encoding settings {{ | |
set fileencoding=utf-8 | |
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 | |
" }} | |
if g:myos == "mswindows" | |
set fileformats=dos,unix | |
else | |
set fileformats=unix,dos | |
endif | |
" Backup {{ | |
" Do not make backup file | |
set nobackup | |
" Do not make backup file | |
set nowritebackup | |
" }} | |
" Which directory to use for the file browser | |
set browsedir =current | |
" When using make, where should it dump the file | |
set makeef=error.err | |
" What should be saved during sessions being saved | |
set sessionoptions+=options | |
" Finding files | |
set path+=** | |
" Display all matching files when we tab complete | |
set wildmenu | |
" Reediting files {{ | |
" Vim will hold cursor position and command line history | |
"set viminfo='10,\"30,:40,%,n~/.viminfo | |
autocmd BufReadPost * if line("'\"")|execute("normal `\"")|endif | |
" }} | |
" Globbing {{ | |
" Ignore certain files and folders when globbing | |
if has("wildignore") | |
set wildignore+=*.o,*.obj,*.bin,*.dll,*.exe | |
set wildignore+=*.so,*.dylib | |
set wildignore+=*/.git/*,*/.svn/*,*/.hg/*,*/.bzr/*,*/__pycache__/*,*/build/** | |
set wildignore+=*.pyc,*.pyo,*.pyd,*/env,*/_pycache,*/git | |
set wildignore+=*.DS_Store,*/__MACOSX/* | |
set wildignore+=*.aux,*.bbl,*.blg,*.brf,*.fls,*.fdb_latexmk,*.synctex.gz,*.pdf | |
" NOW WE CAN: | |
" - Hit tab to :find by partial match | |
" - Use * to make it fuzzy | |
" THINGS TO CONSIDER: | |
" - :b lets you autocomplete any open buffer | |
endif | |
" File Browsing {{ | |
" disable annoying banner | |
let g:netrw_banner=0 | |
" open in prior window | |
let g:netrw_browser_split=4 | |
" open splits to the right | |
let g:netrw_altv=1 | |
" tree view | |
let g:netrw_liststyle=3 | |
" hide gitignore'd files | |
"let g:netrw_list_hide=netrw_gitignore#Hide() | |
" hide dotfiles by default (this is the string toggled by netrw-gh) | |
"let g:netrw_list_hide.=',\(^\|\s\s\)\zs.\S\+' | |
" NOW WE CAN | |
" - :edit a folder to open a file browser | |
" - <CR>/v/t to open in a h-split/v-split/tab | |
" - check | netrw-browse-maps| for more mappings | |
" }} | |
" }} | |
" } | |
" Information on the screen { | |
" Title of the window {{ | |
" Show hostname, full path of file and last-mod time on the window title. The | |
" meaning of the format str for strftime can be found in | |
" http://man7.org/linux/man-pages/man3/strftime.3.html. The function to get | |
" lastmod time is drawn from https://stackoverflow.com/q/8426736/6064933 | |
" NOTE: It only works locally. For remote sessions, it doesn't. | |
set title | |
set titlestring= | |
set titlestring+=%(%{hostname()}\ \ %) | |
set titlestring+=%(%{expand('%:p')}\ \ %) | |
set titlestring+=%{strftime('%Y-%m-%d\ %H:%M',getftime(expand('%')))} | |
" }} | |
" Status line {{ | |
" display the current mode (on by default on Vim) | |
set showmode | |
if has('statusline') | |
" laststatus behaviour | |
" 0: never | |
" 1: only if there are at least two windows | |
" 2: always | |
set laststatus=2 | |
highlight NormalColor guifg=LightBlue guibg=Black ctermbg=LightBlue ctermfg=Black | |
highlight InsertColor guifg=Yellow guibg=Black ctermbg=Yellow ctermfg=Black | |
highlight ReplaceColor guifg=Red guibg=Black ctermbg=Red ctermfg=Black | |
highlight VisualColor guifg=Blue guibg=Black ctermbg=Blue ctermfg=Black | |
highlight StatusColor guifg=White guibg=Black ctermbg=White ctermfg=Black | |
" default the statusline to green when entering Vim | |
"hi StatusLine ctermbg=Black ctermfg=White | |
highlight StatusLine ctermbg=Black ctermfg=White | |
augroup statusline | |
autocmd! | |
autocmd CmdlineEnter * redrawstatus | |
augroup END | |
" Status Line Custom | |
" Broken down into easily includeable segments | |
set statusline=%#NormalColor#%{(mode()=='n')?'\ \ NORMAL\ ':''} | |
set statusline+=%#InsertColor#%{(mode()=='i')?'\ \ INSERT\ ':''} | |
set statusline+=%#ReplaceColor#%{(mode()=='R')?'\ \ REPLACE\ ':''} | |
set statusline+=%#VisualColor#%{(mode()=='v')?'\ \ VISUAL\ ':''} | |
set statusline+=%#StatusColo#%{''} | |
" Buffer number | |
set statusline+=\ [%n] | |
" full path to to the file in the buffer. | |
set statusline+=\ [%F] | |
" w = preview window, h = help window, m = modified file / modifiable off, r = read only file. | |
set statusline+=%w%h%m%r | |
" Git Hotness | |
"set statusline+=%{fugitive#statusline()} | |
" file format (dos, unix, mac) | |
set statusline+=\ [%{&ff}/%Y] | |
" current dir | |
set statusline+=\ [%{getcwd()}] | |
"display a warning if file encoding isnt utf-8 | |
set statusline+=%#warningmsg# | |
set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''} | |
set statusline+=%* | |
" Right aligned file nav info | |
set statusline+=%=%-14.(%l,%c%V%)\ %p%% | |
" Right aligned file nav info | |
"set statusline+=%=%-14.(%l,%c%) | |
endif | |
" }} | |
" default the statusline to green when entering Vim | |
"hi StatusLine term=reverse ctermbg=Black ctermfg=White | |
"hi StatusLine ctermbg=Black ctermfg=White | |
" } | |
" Text Formatting/Layout, search options and highlight { | |
" See Help (complex) | |
" formatoptions: | |
" t Auto-wrap text using textwidth | |
" c Auto-wrap comments using textwidth, inserting the current comment leader automatically. | |
" r Automatically insert the current comment leader after hitting <Enter> in Insert mode. | |
" q Allow formatting of comments with "gq". | |
" Note that formatting will not change blank lines or lines containing | |
" only the comment leader. A new paragraph starts after such a line, | |
" or when the comment leader changes. | |
" o Automatically insert the current comment leader after hitting 'o' or 'O' in Normal mode. | |
" | |
" Automacti comment on newline | |
"set formatoptions=tcrq | |
" Disables automatic commenting on newline: | |
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |
" Correctly break multi-byte characters such as CJK, | |
" see https://stackoverflow.com/q/32669814/6064933 | |
set formatoptions+=mM | |
" ShowMatch: show matching parenthesis. | |
set showmatch | |
" Align indent to next multiple value of shiftwidth. For its meaning, | |
" see http://vim.1045645.n5.nabble.com/shiftround-option-td5712100.html | |
" Eg.: when at 3 spaces, and I hit > ... go to 4, not 5 | |
set shiftround | |
" but above all -- follow the conventions laid before us | |
set preserveindent | |
" improve the way autocomplete works | |
set completeopt=menu,longest,preview | |
" show the current column | |
"set cursorcolumn | |
" draw a horizontal line to indicate current position of the cursor | |
set cursorline | |
" number of visual spaces per TAB | |
set tabstop=4 | |
" number of spaces in tab when editing | |
" set softtabstop=4 | |
" Amount of columns for autoindent / the command ">" (ShiftWidth) | |
set shiftwidth=4 | |
" replace tabs by spaces | |
set expandtab | |
" Search {{ | |
" IncrementedSearch, HighLightedSearch, IgnoreCase, SmartCaSe | |
" smart search options | |
set incsearch hlsearch ignorecase smartcase magic | |
" }} | |
" } | |
" Hiddes the current buffer when a new file is openned. | |
set hidden | |
set autoindent | |
set report=0 | |
" show the current position of the cursor in the ruler | |
set ruler | |
" Show command being executed | |
"set showcmd | |
" disable break lines | |
set textwidth=0 | |
" backspace behaviour | |
" 0 same as ":set backspace=" (Vi compatible) | |
" 1 same as ":set backspace=indent,eol" | |
" 2 same as ":set backspace=indent,eol,start" | |
" 3 same as ":set backspace=indent,eol,nostop" | |
set backspace=indent,eol,start | |
" set nosmartindent | |
" blink the screen on errors. | |
set visualbell | |
" Do not add two spaces after a period when joining lines or formatting texts ("gq"), | |
" see https://stackoverflow.com/q/4760428/6064933 | |
set nojoinspaces | |
" autocomplete like the one bash provides. | |
set wildmode=longest,list:full | |
" Folding { | |
"" set foldmethod=indent | |
" set foldclose=all | |
" how folder should work | |
" } | |
" Diff { | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" vimdiff options: | |
" filler: Insert vertical spaces to keep text aligned. | |
" horizontal: open windows horizontally so it won't be | |
" necessary to use argument "-o" on command line. | |
" It is excelent for long lines. | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" set diffopt=filler,horizontal | |
set diffopt=filler,vertical,internal,algorithm:patience | |
if &diff | |
" Delete an entry on a DIFF file | |
"map ,di :.,/diff -[uNr]/-d<cr> | |
endif | |
" } | |
" Colors { | |
"""hi Search ctermbg=green ctermfg=black | |
"""hi IncSearch ctermbg=black ctermfg=cyan | |
" bg MUST be BEFORE terminfo | |
set background=dark | |
"if has("terminfo") | |
" set t_Co=8 | |
" set t_Sf=[3%p1%dm | |
" set t_Sb=[4%p1%dm | |
"else | |
" set t_Co=8 | |
" set t_Sf=[3%dm | |
" set t_Sb=[4%dm | |
"endif | |
" } | |
" File-type specific settings { | |
if has("autocmd") | |
" Enabled file type detection and file-type specific plugins. | |
" filetype plugin on indent | |
filetype plugin on | |
" automatically highlight these words in all open files | |
syntax case ignore | |
syntax keyword p_c error | |
syntax keyword p_c exception | |
syntax keyword p_c fatal | |
highlight p_c ctermbg=white ctermfg=black | |
" .sh files always are bash | |
autocmd FileType sh let b:is_bash=1 | |
" Python: TAB colorido e outras configuracoes | |
augroup python | |
autocmd FileType python set tabstop=4 textwidth=80 expandtab | |
autocmd FileType python syntax match pythonTAB '\t\+' | |
autocmd FileType python highlight pythonTAB ctermbg=blue | |
autocmd FileType python highlight pythonString ctermfg=lightgreen | |
autocmd FileType python highlight pythonRawString ctermfg=lightgreen | |
"autocmd FileType Python set tags+=$HOME/.vim/tags/python.ctags | |
augroup END | |
augroup cprog | |
autocmd FileType c,cpp,cc,h,hh,c++ set tabstop=4 textwidth=80 expandtab | |
autocmd FileType c,cpp,cc,h,hh,c++ syntax match cprogTAB '\t\+' | |
autocmd FileType c,cpp,cc,h,hh highlight cprogTAB ctermbg=blue | |
augroup END | |
augroup .vimrc | |
autocmd FileType python set tabstop=4 textwidth=80 expandtab | |
autocmd FileType python syntax match pythonTAB '\t\+' | |
augroup END | |
" Mail: | |
autocmd FileType Mail set fo=ctq textwidth=65 expandtab | |
" Man: Man pages are actually NROFF texts | |
autocmd BufNewFile,BufRead *.man set ft=nroff | |
" TXT: Arquivos texto tem tratamento especial | |
autocmd BufNewFile,BufRead *.txt set textwidth=75 tabstop=8 | |
" Remove trailing spaces when saving some files | |
" autocmd BufWritePre *.c,*.cc,*.cpp,*.go,*.h,*.htm,*.html,*.java,*.js,*.org,*.php,*.py,*.rs,*.txt,*.vim :call <SID>StripTrailingWhitespaces() | |
" autocmd BufWritePre *.c,*.cc,*.cpp,*.c++,*.go,*.h,*.hh,*.htm,*.html,*.java,*.js,*.org,*.php,*.py,*.rs,*.sh,*.txt,*.vim :call <SID>StripTrailingWhitespaces() | |
autocmd FileType css,scss,sass setlocal iskeyword+=- | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Let's run some checks whenever possible. | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Check nginx.conf every time a file has changed inside /etc/nginx/ folder. | |
autocmd! BufWritePost /etc/nginx/* :! nginx -t | |
" Check apache.conf every time a file has changed inside /etc/apache2/ folder. | |
autocmd! BufWritePost /etc/apache2/* :! apachectl -t | |
" Check full_config.json (and full_config.* files, like the local version generated in ansible CHROOT. | |
autocmd! BufWritePost full_config.* :! /opt/axtract/bin/check_config % | |
" autocmd! BufWrite *.sh : ShellCheck(b:shellcheck, %) | |
" Check *.sh on save. | |
autocmd! BufWritePost *.sh call ShellCheck(shellcheck, expand('%:p')) | |
" ................................................................. | |
" Highlight word under cursor | |
autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() | |
" ................................................................. | |
" Update the last modified date (only on my machines) | |
if myos == "mswindows" || myos == "cygwin" | |
autocmd BufWritePre * call LastModified() | |
endif | |
" ................................................................. | |
" $VIMRC: Automatically reload it when changes are saved. | |
autocmd! BufWritePost $MYVIMRC source $MYVIMRC | echom "Reloaded $NVIMRC" | |
endif | |
" } | |
"......................................................................... | |
" Show trailing white spaces. | |
syn match trailingwhithespaces '\s\+$' | highlight trailingwhithespaces ctermbg=Red | |
" Here I set all tags I'm using | |
set tags+=$HOME/.vim/tags/python.ctags | |
" TODO Test color scheme. | |
" set current color scheme | |
"colorscheme github | |
"if &diff | |
" " use a slightly darker background, like GitHub inline code blocks | |
" " let g:github_colors_soft = 1 | |
" " more blocky diff markers in signcolumn (e.g. GitGutter) | |
" " let g:github_colors_block_diffmark = 0 | |
" colorscheme github | |
"endif | |
" Functions { | |
let s:activatedh = 0 | |
function! ToggleH() | |
if s:activatedh == 0 | |
let s:activatedh = 1 | |
match Search '\%>80v.\+' | |
else | |
let s:activatedh = 0 | |
match none | |
endif | |
endfunction | |
" Check shell script syntax | |
"let shellcheck = '/usr/bin/shellcheck' | |
let shellcheck = '/c/ProgramData/chocolatey/bin/shellcheck' | |
function! ShellCheck(shellcheck, scriptname) | |
echom "path: " . a:shellcheck | |
echom "script name: " . a:scriptname | |
echom "file exits? " . filereadable(a:shellcheck) | |
if filereadable(a:shellcheck) | |
echom "Calling " . a:shellcheck . " -x " . a:scriptname | |
"execute ':! clear ; /usr/bin/shellcheck -x a:scriptname<CR>' | |
let mycmd = ":! " . a:shellcheck . " " . a:scriptname | |
echom "mycmd: " . mycmd | |
execute mycmd | |
echom "result: " . v:shell_error | |
echom "" | |
else | |
echom "shellcheck is NOT installed" | |
echom "" | |
endif | |
endfunction | |
function! HighlightWordUnderCursor() abort | |
if getline(".")[col(".")-1] !~# '[[:punct:][:blank:]]' | |
exec 'match' 'Search' '/\V\<'.expand('<cword>').'\>/' | |
else | |
match none | |
endif | |
endfunction | |
" https://vim.fandom.com/wiki/Insert_current_date_or_time | |
" If buffer modified, update any 'Last modified: ' in the first 20 lines. | |
" 'Last modified: ' can have up to 10 characters before (they are retained). | |
" Restores cursor and window position using save_cursor variable. | |
function! LastModified() | |
if &modified | |
let save_cursor = getpos(".") | |
let n = min([20, line("$")]) | |
" keepjumps excludes timestamp position from jump list, which is a false positive in this context | |
keepjumps exe '1,' . n . 's#^\(.\{,10}Last modified: \).*#\1' . | |
\ strftime('%a %b %d, %Y %I:%M%p') . '#e' | |
" Calling histdel removes timestamp search pattern from search history. | |
call histdel('search', -1) | |
call setpos('.', save_cursor) | |
endif | |
endfun | |
" } | |
" Code that must be run when vim starts { | |
call ToggleH() | |
call ToggleH() | |
" } | |
" Remappings { | |
" Set tab bar as the leader key | |
nnoremap <SPACE> <Nop> | |
let mapleader = "\<space>" | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Pseudo Functions | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
imap @pye # -*- coding: utf-8 -*- | |
" FIXME It shows but don't hidde them. | |
" Show both leading and trailing TABs | |
map <leader>mt /^\t\+\\|\s\+$<cr> | |
" Change text without putting the text into register, | |
" see https://stackoverflow.com/q/54255/6064933 | |
nnoremap c "_c | |
nnoremap C "_C | |
nnoremap cc "_cc | |
" Decrease indent level in insert mode with shift+tab | |
inoremap <S-Tab> <ESC><<i | |
nnoremap <S-Tab> <ESC><< | |
" Save key strokes (now we do not need to press shift to enter command mode). | |
" Vim-sneak has also mapped `;`, so using the below mapping will break the map | |
" used by vim-sneak | |
nnoremap ; : | |
xnoremap ; : | |
" Quit | |
cabbrev Q q | |
cabbrev Q! q! | |
" Save | |
cabbrev W w | |
cabbrev W w | |
cabbrev W! w! | |
" Save and quit | |
cabbrev WQ wq | |
cabbrev WQ! wq! | |
" Quit all without saving | |
cabbrev QA qa | |
cabbrev QA! qa! | |
" Quicker way to open command window | |
cabbrev ; q: | |
" Quicker <Esc> in insert mode | |
"inoremap <silent> fj <Esc>l | |
inoremap fj <Esc>l | |
inoremap FJ <Esc>l | |
vnoremap fj <Esc> | |
vnoremap FJ <Esc> | |
cnoremap fj <Esc> | |
cnoremap FJ <Esc> | |
" Replace ALL is aliased to S. | |
nnoremap S :%s//g<Left><Left> | |
" Turn the word under cursor to upper case | |
inoremap <silent> <c-u> <Esc>viwUea | |
" Turn the current word into title case | |
inoremap <silent> <c-t> <Esc>b~lea | |
" Navigation | |
" {{ | |
" Navigate around splits with a single key combo. | |
nnoremap <C-l> <C-w><C-l> | |
nnoremap <C-h> <C-w><C-h> | |
nnoremap <C-k> <C-w><C-k> | |
nnoremap <C-j> <C-w><C-j> | |
" Cycle through splits. | |
nnoremap <S-Tab> <C-w>w | |
" }} | |
" Toggle Paste mode. | |
set pastetoggle=<F12> | |
" Plugins | |
" {{ | |
" }} | |
" Save content of current file as root (it is good to save time | |
" when you forgot to do sudo vim <file>) | |
cmap w!! silent execute 'write !sudo tee ' . shellescape(@%, 1) . ' >/dev/null' | |
"cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit! | |
" Call command shortcut | |
nmap tc :! | |
"Easy access to vimrc | |
nnoremap <leader>ee :tabe $MYVIMRC<cr> | |
" Remove trailing whitespace characters | |
nnoremap <silent> <leader><Space> :call StripTrailingWhitespaces()<CR> | |
" Help me to stop using arrow keys | |
if myos == "mswindows" || myos == "cygwin" | |
nnoremap <up> :echoerr "Don't use arrow keys, use H, J, K, L instead!"<CR> | |
nnoremap <down> :echoerr "Don't use arrow keys, use H, J, K, L instead!"<CR> | |
nnoremap <right> :echoerr "Don't use arrow keys, use H, J, K, L instead!"<CR> | |
nnoremap <left> :echoerr "Don't use arrow keys, use H, J, K, L instead!"<CR> | |
endif | |
" TODO Test mappings | |
"..................................................................... | |
" Show current value of command line | |
" if typed slowly can enter on insert mode | |
" ,: begin mapping | s: ":set" command | [a-z]: set option abbreviation | |
"map ,si :set ai!<cr>:echo "autoIndent="&ai<cr> | |
"map ,sc :set ic!<cr>:echo "ignoreCase="&ic<cr> | |
"map ,sc :set ic! ic?<cr> | |
" TODO Test mappings | |
"..................................................................... | |
" DIFF from the edited file itself. | |
"w! diff -u - % | |
" TODO Test mappings | |
" Hidde HTML tags (by painting them with the same color of the background color) | |
"map ,hh :syn match preto '<.\{-}>' <cr>:hi preto ctermfg=black ctermbg=blue<cr> | |
"Let me use left and right arrows to navigate between tag definitions. | |
map <silent><C-Left> <C-T> | |
map <silent><C-Right> <C-]> | |
"..................................................................... | |
" Hide the text using ROT13 | |
map <F8> ggVGg? | |
" (Dis)able highligth of characters longer than 80 characters. | |
nnoremap <leader>1 :call ToggleH()<CR> | |
" Continuous visual shifting (does not exit Visual mode), `gv` means | |
" to reselect previous visual area, see https://superuser.com/q/310417/736190 | |
xnoremap < <gv | |
xnoremap > >gv | |
" Reselect the text that has just been pasted | |
nnoremap <leader>v `[V`] | |
nnoremap H ^ | |
" } | |
function! CommentsOnOff() abort | |
if !exists('g:hiddcomm') | |
let g:hiddcomm=1 | highlight Comment ctermfg=black guifg=black | |
else | |
unlet g:hiddcomm | highlight Comment ctermfg=cyan guifg=cyan term=bold | |
endif | |
endfu | |
map <F11> :call CommOnOff()<cr> | |
" References {{ | |
" https://aurelio.net/doc/coluna/coluna-09.html | |
" https://github.com/LukeSmithxyz/voidrice/blob/master/.config/nvim/init.vim | |
" https://github.com/changemewtf/dotfiles/blob/master/vim/.vimrc | |
" https://github.com/ethanv2/voidrice/blob/master/.config/nvim/init.vim | |
" https://github.com/jdhao/minimal_vim/blob/master/init.vim | |
" https://github.com/nickjj/dotfiles/blob/master/.vimrc | |
" https://learnvimscriptthehardway.stevelosh.com/chapters/07.html | |
" https://stackoverflow.com/questions/48271865/vim-whats-the-best-way-to-set-statusline-color-to-change-based-on-mode | |
" https://vim.fandom.com/wiki/Insert_current_date_or_time | |
" }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment