User Tools

Site Tools


vim:vimrc

VIM - .vimrc


.vimrc
"=== ===
 
" Set 'nocompatible' to ward off unexpected things that your distro might
" have made, as well as sanely reset options when re-sourcing .vimrc
set nocompatible
 
" Specify encoding.
set encoding=utf-8
 
" Specify file encoding.
"et fileencodings=utf-8,iso-2022-jp,sjis,euc-jp
set fileencodings=utf-8
 
" Specify file formats.
set fileformats=unix,dos
 
 
" Take backup.
" if not, specify [ set nobackup ].
set backup
 
" Specify backup directory.
"set backupdir=~/backup
 
" Number of search histories.
set history=50
 
" Terminal Colors.
set t_Co=256
 
 
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif
 
 
 
 
"===========RE-OPEN==========
" 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
 
 
"===========COLORS==========
 
colorscheme badwolf
"colorscheme badwolf
"colorscheme goodwolf
"colorscheme distinguished
"colorscheme vividchalk
"colorscheme mayansmoke
"colorscheme molokai
"colorscheme candy
"colorscheme wombat
 
 
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"#set background=dark
 
 
" Vim5 and later versions support syntax highlighting.
" Uncommenting the next line enables syntax highlighting by default.
" Enable syntax highlighting
"syntax on
 
if has("syntax")
  syntax on
endif
 
 
"==========SELECTING==========
 
" CTRL-A selects all.
map <C-a> <esc>ggVG<CR>
 
 
"==========PASTING==========
 
nnoremap <F2> :set invpaste paste?<CR> " Invert the paste mode.
imap <F2> <C-O>:set invpaste paste?<CR>
set pastetoggle=<F2>                   " Turn paste on or off using this keystroke.
set showmode                           " Displays whether paste is turned on or off.
 
 
" copy paste with the exterior buffers
"vmap <C-c> "+y
"vmap <C-x> "+c
"vmap <C-v> "+gP
"" vmap <C-v> c<ESC>"+p
"imap <C-v> <ESC>"+pa
"nnoremap <C-v> i<ESC>"+pa<ESC>
 
 
 
"==========DISPLAYING SPACES and TABS==========
 
" Display tabs as this amount of spaces.
" Sets tab stops to this amount of spaces.
set tabstop=2
 
 
" Number of spaces a tab key counts for when editing.
set softtabstop=2
 
 
" Turns tabs into spaces.  The tab key will insert spaces instead of tabs.
set expandtab
 
 
" Indentation settings for using 4 spaces instead of tabs.
" " Do not change 'tabstop' from its default value of 8 with this setup.
 
" Set the width for autoindents.
"set shiftwidth=2
set shiftwidth=2
 
 
" Show tabs with a little double arrow and trailing dots, and show whitespace past the end of the line with dots.
"set listchars=tab:»·,trail:·
"set list
 
 
"==========UI Config==========
 
" Display line numbers on the left
"set number
 
 
" Shows the last command entered in the very bottom right.
set showcmd
 
 
" Draws a horizontal highlight on the line the cursor is on.
"set cursorline
"
" highlight current line
highlight CursorLine   cterm=NONE ctermbg=DarkGrey ctermfg=NONE guibg=NONE guifg=NONE
"set cursorline
 
" highlight current column
highlight CursorColumn cterm=NONE ctermbg=DarkGrey ctermfg=NONE guibg=NONE guifg=NONE
"set cursorcolumn
 
 
 
" Attempt to determine the type of a file based on its name and possibly its
" contents.
" Use this to allow intelligent auto-indenting for each filetype, 
" and for plugins that are filetype specific.
" filetype indent on
"filetype indent plugin on
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
if has("autocmd")
  filetype plugin indent on
endif
 
 
 
" Better command-line completion.
" Vim automatically autocompletes things like filenames when you, for
" instance, run :e ~/.vim<TAB>? Well it will provide a graphical menu of all
" the matches you can cycle through if you turn on wildmenu.
set wildmenu
 
 
" Redraw only when we need to.
set lazyredraw
 
 
" When your cursor moves over a parenthesis-like character, the matching one
" will be highlighted as well.
set showmatch
 
 
" Underline the word under the cursor.
"let HlUnderCursor=1
"autocmd CursorMoved * exe exists("HlUnderCursor")?HlUnderCursor?printf('match IncSearch /\V\<%s\>/', escape(expand('<cword>'), '/')):'match none':""
 
 
" Wrap lines.
" if not, specify [ set nowrap ]
set wrap
 
 
" default split to right and below
set splitbelow
set splitright
 
 
"==========SEARCHING==========
 
" Highlight matches.
" Highlight searches (use <C-L> to temporarily turn off highlighting; see
"  the mapping of <C-L> below)
set hlsearch
 
 
" Search as characters are entered.
set incsearch
 
 
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
 
 
" Turn off search highlight
" nnoremap <leader><space> :nohlsearch<CR>
 
 
 
" 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.
"set ignorecase»·»·" Do case insensitive matching
"set smartcase»·»·" Do smart case matching
"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)
 
 
"=========FOLDING==========
 
