Last active
December 4, 2022 22:51
-
-
Save Kvieta1990/dc881d221c062fea4d11685ea2842789 to your computer and use it in GitHub Desktop.
vim configuration files
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
" COPY THIS FILE AS .vimrc in home folder. | |
" cp vimrc ~/.vimrc | |
" | |
" .vimrc | |
" | |
" Smylers's .vimrc | |
" http://www.stripey.com/vim/ | |
" | |
" 2000 Jun 1: for `Vim' 5.6 | |
" | |
" This vimrc is divided into these sections: | |
" | |
" * Terminal Settings | |
" * User Interface | |
" * Text Formatting -- General | |
" * Text Formatting -- Specific File Formats | |
" * Search & Replace | |
" * Spelling | |
" * Keystrokes -- Moving Around | |
" * Keystrokes -- Formatting | |
" * Keystrokes -- Toggles | |
" * Keystrokes -- Insert Mode | |
" * Keystrokes -- For HTML Files | |
" * `SLRN' Behaviour | |
" * Functions Referred to Above | |
" | |
" This file contains no control codes and no `top bit set' characters above the | |
" normal Ascii range, and all lines contain a maximum of 79 characters. With a | |
" bit of luck, this should make it resilient to being uploaded, downloaded, | |
" e-mailed, posted, encoded, decoded, transmitted by morse code, or whatever. | |
" first clear any existing autocommands: | |
autocmd! | |
"---" * Terminal Settings | |
"--- | |
"---" `XTerm', `RXVT', `Gnome Terminal', and `Konsole' all claim to be "xterm"; | |
"---" `KVT' claims to be "xterm-color": | |
"---if &term =~ 'xterm' | |
"--- | |
"--- " `Gnome Terminal' fortunately sets $COLORTERM; it needs <BkSpc> and <Del> | |
"--- " fixing, and it has a bug which causes spurious "c"s to appear, which can be | |
"--- " fixed by unsetting t_RV: | |
"--- if $COLORTERM == 'gnome-terminal' | |
"--- execute 'set t_kb=' . nr2char(8) | |
"--- " [Char 8 is <Ctrl>+H.] | |
"--- fixdel | |
"--- set t_RV= | |
"--- | |
"--- " `XTerm', `Konsole', and `KVT' all also need <BkSpc> and <Del> fixing; | |
"--- " there's no easy way of distinguishing these terminals from other things | |
"--- " that claim to be "xterm", but `RXVT' sets $COLORTERM to "rxvt" and these | |
"--- " don't: | |
"--- elseif $COLORTERM == '' | |
"--- execute 'set t_kb=' . nr2char(8) | |
"--- fixdel | |
"--- | |
"--- " The above won't work if an `XTerm' or `KVT' is started from within a `Gnome | |
"--- " Terminal' or an `RXVT': the $COLORTERM setting will propagate; it's always | |
"--- " OK with `Konsole' which explicitly sets $COLORTERM to "". | |
"--- | |
"--- endif | |
"---endif | |
" * User Interface | |
" have syntax highlighting in terminals which can display colours: | |
"if has('syntax') && (&t_Co > 2) | |
" syntax on | |
"endif | |
" have fifty lines of command-line (etc) history: | |
set history=50 | |
" remember all of these between sessions, but only 10 search terms; also | |
" remember info for 10 files, but never any on removable disks, don't remember | |
" marks in files, don't rehighlight old search patterns, and only save up to | |
" 100 lines of registers; including @10 in there should restrict input buffer | |
" but it causes an error for me: | |
set viminfo=/10,'10,r/mnt/zip,r/mnt/floppy,f0,h,\"100 | |
" have command-line completion <Tab> (for filenames, help topics, option names) | |
" first list the available options and complete the longest common part, then | |
" have further <Tab>s cycle through the possibilities: | |
set wildmode=list:longest,full | |
" use "[RO]" for "[readonly]" to save space in the message line: | |
set shortmess+=r | |
" display the current mode and partially-typed commands in the status line: | |
set showmode | |
set showcmd | |
" when using list, keep tabs at their full width and display `arrows': | |
execute 'set listchars+=tab:' . nr2char(187) . nr2char(183) | |
" (Character 187 is a right double-chevron, and 183 a mid-dot.) | |
" have the mouse enabled all the time: | |
" set mouse=a | |
" don't have files trying to override this .vimrc: | |
set nomodeline | |
" * Text Formatting -- General | |
" don't make it look like there are line breaks where there aren't: | |
set nowrap | |
" use indents of 2 spaces, and have them copied down lines: | |
set shiftwidth=2 | |
set shiftround | |
set expandtab | |
set autoindent | |
" normally don't automatically format `text' as it is typed, IE only do this | |
" with comments, at 79 characters: | |
set formatoptions-=t | |
set textwidth=80 | |
set fo+=t | |
" get rid of the default style of C comments, and define a style with two stars | |
" at the start of `middle' rows which (looks nicer and) avoids asterisks used | |
" for bullet lists being treated like C comments; then define a bullet list | |
" style for single stars (like already is for hyphens): | |
set comments-=s1:/*,mb:*,ex:*/ | |
set comments+=s:/*,mb:**,ex:*/ | |
set comments+=fb:* | |
" treat lines starting with a quote mark as comments (for `Vim' files, such as | |
" this very one!), and colons as well so that reformatting usenet messages from | |
" `Tin' users works OK: | |
set comments+=b:\" | |
set comments+=n:: | |
" * Text Formatting -- Specific File Formats | |
" enable filetype detection: | |
filetype on | |
" recognize anything in my .Postponed directory as a news article, and anything | |
" at all with a .txt extension as being human-language text [this clobbers the | |
" `help' filetype, but that doesn't seem to prevent help from working | |
" properly]: | |
augroup filetype | |
autocmd BufNewFile,BufRead */.Postponed/* set filetype=mail | |
autocmd BufNewFile,BufRead *.txt set filetype=human | |
augroup END | |
" in human-language files, automatically format everything at 72 chars: | |
autocmd FileType mail,human set formatoptions+=t textwidth=72 | |
" for C-like programming, have automatic indentation: | |
autocmd FileType c,cpp,slang set cindent | |
" for actual C (not C++) programming where comments have explicit end | |
" characters, if starting a new line in the middle of a comment automatically | |
" insert the comment leader characters: | |
autocmd FileType c set formatoptions+=ro | |
" for Perl programming, have things in braces indenting themselves: | |
autocmd FileType perl set smartindent | |
" for CSS, also have things in braces indented: | |
autocmd FileType css set smartindent | |
" for HTML, generally format text, but if a long line has been created leave it | |
" alone when editing: | |
autocmd FileType html set formatoptions+=tl | |
" for both CSS and HTML, use genuine tab characters for indentation, to make | |
" files a few bytes smaller: | |
autocmd FileType html,css set noexpandtab tabstop=2 | |
" in makefiles, don't expand tabs to spaces, since actual tab characters are | |
" needed, and have indentation at 8 chars to be sure that all indents are tabs | |
" (despite the mappings later): | |
autocmd FileType make set noexpandtab shiftwidth=8 | |
" * Search & Replace | |
" make searches case-insensitive, unless they contain upper-case letters: | |
set ignorecase | |
set smartcase | |
" show the `best match so far' as search strings are typed: | |
set incsearch | |
" assume the /g flag on :s substitutions to replace all matches in a line: | |
set gdefault | |
" * Keystrokes -- Moving Around | |
" have the h and l cursor keys wrap between lines (like <Space> and <BkSpc> do | |
" by default), and ~ covert case over line breaks; also have the cursor keys | |
" wrap in insert mode: | |
set whichwrap=h,l,~,[,] | |
" page down with <Space> (like in `Lynx', `Mutt', `Pine', `Netscape Navigator', | |
" `SLRN', `Less', and `More'); page up with - (like in `Lynx', `Mutt', `Pine'), | |
" or <BkSpc> (like in `Netscape Navigator'): | |
noremap <Space> <PageDown> | |
noremap <BS> <PageUp> | |
noremap - <PageUp> | |
" [<Space> by default is like l, <BkSpc> like h, and - like k.] | |
" scroll the window (but leaving the cursor in the same place) by a couple of | |
" lines up/down with <Ins>/<Del> (like in `Lynx'): | |
noremap <Ins> 2<C-Y> | |
noremap <Del> 2<C-E> | |
" [<Ins> by default is like i, and <Del> like x.] | |
" use <F6> to cycle through split windows (and <Shift>+<F6> to cycle backwards, | |
" where possible): | |
nnoremap <F6> <C-W>w | |
nnoremap <S-F6> <C-W>W | |
" use <Ctrl>+N/<Ctrl>+P to cycle through files: | |
nnoremap <C-N> :next<CR> | |
nnoremap <C-P> :prev<CR> | |
" [<Ctrl>+N by default is like j, and <Ctrl>+P like k.] | |
" have % bounce between angled brackets, as well as t'other kinds: | |
set matchpairs+=<:> | |
" have <F1> prompt for a help topic, rather than displaying the introduction | |
" page, and have it do this from any mode: | |
nnoremap <F1> :help<Space> | |
vmap <F1> <C-C><F1> | |
omap <F1> <C-C><F1> | |
map! <F1> <C-C><F1> | |
" * Keystrokes -- Formatting | |
" have Q reformat the current paragraph (or selected text if there is any): | |
nnoremap Q gqap | |
vnoremap Q gq | |
" have the usual indentation keystrokes still work in visual mode: | |
vnoremap <C-T> > | |
vnoremap <C-D> <LT> | |
vmap <Tab> <C-T> | |
vmap <S-Tab> <C-D> | |
" have Y behave analogously to D and C rather than to dd and cc (which is | |
" already done by yy): | |
noremap Y y$ | |
" * Keystrokes -- Toggles | |
" Keystrokes to toggle options are defined here. They are all set to normal | |
" mode keystrokes beginning \t but some function keys (which won't work in all | |
" terminals) are also mapped. | |
" have \tp ("toggle paste") toggle paste on/off and report the change, and | |
" where possible also have <F4> do this both in normal and insert mode: | |
nnoremap \tp :set invpaste paste?<CR> | |
nmap <F4> \tp | |
imap <F4> <C-O>\tp | |
set pastetoggle=<F4> | |
"" have \tf ("toggle format") toggle the automatic insertion of line breaks | |
"" during typing and report the change: | |
"nnoremap \tf :if &fo =~ 't' <Bar> set fo-=t <Bar> else <Bar> set fo+=t <Bar> | |
" \ endif <Bar> set fo?<CR> | |
"nmap <F3> \tf | |
"imap <F3> <C-O>\tf | |
" | |
" have \tl ("toggle list") toggle list on/off and report the change: | |
nnoremap \tl :set invlist list?<CR> | |
nmap <F2> \tl | |
" have \th ("toggle highlight") toggle highlighting of search matches, and | |
" report the change: | |
nnoremap \th :set invhls hls?<CR> | |
" * Keystrokes -- Insert Mode | |
" allow <BkSpc> to delete line breaks, beyond the start of the current | |
" insertion, and over indentations: | |
set backspace=eol,start,indent | |
" have <Tab> (and <Shift>+<Tab> where it works) change the level of | |
" indentation: | |
" inoremap <Tab> <C-T> | |
" inoremap <S-Tab> <C-D> | |
" [<Ctrl>+V <Tab> still inserts an actual tab character.] | |
syntax on | |
set number | |
" set smartindent | |
" set autoindent | |
" set shiftwidth=4 | |
filetype plugin indent on | |
" show existing tab with 4 spaces width | |
set tabstop=4 | |
" when indenting with '>', use 4 spaces width | |
set shiftwidth=4 | |
" On pressing tab, insert 4 spaces | |
set expandtab | |
hi SpellBad ctermfg=015 ctermbg=000 cterm=none guifg=#FFFFFF guibg=#000000 gui=none | |
hi link fortranTab NONE | |
hi clear SpellBad | |
hi SpellBad cterm=underline | |
setlocal spell spelllang=en_gb | |
nnoremap <Tab> :bn<CR> | |
nnoremap <S-Tab> :bf<CR> | |
nnoremap <F5> :NERDTree<CR> | |
nnoremap <F6> :TlistToggle<CR> | |
set ruler | |
nmap <S-F5> i<C-R>=strftime("%Y-%m-%d %a %I:%M %p %Z")<CR><Esc> | |
imap <S-F5> <C-R>=strftime("%Y-%m-%d %a %I:%M %p %Z")<CR> | |
set noerrorbells visualbell t_vb= | |
" Add argument (can be negative, default 1) to global variable i. | |
" Return value of i before the change. | |
function Inc(...) | |
let result = g:i | |
let g:i += a:0 > 0 ? a:1 : 1 | |
return result | |
endfunction | |
call plug#begin() | |
Plug 'JamshedVesuna/vim-markdown-preview' | |
Plug 'terryma/vim-multiple-cursors' | |
Plug 'frazrepo/vim-rainbow' | |
Plug 'preservim/nerdcommenter' | |
Plug 'itchyny/lightline.vim' | |
Plug 'mileszs/ack.vim' | |
Plug 'junegunn/fzf.vim' | |
call plug#end() | |
let vim_markdown_preview_github=1 | |
let g:rainbow_active = 1 | |
set updatetime=100 | |
set laststatus=2 | |
let g:lightline = { | |
\ 'colorscheme': 'powerline', | |
\ } | |
" Uncomment the following to have Vim jump to the last position when | |
" " reopening a file | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
\| exe "normal! g'\"" | endif | |
endif |
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
" COPY THIS FILE AS .vimrc in home folder. | |
" cp vimrc ~/.vimrc | |
" | |
" .vimrc | |
" | |
" Smylers's .vimrc | |
" http://www.stripey.com/vim/ | |
" | |
" 2000 Jun 1: for `Vim' 5.6 | |
" | |
" This vimrc is divided into these sections: | |
" | |
" * Terminal Settings | |
" * User Interface | |
" * Text Formatting -- General | |
" * Text Formatting -- Specific File Formats | |
" * Search & Replace | |
" * Spelling | |
" * Keystrokes -- Moving Around | |
" * Keystrokes -- Formatting | |
" * Keystrokes -- Toggles | |
" * Keystrokes -- Insert Mode | |
" * Keystrokes -- For HTML Files | |
" * `SLRN' Behaviour | |
" * Functions Referred to Above | |
" | |
" This file contains no control codes and no `top bit set' characters above the | |
" normal Ascii range, and all lines contain a maximum of 79 characters. With a | |
" bit of luck, this should make it resilient to being uploaded, downloaded, | |
" e-mailed, posted, encoded, decoded, transmitted by morse code, or whatever. | |
" first clear any existing autocommands: | |
autocmd! | |
"---" * Terminal Settings | |
"--- | |
"---" `XTerm', `RXVT', `Gnome Terminal', and `Konsole' all claim to be "xterm"; | |
"---" `KVT' claims to be "xterm-color": | |
"---if &term =~ 'xterm' | |
"--- | |
"--- " `Gnome Terminal' fortunately sets $COLORTERM; it needs <BkSpc> and <Del> | |
"--- " fixing, and it has a bug which causes spurious "c"s to appear, which can be | |
"--- " fixed by unsetting t_RV: | |
"--- if $COLORTERM == 'gnome-terminal' | |
"--- execute 'set t_kb=' . nr2char(8) | |
"--- " [Char 8 is <Ctrl>+H.] | |
"--- fixdel | |
"--- set t_RV= | |
"--- | |
"--- " `XTerm', `Konsole', and `KVT' all also need <BkSpc> and <Del> fixing; | |
"--- " there's no easy way of distinguishing these terminals from other things | |
"--- " that claim to be "xterm", but `RXVT' sets $COLORTERM to "rxvt" and these | |
"--- " don't: | |
"--- elseif $COLORTERM == '' | |
"--- execute 'set t_kb=' . nr2char(8) | |
"--- fixdel | |
"--- | |
"--- " The above won't work if an `XTerm' or `KVT' is started from within a `Gnome | |
"--- " Terminal' or an `RXVT': the $COLORTERM setting will propagate; it's always | |
"--- " OK with `Konsole' which explicitly sets $COLORTERM to "". | |
"--- | |
"--- endif | |
"---endif | |
" * User Interface | |
" have syntax highlighting in terminals which can display colours: | |
"if has('syntax') && (&t_Co > 2) | |
" syntax on | |
"endif | |
" have fifty lines of command-line (etc) history: | |
set history=50 | |
" remember all of these between sessions, but only 10 search terms; also | |
" remember info for 10 files, but never any on removable disks, don't remember | |
" marks in files, don't rehighlight old search patterns, and only save up to | |
" 100 lines of registers; including @10 in there should restrict input buffer | |
" but it causes an error for me: | |
set viminfo=/10,'10,r/mnt/zip,r/mnt/floppy,f0,h,\"100 | |
" have command-line completion <Tab> (for filenames, help topics, option names) | |
" first list the available options and complete the longest common part, then | |
" have further <Tab>s cycle through the possibilities: | |
set wildmode=list:longest,full | |
" use "[RO]" for "[readonly]" to save space in the message line: | |
set shortmess+=r | |
" display the current mode and partially-typed commands in the status line: | |
set showmode | |
set showcmd | |
" when using list, keep tabs at their full width and display `arrows': | |
execute 'set listchars+=tab:' . nr2char(187) . nr2char(183) | |
" (Character 187 is a right double-chevron, and 183 a mid-dot.) | |
" have the mouse enabled all the time: | |
" set mouse=a | |
" don't have files trying to override this .vimrc: | |
set nomodeline | |
" * Text Formatting -- General | |
" don't make it look like there are line breaks where there aren't: | |
set nowrap | |
" use indents of 2 spaces, and have them copied down lines: | |
set shiftwidth=2 | |
set shiftround | |
set expandtab | |
set autoindent | |
" normally don't automatically format `text' as it is typed, IE only do this | |
" with comments, at 79 characters: | |
set formatoptions-=t | |
set textwidth=80 | |
set fo+=t | |
" get rid of the default style of C comments, and define a style with two stars | |
" at the start of `middle' rows which (looks nicer and) avoids asterisks used | |
" for bullet lists being treated like C comments; then define a bullet list | |
" style for single stars (like already is for hyphens): | |
set comments-=s1:/*,mb:*,ex:*/ | |
set comments+=s:/*,mb:**,ex:*/ | |
set comments+=fb:* | |
" treat lines starting with a quote mark as comments (for `Vim' files, such as | |
" this very one!), and colons as well so that reformatting usenet messages from | |
" `Tin' users works OK: | |
set comments+=b:\" | |
set comments+=n:: | |
" * Text Formatting -- Specific File Formats | |
" enable filetype detection: | |
filetype on | |
" recognize anything in my .Postponed directory as a news article, and anything | |
" at all with a .txt extension as being human-language text [this clobbers the | |
" `help' filetype, but that doesn't seem to prevent help from working | |
" properly]: | |
augroup filetype | |
autocmd BufNewFile,BufRead */.Postponed/* set filetype=mail | |
autocmd BufNewFile,BufRead *.txt set filetype=human | |
augroup END | |
" in human-language files, automatically format everything at 72 chars: | |
autocmd FileType mail,human set formatoptions+=t textwidth=72 | |
" for C-like programming, have automatic indentation: | |
autocmd FileType c,cpp,slang set cindent | |
" for actual C (not C++) programming where comments have explicit end | |
" characters, if starting a new line in the middle of a comment automatically | |
" insert the comment leader characters: | |
autocmd FileType c set formatoptions+=ro | |
" for Perl programming, have things in braces indenting themselves: | |
autocmd FileType perl set smartindent | |
" for CSS, also have things in braces indented: | |
autocmd FileType css set smartindent | |
" for HTML, generally format text, but if a long line has been created leave it | |
" alone when editing: | |
autocmd FileType html set formatoptions+=tl | |
" for both CSS and HTML, use genuine tab characters for indentation, to make | |
" files a few bytes smaller: | |
autocmd FileType html,css set noexpandtab tabstop=2 | |
" in makefiles, don't expand tabs to spaces, since actual tab characters are | |
" needed, and have indentation at 8 chars to be sure that all indents are tabs | |
" (despite the mappings later): | |
autocmd FileType make set noexpandtab shiftwidth=8 | |
" * Search & Replace | |
" make searches case-insensitive, unless they contain upper-case letters: | |
set ignorecase | |
set smartcase | |
" show the `best match so far' as search strings are typed: | |
set incsearch | |
" assume the /g flag on :s substitutions to replace all matches in a line: | |
set gdefault | |
" * Keystrokes -- Moving Around | |
" have the h and l cursor keys wrap between lines (like <Space> and <BkSpc> do | |
" by default), and ~ covert case over line breaks; also have the cursor keys | |
" wrap in insert mode: | |
set whichwrap=h,l,~,[,] | |
" page down with <Space> (like in `Lynx', `Mutt', `Pine', `Netscape Navigator', | |
" `SLRN', `Less', and `More'); page up with - (like in `Lynx', `Mutt', `Pine'), | |
" or <BkSpc> (like in `Netscape Navigator'): | |
noremap <Space> <PageDown> | |
noremap <BS> <PageUp> | |
noremap - <PageUp> | |
" [<Space> by default is like l, <BkSpc> like h, and - like k.] | |
" scroll the window (but leaving the cursor in the same place) by a couple of | |
" lines up/down with <Ins>/<Del> (like in `Lynx'): | |
noremap <Ins> 2<C-Y> | |
noremap <Del> 2<C-E> | |
" [<Ins> by default is like i, and <Del> like x.] | |
" use <F6> to cycle through split windows (and <Shift>+<F6> to cycle backwards, | |
" where possible): | |
nnoremap <F6> <C-W>w | |
nnoremap <S-F6> <C-W>W | |
" use <Ctrl>+N/<Ctrl>+P to cycle through files: | |
nnoremap <C-N> :next<CR> | |
nnoremap <C-P> :prev<CR> | |
" [<Ctrl>+N by default is like j, and <Ctrl>+P like k.] | |
" have % bounce between angled brackets, as well as t'other kinds: | |
set matchpairs+=<:> | |
" have <F1> prompt for a help topic, rather than displaying the introduction | |
" page, and have it do this from any mode: | |
nnoremap <F1> :help<Space> | |
vmap <F1> <C-C><F1> | |
omap <F1> <C-C><F1> | |
map! <F1> <C-C><F1> | |
" * Keystrokes -- Formatting | |
" have Q reformat the current paragraph (or selected text if there is any): | |
nnoremap Q gqap | |
vnoremap Q gq | |
" have the usual indentation keystrokes still work in visual mode: | |
vnoremap <C-T> > | |
vnoremap <C-D> <LT> | |
vmap <Tab> <C-T> | |
vmap <S-Tab> <C-D> | |
" have Y behave analogously to D and C rather than to dd and cc (which is | |
" already done by yy): | |
noremap Y y$ | |
" * Keystrokes -- Toggles | |
" Keystrokes to toggle options are defined here. They are all set to normal | |
" mode keystrokes beginning \t but some function keys (which won't work in all | |
" terminals) are also mapped. | |
" have \tp ("toggle paste") toggle paste on/off and report the change, and | |
" where possible also have <F4> do this both in normal and insert mode: | |
nnoremap \tp :set invpaste paste?<CR> | |
nmap <F4> \tp | |
imap <F4> <C-O>\tp | |
set pastetoggle=<F4> | |
"" have \tf ("toggle format") toggle the automatic insertion of line breaks | |
"" during typing and report the change: | |
"nnoremap \tf :if &fo =~ 't' <Bar> set fo-=t <Bar> else <Bar> set fo+=t <Bar> | |
" \ endif <Bar> set fo?<CR> | |
"nmap <F3> \tf | |
"imap <F3> <C-O>\tf | |
" | |
" have \tl ("toggle list") toggle list on/off and report the change: | |
nnoremap \tl :set invlist list?<CR> | |
nmap <F2> \tl | |
" have \th ("toggle highlight") toggle highlighting of search matches, and | |
" report the change: | |
nnoremap \th :set invhls hls?<CR> | |
" * Keystrokes -- Insert Mode | |
" allow <BkSpc> to delete line breaks, beyond the start of the current | |
" insertion, and over indentations: | |
set backspace=eol,start,indent | |
" have <Tab> (and <Shift>+<Tab> where it works) change the level of | |
" indentation: | |
" inoremap <Tab> <C-T> | |
" inoremap <S-Tab> <C-D> | |
" [<Ctrl>+V <Tab> still inserts an actual tab character.] | |
syntax on | |
set number | |
" set smartindent | |
" set autoindent | |
" set shiftwidth=4 | |
filetype plugin indent on | |
" show existing tab with 4 spaces width | |
set tabstop=4 | |
" when indenting with '>', use 4 spaces width | |
set shiftwidth=4 | |
" On pressing tab, insert 4 spaces | |
set expandtab | |
hi SpellBad ctermfg=015 ctermbg=000 cterm=none guifg=#FFFFFF guibg=#000000 gui=none | |
hi link fortranTab NONE | |
hi clear SpellBad | |
hi SpellBad cterm=underline | |
setlocal spell spelllang=en_gb | |
nnoremap <Tab> :bn<CR> | |
nnoremap <S-Tab> :bf<CR> | |
nnoremap <F5> :NERDTree<CR> | |
nnoremap <F6> :TlistToggle<CR> | |
set ruler | |
nmap <S-F5> i<C-R>=strftime("%Y-%m-%d %a %I:%M %p %Z")<CR><Esc> | |
imap <S-F5> <C-R>=strftime("%Y-%m-%d %a %I:%M %p %Z")<CR> | |
set noerrorbells visualbell t_vb= | |
" Add argument (can be negative, default 1) to global variable i. | |
" Return value of i before the change. | |
function Inc(...) | |
let result = g:i | |
let g:i += a:0 > 0 ? a:1 : 1 | |
return result | |
endfunction | |
call plug#begin() | |
Plug 'JamshedVesuna/vim-markdown-preview' | |
Plug 'terryma/vim-multiple-cursors' | |
Plug 'frazrepo/vim-rainbow' | |
Plug 'preservim/nerdcommenter' | |
Plug 'itchyny/lightline.vim' | |
Plug 'mileszs/ack.vim' | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
call plug#end() | |
let vim_markdown_preview_github=1 | |
let g:rainbow_active = 1 | |
set updatetime=100 | |
set laststatus=2 | |
let g:lightline = { | |
\ 'colorscheme': 'powerline', | |
\ } | |
" 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 |
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
" COPY THIS FILE AS .vimrc in home folder. | |
" cp vimrc ~/.vimrc | |
" | |
" .vimrc | |
" | |
" Smylers's .vimrc | |
" http://www.stripey.com/vim/ | |
" | |
" 2000 Jun 1: for `Vim' 5.6 | |
" | |
" This vimrc is divided into these sections: | |
" | |
" * Terminal Settings | |
" * User Interface | |
" * Text Formatting -- General | |
" * Text Formatting -- Specific File Formats | |
" * Search & Replace | |
" * Spelling | |
" * Keystrokes -- Moving Around | |
" * Keystrokes -- Formatting | |
" * Keystrokes -- Toggles | |
" * Keystrokes -- Insert Mode | |
" * Keystrokes -- For HTML Files | |
" * `SLRN' Behaviour | |
" * Functions Referred to Above | |
" | |
" This file contains no control codes and no `top bit set' characters above the | |
" normal Ascii range, and all lines contain a maximum of 79 characters. With a | |
" bit of luck, this should make it resilient to being uploaded, downloaded, | |
" e-mailed, posted, encoded, decoded, transmitted by morse code, or whatever. | |
" first clear any existing autocommands: | |
autocmd! | |
"---" * Terminal Settings | |
"--- | |
"---" `XTerm', `RXVT', `Gnome Terminal', and `Konsole' all claim to be "xterm"; | |
"---" `KVT' claims to be "xterm-color": | |
"---if &term =~ 'xterm' | |
"--- | |
"--- " `Gnome Terminal' fortunately sets $COLORTERM; it needs <BkSpc> and <Del> | |
"--- " fixing, and it has a bug which causes spurious "c"s to appear, which can be | |
"--- " fixed by unsetting t_RV: | |
"--- if $COLORTERM == 'gnome-terminal' | |
"--- execute 'set t_kb=' . nr2char(8) | |
"--- " [Char 8 is <Ctrl>+H.] | |
"--- fixdel | |
"--- set t_RV= | |
"--- | |
"--- " `XTerm', `Konsole', and `KVT' all also need <BkSpc> and <Del> fixing; | |
"--- " there's no easy way of distinguishing these terminals from other things | |
"--- " that claim to be "xterm", but `RXVT' sets $COLORTERM to "rxvt" and these | |
"--- " don't: | |
"--- elseif $COLORTERM == '' | |
"--- execute 'set t_kb=' . nr2char(8) | |
"--- fixdel | |
"--- | |
"--- " The above won't work if an `XTerm' or `KVT' is started from within a `Gnome | |
"--- " Terminal' or an `RXVT': the $COLORTERM setting will propagate; it's always | |
"--- " OK with `Konsole' which explicitly sets $COLORTERM to "". | |
"--- | |
"--- endif | |
"---endif | |
" * User Interface | |
" have syntax highlighting in terminals which can display colours: | |
"if has('syntax') && (&t_Co > 2) | |
" syntax on | |
"endif | |
" have fifty lines of command-line (etc) history: | |
set history=50 | |
" remember all of these between sessions, but only 10 search terms; also | |
" remember info for 10 files, but never any on removable disks, don't remember | |
" marks in files, don't rehighlight old search patterns, and only save up to | |
" 100 lines of registers; including @10 in there should restrict input buffer | |
" but it causes an error for me: | |
set viminfo=/10,'10,r/mnt/zip,r/mnt/floppy,f0,h,\"100 | |
" have command-line completion <Tab> (for filenames, help topics, option names) | |
" first list the available options and complete the longest common part, then | |
" have further <Tab>s cycle through the possibilities: | |
set wildmode=list:longest,full | |
" use "[RO]" for "[readonly]" to save space in the message line: | |
set shortmess+=r | |
" display the current mode and partially-typed commands in the status line: | |
set showmode | |
set showcmd | |
" when using list, keep tabs at their full width and display `arrows': | |
execute 'set listchars+=tab:' . nr2char(187) . nr2char(183) | |
" (Character 187 is a right double-chevron, and 183 a mid-dot.) | |
" have the mouse enabled all the time: | |
" set mouse=a | |
" don't have files trying to override this .vimrc: | |
set nomodeline | |
" * Text Formatting -- General | |
" don't make it look like there are line breaks where there aren't: | |
set nowrap | |
" use indents of 2 spaces, and have them copied down lines: | |
set shiftwidth=2 | |
set shiftround | |
set expandtab | |
set autoindent | |
" normally don't automatically format `text' as it is typed, IE only do this | |
" with comments, at 79 characters: | |
set formatoptions-=t | |
set textwidth=80 | |
set fo+=t | |
" get rid of the default style of C comments, and define a style with two stars | |
" at the start of `middle' rows which (looks nicer and) avoids asterisks used | |
" for bullet lists being treated like C comments; then define a bullet list | |
" style for single stars (like already is for hyphens): | |
set comments-=s1:/*,mb:*,ex:*/ | |
set comments+=s:/*,mb:**,ex:*/ | |
set comments+=fb:* | |
" treat lines starting with a quote mark as comments (for `Vim' files, such as | |
" this very one!), and colons as well so that reformatting usenet messages from | |
" `Tin' users works OK: | |
set comments+=b:\" | |
set comments+=n:: | |
" * Text Formatting -- Specific File Formats | |
" enable filetype detection: | |
filetype on | |
" recognize anything in my .Postponed directory as a news article, and anything | |
" at all with a .txt extension as being human-language text [this clobbers the | |
" `help' filetype, but that doesn't seem to prevent help from working | |
" properly]: | |
augroup filetype | |
autocmd BufNewFile,BufRead */.Postponed/* set filetype=mail | |
autocmd BufNewFile,BufRead *.txt set filetype=human | |
augroup END | |
" in human-language files, automatically format everything at 72 chars: | |
autocmd FileType mail,human set formatoptions+=t textwidth=72 | |
" for C-like programming, have automatic indentation: | |
autocmd FileType c,cpp,slang set cindent | |
" for actual C (not C++) programming where comments have explicit end | |
" characters, if starting a new line in the middle of a comment automatically | |
" insert the comment leader characters: | |
autocmd FileType c set formatoptions+=ro | |
" for Perl programming, have things in braces indenting themselves: | |
autocmd FileType perl set smartindent | |
" for CSS, also have things in braces indented: | |
autocmd FileType css set smartindent | |
" for HTML, generally format text, but if a long line has been created leave it | |
" alone when editing: | |
autocmd FileType html set formatoptions+=tl | |
" for both CSS and HTML, use genuine tab characters for indentation, to make | |
" files a few bytes smaller: | |
autocmd FileType html,css set noexpandtab tabstop=2 | |
" in makefiles, don't expand tabs to spaces, since actual tab characters are | |
" needed, and have indentation at 8 chars to be sure that all indents are tabs | |
" (despite the mappings later): | |
autocmd FileType make set noexpandtab shiftwidth=8 | |
" * Search & Replace | |
" make searches case-insensitive, unless they contain upper-case letters: | |
set ignorecase | |
set smartcase | |
" show the `best match so far' as search strings are typed: | |
set incsearch | |
" assume the /g flag on :s substitutions to replace all matches in a line: | |
set gdefault | |
" * Keystrokes -- Moving Around | |
" have the h and l cursor keys wrap between lines (like <Space> and <BkSpc> do | |
" by default), and ~ covert case over line breaks; also have the cursor keys | |
" wrap in insert mode: | |
set whichwrap=h,l,~,[,] | |
" page down with <Space> (like in `Lynx', `Mutt', `Pine', `Netscape Navigator', | |
" `SLRN', `Less', and `More'); page up with - (like in `Lynx', `Mutt', `Pine'), | |
" or <BkSpc> (like in `Netscape Navigator'): | |
noremap <Space> <PageDown> | |
noremap <BS> <PageUp> | |
noremap - <PageUp> | |
" [<Space> by default is like l, <BkSpc> like h, and - like k.] | |
" scroll the window (but leaving the cursor in the same place) by a couple of | |
" lines up/down with <Ins>/<Del> (like in `Lynx'): | |
noremap <Ins> 2<C-Y> | |
noremap <Del> 2<C-E> | |
" [<Ins> by default is like i, and <Del> like x.] | |
" use <F6> to cycle through split windows (and <Shift>+<F6> to cycle backwards, | |
" where possible): | |
nnoremap <F6> <C-W>w | |
nnoremap <S-F6> <C-W>W | |
" use <Ctrl>+N/<Ctrl>+P to cycle through files: | |
nnoremap <C-N> :next<CR> | |
nnoremap <C-P> :prev<CR> | |
" [<Ctrl>+N by default is like j, and <Ctrl>+P like k.] | |
" have % bounce between angled brackets, as well as t'other kinds: | |
set matchpairs+=<:> | |
" have <F1> prompt for a help topic, rather than displaying the introduction | |
" page, and have it do this from any mode: | |
nnoremap <F1> :help<Space> | |
vmap <F1> <C-C><F1> | |
omap <F1> <C-C><F1> | |
map! <F1> <C-C><F1> | |
" * Keystrokes -- Formatting | |
" have Q reformat the current paragraph (or selected text if there is any): | |
nnoremap Q gqap | |
vnoremap Q gq | |
" have the usual indentation keystrokes still work in visual mode: | |
vnoremap <C-T> > | |
vnoremap <C-D> <LT> | |
vmap <Tab> <C-T> | |
vmap <S-Tab> <C-D> | |
" have Y behave analogously to D and C rather than to dd and cc (which is | |
" already done by yy): | |
noremap Y y$ | |
" * Keystrokes -- Toggles | |
" Keystrokes to toggle options are defined here. They are all set to normal | |
" mode keystrokes beginning \t but some function keys (which won't work in all | |
" terminals) are also mapped. | |
" have \tp ("toggle paste") toggle paste on/off and report the change, and | |
" where possible also have <F4> do this both in normal and insert mode: | |
nnoremap \tp :set invpaste paste?<CR> | |
nmap <F4> \tp | |
imap <F4> <C-O>\tp | |
set pastetoggle=<F4> | |
"" have \tf ("toggle format") toggle the automatic insertion of line breaks | |
"" during typing and report the change: | |
"nnoremap \tf :if &fo =~ 't' <Bar> set fo-=t <Bar> else <Bar> set fo+=t <Bar> | |
" \ endif <Bar> set fo?<CR> | |
"nmap <F3> \tf | |
"imap <F3> <C-O>\tf | |
" | |
" have \tl ("toggle list") toggle list on/off and report the change: | |
nnoremap \tl :set invlist list?<CR> | |
nmap <F2> \tl | |
" have \th ("toggle highlight") toggle highlighting of search matches, and | |
" report the change: | |
nnoremap \th :set invhls hls?<CR> | |
" * Keystrokes -- Insert Mode | |
" allow <BkSpc> to delete line breaks, beyond the start of the current | |
" insertion, and over indentations: | |
set backspace=eol,start,indent | |
" have <Tab> (and <Shift>+<Tab> where it works) change the level of | |
" indentation: | |
" inoremap <Tab> <C-T> | |
" inoremap <S-Tab> <C-D> | |
" [<Ctrl>+V <Tab> still inserts an actual tab character.] | |
syntax on | |
set number | |
" set smartindent | |
" set autoindent | |
" set shiftwidth=4 | |
filetype plugin indent on | |
" show existing tab with 4 spaces width | |
set tabstop=4 | |
" when indenting with '>', use 4 spaces width | |
set shiftwidth=4 | |
" On pressing tab, insert 4 spaces | |
set expandtab | |
hi SpellBad ctermfg=015 ctermbg=000 cterm=none guifg=#FFFFFF guibg=#000000 gui=none | |
hi link fortranTab NONE | |
hi clear SpellBad | |
hi SpellBad cterm=underline | |
setlocal spell spelllang=en_gb | |
nnoremap <Tab> :bn<CR> | |
nnoremap <S-Tab> :bf<CR> | |
nnoremap <F3> :NERDTree<CR> | |
set ruler | |
nmap <F5> i<C-R>=strftime("%Y-%m-%d %a %I:%M %p %Z")<CR><Esc> | |
imap <F5> <C-R>=strftime("%Y-%m-%d %a %I:%M %p %Z")<CR> | |
"nmap <Esc>f <Esc>e | |
"imap <Esc>f <Esc>e | |
set noerrorbells visualbell t_vb= | |
" Add argument (can be negative, default 1) to global variable i. | |
" Return value of i before the change. | |
function Inc(...) | |
let result = g:i | |
let g:i += a:0 > 0 ? a:1 : 1 | |
return result | |
endfunction | |
call plug#begin() | |
Plug 'JamshedVesuna/vim-markdown-preview' | |
Plug 'terryma/vim-multiple-cursors' | |
Plug 'frazrepo/vim-rainbow' | |
Plug 'preservim/nerdcommenter' | |
Plug 'itchyny/lightline.vim' | |
Plug 'mileszs/ack.vim' | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
Plug 'preservim/NERDTree' | |
call plug#end() | |
let vim_markdown_preview_github=1 | |
let g:rainbow_active = 1 | |
set updatetime=100 | |
set laststatus=2 | |
let g:lightline = { | |
\ 'colorscheme': 'powerline', | |
\ } | |
" 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 | |
" For everything else, use a tab width of 4 space chars. | |
set tabstop=4 " The width of a TAB is set to 4. | |
" Still it is a \t. It is just that | |
" Vim will interpret it to be having | |
" a width of 4. | |
set shiftwidth=4 " Indents will have a width of 4. | |
set softtabstop=4 " Sets the number of columns for a TAB. | |
set expandtab " Expand TABs to spaces. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment