From fe33c524111219d843f5b3eb0e67f1245ed342f7 Mon Sep 17 00:00:00 2001 From: Chris Coley <chris@codingallnight.com> Date: Mon, 10 Oct 2016 01:46:17 -0700 Subject: [PATCH] Adding a shortcut to toggle vertical rulers on lines 81 and 121 --- vimrc | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/vimrc b/vimrc index 89318dc..d2c7c1e 100644 --- a/vimrc +++ b/vimrc @@ -16,15 +16,6 @@ set backspace=2 " Make Backspace work like you expect set formatoptions+=ro " Automatically insert the comment character when you " hit <Enter> (r) or o/O (o) in a comment block -" Show invisible characters with `:set list!` or <F10> -set nolist -set listchars=tab:»-,trail:·,extends:>,precedes:<,eol:¬ -noremap <F10> :set list!<CR> - - -" Allow saving of files as sudo when I forgot to start vim using sudo -cmap w!! q !sudo tee > /dev/null % - " Tab options set expandtab " Soft tabs, changes tabs to spaces @@ -33,11 +24,6 @@ set softtabstop=4 " Number of spaces in a soft tab set shiftwidth=4 " Number of spaces in an indentation level. -" Use solarized colorscheme -set background=dark -colorscheme solarized - - " Searching options set nowrapscan " Do not wrap to the top of the file while searching set ignorecase " Case insensitive searching @@ -46,6 +32,34 @@ set incsearch " Begin matching query as you type it set hlsearch " Highlight search matches +" Use solarized colorscheme +set background=dark +colorscheme solarized + + +" Allow saving of files as sudo when I forget to start vim using sudo +cmap w!! q !sudo tee > /dev/null % + + +" Show invisible characters with `:set list!` or <F10> +set nolist +set listchars=tab:»-,trail:·,extends:>,precedes:<,eol:¬ +noremap <F10> :set list!<CR> + + +" Filetype specific indentation +" Put a vertical ruler in columns 81 and 121 +highlight ColorColumn ctermbg=magenta +noremap <F9> :call ToggleColorColumn()<CR> +function! ToggleColorColumn() + if &colorcolumn + setlocal colorcolumn& + else + setlocal colorcolumn=81,121 + endif +endfunction + + " Code folding "set foldmethod=indent "set foldenable @@ -56,17 +70,11 @@ set hlsearch " Highlight search matches autocmd BufNewFile,BufRead [Mm]akefile* setlocal noexpandtab -" Put a vertical ruler in column 81 -"highlight ColorColumn ctermbg=White -"set colorcolumn=81 - - " Set the terminal title to reflect the open file. Even works with Vim tabs. autocmd BufEnter * let &titlestring = expand("%:t") . " - %{$USER}@" . hostname() | set title autocmd VimLeave * let &titleold = $USER . "@" . hostname() | set title -" Filetype specific indentation "filetype plugin indent on "autocmd FileType html setlocal shiftwidth=2 softtabstop=2 " HTML "autocmd FileType php setlocal shiftwidth=4 softtabstop=4 " PHP -- GitLab