" Enable folding
"set foldenable
 
 
" Show all folds.
" This opens most folds by default.
"
" foldlevelstart is the starting level for opening a new buffer.  If it is set
" to 0, all folds will be closed.  Setting it to 99 would guarentee folds are
" always open.  So setting it to 10 ensures that only very nested blocks of
" code are folded when opening a buffer.
" If set to zero,·
"set foldlevelstart=10
 
 
" Folds can be nested.  Setting a max on the number of folds guards against
" too many folds.
"set foldnestmax=10
 
 
" Changed the mapping of <space> pretty frequently, but this is its current command.·
" za opens/closes the fold around the current block.
" space open/closes folds
" nnoremap <space> za
 
 
" Fold based on indentation.
" Other acceptable values are marker, manual, expr, syntax, diff.·
" Run :help foldmethod to find out what each of those do.
"set foldmethod=indent
 
 
 
"==========MOVEMENT==========
 
" Move vertically by visual line.
" These two allow us to move around lines visually. So if there's a very long
" line that gets visually wrapped to two lines, j won't skip over the "fake"
" part of the visual line in favor of the next "real" line.
" nnoremap j gj
" nnoremap k gk
 
 
 
" Overwrite existing movement bindings.·
" E and B, which are typically used to move forwards and backwards over visual
" words to these purposes. Next I bound the old way to <nop>.
"
" move to beginning/end of line
" nnoremap B ^
" nnoremap E $
"
" " $/^ doesn't do anything
" nnoremap $ <nop>
" nnoremap ^ <nop>
 
 
 
" It visually selects the block of characters you added last time you were·
" in INSERT mode.
"
" Highlight last inserted text
" nnoremap gV `[v`]
 
 
" Remap displacements between panels.
" Allow one to use CTRL-J or CTRL-K etc to jump UP/DOWN. or CTRL-H or CTRL-L
" to jump LEFT/RIGHT into diff panels.
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
 
 
" tab for self completion
"imap <Tab> <C-P>
 
 
"==========LEADER SHORTCUTS==========
 
" Vim doesn't model undo as a simple stack. In Vim it's a tree.  This makes
" sure you never lose an action in Vim, but also makes it much more difficult
" to traverse around that tree. gundo.vim fixes this by displaying that undo
" tree in graphical form. Get it and don't look back. Here I've mapped it to
" ,u, which I like to think of as "super undo".
"
" toggle gundo
" nnoremap <leader>u :GundoToggle<CR>
 
 
 
 
" When opening a new line and no filetype-specific indenting is enabled, keep
" " the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent
set smartindent
 
 
" Display the cursor position on the last line of the screen or in the status
" " line of a window
set ruler
"
"  " Always display the status line, even if only one window is displayed
set laststatus=2
"
"   " Instead of failing a command because of unsaved changes, instead raise a
"   " dialogue asking if you wish to save changed files.
set confirm
"
"    " Use visual bell instead of beeping when doing something wrong
set visualbell
"
"     " And reset the terminal code for the visual bell. If visualbell is set,
"     and
"     " this line is also included, vim will neither flash nor beep. If
"     visualbell
"     " is unset, this does nothing.
set t_vb=
 
 
" Set the command window height to 2 lines, to avoid many cases of having to
" " "press <Enter> to continue"
"set cmdheight=2
"
 
 
"==========COMMENTS==========
 
" Turn off auto-insert of comment.
"
" vim also provides a pasting register for you to paste text from the system clipboard.·
" You can use \"*p or \"+p depending on your system.·
" On a system without X11, such as OSX or Windows, you have to use the * register.·
" On an X11 system, like Linux, you can use both.
"
" http://vim.wikia.com/wiki/Accessing_the_system_clipboard
"
"augroup auto_comment
"    au!
"    au FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
"augroup END
 
 
" change colors for comments if it's set [ syntax on ]
"highlight Comment ctermfg=LightCyan

.vimrc
"=== ===
 
" Set 'nocompatible' to ward off unexpected things that your distro might
" have made, as well as sanely reset options when re-sourcing .vimrc
set nocompatible
 
set t_Co=256
·
"===========COLORS==========
 
colorscheme badwolf·········
"colorscheme badwolf·········
"colorscheme goodwolf·········
"colorscheme distinguished·········
"colorscheme vividchalk·········
"colorscheme mayansmoke
"colorscheme molokai
"colorscheme candy
"colorscheme wombat
 
 
" Enable syntax highlighting
syntax on
 
 
"==========PASTING==========
 
nnoremap <F2> :set invpaste paste?<CR> " Invert the paste mode.
imap <F2> <C-O>:set invpaste paste?<CR>
set pastetoggle=<F2>                   " Turn paste on or off using this keystroke.
set showmode                           " Displays whether paste is turned on or off.
 
"==========SPACES and TABS==========
 
" Display tabs as this amount of spaces.
" Sets tab stops to this amount of spaces.
set tabstop=2
 
 
" Number of spaces a tab key counts for when editing.
set softtabstop=2
 
 
" Turns tabs into spaces.  The tab key will insert spaces instead of tabs.
set expandtab
 
 
" Indentation settings for using 4 spaces instead of tabs.
" " Do not change 'tabstop' from its default value of 8 with this setup.
 
