- """"""""""
- " .vimrc "
- """"""""""
- " vim-pathogen
- " https://github.com/tpope/vim-pathogen
- " How-to that I followed: https://gist.github.com/romainl/9970697
- execute pathogen#infect()
- " This line should not be removed as it ensures that various options are
- " properly set to work with the Vim-related packages available in Debian.
- "runtime! debian.vim
- " Uncomment the next line to make Vim more Vi-compatible
- " NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
- " options, so any other options should be set AFTER setting 'compatible'.
- "set nocompatible
- " Filetype - http://vimhelp.appspot.com/filetype.txt.html
- filetype plugin indent on
- """""""""""""""""""""""""""""""""""""""""""""""
- " Here begins my automated wordcount addition.
- " This combines several ideas from:
- " http://stackoverflow.com/questions/114431/fast-word-count-function-in-vim
- " This function is primarily used in statusline
- """""""""""""""""""""""""""""""""""""""""""""""
- let g:word_count="<unknown>"
- function WordCount()
- return g:word_count
- endfunction
- function UpdateWordCount()
- let lnum = 1
- let n = 0
- while lnum <= line('$')
- let n = n + len(split(getline(lnum)))
- let lnum = lnum + 1
- endwhile
- let g:word_count = n
- endfunction
- " Update the count when cursor is idle in command or insert mode.
- " Update when idle for 1000 msec (default is 4000 msec).
- set updatetime=1000
- augroup WordCounter
- au! CursorHold,CursorHoldI * call UpdateWordCount()
- augroup END
- """""""""""""""""
- " < COSMETICS > "
- """""""""""""""""
- """ Color management
- " vim can autodetect this based on $TERM (e.g. 'xterm-256color')
- " but it can be set to force 256 colors
- " set t_Co=256
- if &t_Co < 256
- colorscheme default
- "set nocursorline " looks bad in this mode
- else
- set background=dark
- " let g:solarized_termcolors=256 " instead of 16 color with mapping in terminal
- colorscheme flattened_dark
- " customized colors
- " highlight SignColumn ctermbg=234
- " highlight StatusLine cterm=bold ctermfg=245 ctermbg=235
- " highlight StatusLineNC cterm=bold ctermfg=245 ctermbg=235
- endif
- """ Color overrides
- " Enable cursorline in insert mode.
- autocmd InsertEnter * set cul
- autocmd InsertLeave * set nocul
- " Set cursor colum color
- highlight CursorColumn ctermbg=230 guibg=#ffffd7
- " Instead of red background when spellchecking, do underlines.
- " Source - https://github.com/mgedmin/dotvim/blob/master/vimrc#L1270-L1271
- highlight SpellBad cterm=underline ctermfg=red ctermbg=NONE
- highlight SpellCap cterm=underline ctermfg=blue ctermbg=NONE
- """
- " Vim5 and later versions support syntax highlighting. Uncommenting the next line enables syntax highlighting by default.
- if has("syntax")
- syntax on
- endif
- set background=dark " If using a dark background within the editing area and syntax highlighting turn on this option as well
- set number " Turn line numbers on
- set ruler " Show the cursor position all the time
- set showcmd " Show the commands which you enter in the file - https://www.hscripts.com/tutorials/vim-commands/showcmd.html
- " Highlight searched text
- " Do :nohl to turn it off (for that session).
- set hlsearch
- " Search as you type.
- " Vim will start searching when you type the first character of the search string. As you type in more characters, the search is refined.
- set incsearch
- " wildmenu / wildmode -
- " http://stackoverflow.com/questions/9511253/how-to-effectively-use-vim-wildmenu
- set wildmenu
- set wildmode=longest:full,full
- " Interpret .md files as markdown instead of modula2
- " More info - http://stackoverflow.com/a/14779012 and http://stackoverflow.com/a/23279293
- autocmd BufNewFile,BufFilePre,BufRead *.md set filetype=markdown
- set laststatus=2 " Set this to use (custom) statuslines.
- """"""""""
- " airline
- """"""""""
- let g:airline_theme = 'powerlineish'
- let g:airline#extensions#branch#enabled = 1
- let g:airline#extensions#syntastic#enabled = 0
- let g:airline#extensions#tabline#enabled = 1
- "set timeoutlen=50 " https://github.com/bling/vim-airline/wiki/FAQ#there-is-a-pause-when-leaving-insert-mode
- " Tweak ttimeout because it messes with the time it takes to succesfully do a
- " keycombo.
- set ttimeout
- set ttimeoutlen=50
- if !exists('g:airline_symbols')
- let g:airline_symbols = {}
- endif
- " unicode symbols
- let g:airline_left_sep = '»'
- let g:airline_left_sep = 'â–¶'
- let g:airline_right_sep = '«'
- let g:airline_right_sep = 'â—€'
- let g:airline_symbols.linenr = 'âŠ'
- let g:airline_symbols.linenr = 'â¤'
- let g:airline_symbols.linenr = '¶'
- let g:airline_symbols.branch = '⎇'
- let g:airline_symbols.paste = 'Ï'
- let g:airline_symbols.paste = 'Þ'
- let g:airline_symbols.paste = '∥'
- let g:airline_symbols.whitespace = 'Ξ'
- " variable names, see :help airline (airline-customization) for more info
- "let g:airline_section_a
- "let g:airline_section_b
- let g:airline_section_c = '%F'
- "let g:airline_section_gutter
- "let g:airline_section_x
- "let g:airline_section_y
- "let g:airline_section_z
- let g:airline_section_warning = '%{WordCount()} wds'
- """"""""""""""""""""
- """"""""""""""""""
- " </ COSMETICS > "
- """"""""""""""""""
- """ vim-lexical plugin
- """ https://github.com/reedes/vim-lexical
- " Define which filetypes are going to get lexical applied.
- augroup lexical
- autocmd!
- autocmd FileType markdown,mkd call lexical#init()
- autocmd FileType textile call lexical#init()
- autocmd FileType text call lexical#init({ 'spell': 0 })
- augroup END
- " Location to the thesaurus. Also for vim.
- " Online location is http://www.gutenberg.org/files/3202/ - but file is around ~25mb
- let g:lexical#thesaurus = ['~/.thesaurus/mthesaur.txt',]
- set thesaurus+=~/.thesaurus/mthesaur.txt
- " Uncomment the following to have Vim jump to the last position when
- " reopening a file
- if has("autocmd")
- au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
- endif
- " Uncomment the following to have Vim load indentation rules and plugins
- " according to the detected filetype.
- "if has("autocmd")
- " filetype plugin indent on
- "endif
- " Set tab to only have 4 columns.
- " http://tedlogan.com/techblog3.html
- set tabstop=4
- """ Custom Mappings
- " Set the leader in vim
- " http://usevim.com/2012/07/20/vim101-leader/
- let mapleader='\'
- " Remap Ctrl+c to double Esc. Double because otherwise hitting C-c will wait the length of timeoutlen before executing.
- " More info - http://stackoverflow.com/a/80761
- inoremap <C-c> <Esc><Esc>
- " Remap Ctrl-a and Ctrl-e in insert mode to move to line beginning and line to the end of the line respectively.
- " This coincides with *gasp* the Emacs mode in Bash readline, and I'm pretty used to that mapping.
- " See this SO post about it - http://stackoverflow.com/a/11487877
- " You do lose some features, but I don't think I'll be needing them at this moment.
- inoremap <C-e> <End>
- inoremap <C-a> <Home>
- " The following are commented out as they cause vim to behave a lot
- " differently from regular Vi. They are highly recommended though.
- set showcmd " Show (partial) command in status line.
- set showmatch " Show matching brackets when text indicator is over them.
- set ignorecase " Do case insensitive matching
- set smartcase " Do smart case matching, make searches case-sensitive only if they contain upper-case characters.
- "set incsearch " Incremental search
- "set autowrite " Automatically save before commands like :next and :make
- "set hidden " Hide buffers when they are abandoned
- "set mouse=a " Enable mouse usage (all modes)
- set history=9001 " We gon way back...
- " Source a global configuration file if available
- if filereadable("/etc/vim/vimrc.local")
- source /etc/vim/vimrc.local
- endif
- " Language-dependant autocompletion (otherwise known as Intellisense for Visual Studio)
- " Source - http://vim.wikia.com/wiki/Omni_completion
- " To use omni completion, type <C-X><C-O> while open in Insert mode. If matching names are found, a pop-up menu opens which can be navigated using the <C-N> and <C-P> keys.
- filetype plugin on
- set omnifunc=syntaxcomplete#Complete
- " Set this to get access to lots of tabs.
- set tabpagemax=20
- " Tell vim not to add a newline on every (saved) file.
- " http://stackoverflow.com/questions/14171254/why-would-vim-add-a-new-line-at-the-end-of-a-file
- " set fileformats+=dos
- " But apparently there's no easy way to do this -_-
.vimrc
Posted by Anonymous on Wed 25th Nov 2015 16:52
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.