-
-
Save a-b/47727795a031c429107e to your computer and use it in GitHub Desktop.
Toggle tab size in .vimrc with <f3>. Doesn't set initial conditions.
This file contains 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
" Apparently some vim environments require colons before commands in | |
" .vimrc and others don't. This file has been primarily tested in | |
" Ubuntu 12.04, 13.10, and 14.04 environments, where a : is required | |
" on each line before a command. According to one stackexchange topic | |
" it is best to leave the leading colons because systems that do not | |
" require them can still execute them. | |
" Author - Trent Robbins | |
:set background=dark | |
" set backspace for mac delete key (otherwise it doesn't work) | |
:set backspace=indent,eol,start | |
" syntax by default | |
:syntax enable | |
" inserts spaces instead of a tab | |
:set expandtab | |
"maintain tabbing increments when backspacing tabs (speed things up) | |
:set smarttab | |
"show the commands which you enter in the bottom right corner | |
:set showcmd | |
" set spaces used for indentenation | |
:set shiftwidth=4 | |
:set tabstop=4 | |
" does a tabstop of 4 during edit commands | |
:set softtabstop=4 | |
" Turn on line numbers: | |
:set number | |
" indent to previous line automatically | |
:filetype plugin indent on | |
" allow input toggle to paste mode with F2 | |
:set pastetoggle=<F2> | |
" customtabsize always is the conditional route to the opposite state. | |
" try this... :let customtabsize = 0 | |
:let g:customtabsize=1 | |
" allow toggle between 2/4 spaces. | |
function TabToggle() | |
if g:customtabsize | |
:set shiftwidth=2 | |
:set tabstop=2 | |
:set softtabstop=2 | |
:let g:customtabsize=0 | |
else | |
:set shiftwidth=4 | |
:set tabstop=4 | |
:set softtabstop=4 | |
:let g:customtabsize=1 | |
endif | |
endfunction | |
:nmap <F3> mz:execute TabToggle()<CR>'z | |
" Maintain undo history between sessions | |
:set undofile | |
:set undodir=~/.vim | |
:set undolevels=1000 " This many undos are saved. | |
:set undoreload=10000 " This saves 10000 lines of undos, which is the default | |
:set foldmethod=indent | |
:set foldlevel=99 | |
:nnoremap <Space> za | |
" Keep visual block after changing indent | |
:vmap > >gv | |
:vmap < <gv | |
" Highlight things that we find with the search | |
:set hlsearch | |
" <Ctrl-l> redraws the screen and removes any search highlighting. | |
:nnoremap <silent> <C-l> :nohl<CR><C-l> | |
" Allow .MD files to automagically use markdown syntax | |
:au BufNewFile,BufReadPost *.MD set filetype=markdown | |
:au BufRead,BufNewFile *.md set filetype=markdown | |
" Set Cursor row and column colors | |
:highlight CursorLine ctermbg=Black cterm=NONE | |
:highlight CursorColumn ctermbg=Black cterm=NONE | |
" :highlight CursorColumn ctermbg=LightMagenta cterm=NONE | |
" Set Cursor row and column to on. | |
augroup CursorLine | |
au! | |
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline cursorcolumn | |
au WinLeave * setlocal nocursorline nocursorcolumn | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment