Last active
February 16, 2023 03:01
-
-
Save luiarthur/bae778b7c88f8b702967097292fb25a7 to your computer and use it in GitHub Desktop.
simple vimrc (for vim 7+)
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
" Plugins. | |
call plug#begin() | |
Plug 'luiarthur/tmux.vim' | |
Plug 'luiarthur/red.vim' | |
call plug#end() | |
" Color scheme. | |
silent! colorscheme noir " depends on `luiarthur/red.vim` | |
" Tab / buffer navigation. | |
map <S-Right> :tabnext<CR> | |
map <S-Left> :tabprevious<CR> | |
map <S-Down> :bnext<CR> | |
map <S-Up> :bprevious<CR> | |
" Basic stuff | |
set number " Show line numbers on side. | |
syntax enable " Syntax highlighting | |
set hlsearch " Highlight search items | |
set incsearch " Highlight search items as you type | |
set showmatch " Show matches for parenthesis, etc. | |
set expandtab " Use softtabs | |
set tabstop=2 shiftwidth=2 " Set tab width | |
set autoindent " Automaticall indent lines | |
set nobackup " Don't create .swp | |
set clipboard=unnamedplus " copy and paste to clipboard. | |
set guicursor=a:blinkon0 " disable cursor blinking | |
set laststatus=0 ruler " Hides status bar. The airline plugin seems to ignore this. | |
set splitbelow " vertical splits create windows below by default. | |
set splitright " horizontal splits create window to the right by default. | |
set mouse=a " enable copy / paste using mouse, while in vim. | |
set fillchars=stl:- " fill active window's statusline with - | |
set fillchars+=stlnc:- " also fill inactive windows' statusline with - | |
" Indenting / unindenting in visual mode | |
vmap < <gv | |
vmap > >gv | |
vmap <s-tab> <gv | |
vmap <tab> >gv | |
" disable F1 for help | |
nmap <F1> <nop> | |
" Reset syntax highlight | |
noremap <F10> <ESC>:syntax sync fromstart<CR> | |
inoremap <F10> <C-o>:syntax sync fromstart<CR> | |
" Return to last position | |
augroup return_cursor_to_last_position | |
autocmd! | |
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif | |
augroup END | |
" Always open new files as tabs. | |
" NOTE: tabs can be close with `:bd`. | |
augroup open-tabs | |
au! | |
au VimEnter * ++nested if !&diff | tab all | tabfirst | endif | |
augroup end | |
" Spell check for markdown files. | |
au BufRead *.md setlocal spell | |
" Highlight column 80 | |
" function! MarkCol80() | |
" highlight ColorColumn ctermbg=red | |
" call matchadd('ColorColumn', '\%81v', 100) | |
" endfunction | |
" au BufRead *.{py,jl,R,scala,md} call MarkCol80() | |
" Copy and paste between vim sessions. | |
" Copy the current visual selection to ~/.vbuf. | |
" For servers, uncomment the following lines: | |
vmap <C-S-y> :w! ~/.vbuf<CR> " copy the current visual selection to ~/.vbuf | |
nmap <C-S-p> :r ~/.vbuf<CR> " paste the contents of the buffer file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternatively, we can avoid using
plug.vim
by puttingtmux.vim
in~/.vim/plugin/
, and puttingred.vim
andnoir.vim
in~/.vim/colors/
.