" Set the width for autoindents.
"set shiftwidth=2
set shiftwidth=2
 
 
" Show tabs with a little double arrow and trailing dots, and show whitespace past the end of the line with dots.
set listchars=tab:»·,trail:·
set list
 
 
"==========UI Config==========
 
" Display line numbers on the left
"set number
 
 
" Shows the last command entered in the very bottom right.
set showcmd
 
 
" Draws a horizontal highlight on the line the cursor is on.
"set cursorline
 
 
" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
" filetype indent on
filetype indent plugin on
 
 
" Better command-line completion.
" Vim automatically autocompletes things like filenames when you, for
" instance, run :e ~/.vim<TAB>? Well it will provide a graphical menu of all
" the matches you can cycle through if you turn on wildmenu.
set wildmenu
 
 
" Redraw only when we need to.
set lazyredraw
 
 
" When your cursor moves over a parenthesis-like character, the matching one
" will be highlighted as well.
set showmatch
 
 
"==========SEARCHING==========
 
" Highlight matches.
" Highlight searches (use <C-L> to temporarily turn off highlighting; see
"  the mapping of <C-L> below)
set hlsearch
 
 
" Search as characters are entered.
set incsearch
 
 
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
 
 
" Turn off search highlight
" nnoremap <leader><space> :nohlsearch<CR>
 
 
 
"=========FOLDING==========
 
" Enable folding
"set foldenable·
 
 
" Show all folds.
" This opens most folds by default.
"
" foldlevelstart is the starting level for opening a new buffer.  If it is set
" to 0, all folds will be closed.  Setting it to 99 would guarentee folds are
" always open.  So setting it to 10 ensures that only very nested blocks of
" code are folded when opening a buffer.
" If set to zero,·
"set foldlevelstart=10
 
 
" Folds can be nested.  Setting a max on the number of folds guards against
" too many folds.
"set foldnestmax=10
 
 
" Changed the mapping of <space> pretty frequently, but this is its current command.·
" za opens/closes the fold around the current block.
" space open/closes folds
" nnoremap <space> za
 
 
" Fold based on indentation.
" Other acceptable values are marker, manual, expr, syntax, diff.·
" Run :help foldmethod to find out what each of those do.
"set foldmethod=indent
 
 
 
"==========MOVEMENT==========
 
" Move vertically by visual line.
" These two allow us to move around lines visually. So if there's a very long
" line that gets visually wrapped to two lines, j won't skip over the "fake"
" part of the visual line in favor of the next "real" line.
" nnoremap j gj
" nnoremap k gk
 
 
 
" Overwrite existing movement bindings.·
" E and B, which are typically used to move forwards and backwards over visual
" words to these purposes. Next I bound the old way to <nop>.
"
" move to beginning/end of line
" nnoremap B ^
" nnoremap E $
"
" " $/^ doesn't do anything
" nnoremap $ <nop>
" nnoremap ^ <nop>
 
 
 
" It visually selects the block of characters you added last time you were·
" in INSERT mode.
"
" Highlight last inserted text
" nnoremap gV `[v`]
 
 
"==========LEADER SHORTCUTS==========
 
" Vim doesn't model undo as a simple stack. In Vim it's a tree.  This makes
" sure you never lose an action in Vim, but also makes it much more difficult
" to traverse around that tree. gundo.vim fixes this by displaying that undo
" tree in graphical form. Get it and don't look back. Here I've mapped it to
" ,u, which I like to think of as "super undo".
"
" toggle gundo
" nnoremap <leader>u :GundoToggle<CR>
 
 
 
 
" When opening a new line and no filetype-specific indenting is enabled, keep
" " the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent
 
 
" Display the cursor position on the last line of the screen or in the status
" " line of a window
set ruler
"··
"  " Always display the status line, even if only one window is displayed
set laststatus=2
"···
"   " Instead of failing a command because of unsaved changes, instead raise a
"   " dialogue asking if you wish to save changed files.
set confirm
"····
"    " Use visual bell instead of beeping when doing something wrong
set visualbell
"·····
"     " And reset the terminal code for the visual bell. If visualbell is set,
"     and
"     " this line is also included, vim will neither flash nor beep. If
"     visualbell
"     " is unset, this does nothing.
set t_vb=
 
 
" Set the command window height to 2 lines, to avoid many cases of having to
" " "press <Enter> to continue"
"set cmdheight=2
"··
 
 
"==========COMMENTS==========
 
" Turn off auto-insert of comment.
"
" vim also provides a pasting register for you to paste text from the system clipboard.·
" You can use \"*p or \"+p depending on your system.·
" On a system without X11, such as OSX or Windows, you have to use the * register.·
" On an X11 system, like Linux, you can use both.
"
" http://vim.wikia.com/wiki/Accessing_the_system_clipboard
"
"augroup auto_comment
"    au!
"    au FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
"augroup END
vim/vimrc.txt · Last modified: 2021/02/11 16:48 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki