Created
July 9, 2018 07:15
-
-
Save hub33k/e30b1f5b200e4f997d6336753e969658 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
" !! FIX !! | |
" comment line in /etc/vimrc - runtime! archlinux.vim | |
" https://www.reddit.com/r/vim/comments/2ib9au/why_does_exiting_vim_make_the_next_prompt_appear/?st=je70fe98&sh=8b9787d4 | |
" vim -u NONE - do not add extra space -- vim -u ~/.vimrc | |
""" | |
" https://realpython.com/blog/python/vim-and-python-a-match-made-in-heaven/ | |
" https://github.com/grigio/vim-sublime/blob/master/vimrc | |
" https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim | |
" https://github.com/nicknisi/dotfiles/blob/master/config/nvim/init.vim | |
" http://stackoverflow.com/questions/5400806/what-are-the-most-used-vim-commands-keypresses/5400978#5400978 | |
" Section General {{{ | |
" Auto reload .vimrc | |
"autocmd bufwritepost .vimrc source % | |
set nocompatible " not compatible with vi | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin('~/.vim/bundle') | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin) | |
source ~/.vim/config/plugins.vim | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" Abbreviations | |
abbr funciton function | |
abbr teh the | |
abbr tempalte template | |
abbr fitler filter | |
" Sets how many lines of history VIM has to remember | |
set history=500 | |
" Set to auto read when a file is changed from the outside | |
set autoread | |
set history=1000 " change history to 1000 | |
set textwidth=120 | |
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
" remove 1 second delay | |
set timeoutlen=1000 ttimeoutlen=0 | |
set splitbelow | |
set splitright | |
" }}} | |
" Section User Interface {{{ | |
syntax on " switch syntax highlighting on | |
set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors" | |
set background=dark | |
colorscheme dracula2 " Set the colorscheme | |
"color dracula2 | |
" use 256 colors in terminal | |
if !has("gui_running") | |
set t_Co=256 | |
set term=xterm-256color " screen-256color | |
endif | |
" make the highlighting of tabs and other non-text less annoying | |
highlight SpecialKey ctermbg=none ctermfg=8 | |
highlight NonText ctermbg=none ctermfg=8 | |
" make comments and HTML attributes italic | |
highlight Comment cterm=italic | |
highlight htmlArg cterm=italic | |
set number " show line numbers | |
" set relativenumber " show relative line numbers | |
set cursorline | |
set cursorcolumn | |
set wrap " turn on line wrapping | |
set wrapmargin=8 " wrap lines when coming within n characters from side | |
set linebreak " set soft wrapping | |
set showbreak=… " show ellipsis at breaking | |
set autoindent " automatically set indent of new line | |
set smartindent | |
" toggle invisible characters | |
set list | |
set listchars=tab:→\ ,eol:¬,trail:⋅,extends:❯,precedes:❮ | |
set showbreak=↪ | |
" highlight conflicts | |
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' | |
" make backspace behave in a sane manner | |
set backspace=indent,eol,start | |
" Tab control | |
set expandtab " insert tabs rather than spaces for <Tab> | |
set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop' | |
set tabstop=2 " the visible width of tabs | |
set softtabstop=2 " edit as if the tabs are 4 characters wide | |
set shiftwidth=2 " number of spaces to use for indent and unindent | |
set shiftround " round indent to a multiple of 'shiftwidth' | |
set completeopt+=longest | |
" code folding settings | |
set foldmethod=syntax " fold based on syntax (indent) | |
set foldnestmax=10 " deepest fold is 10 levels | |
set nofoldenable " don't fold by default | |
set foldlevel=1 | |
set clipboard=unnamed | |
set ttyfast " faster redrawing | |
set diffopt+=vertical | |
set laststatus=2 " show the satus line all the time | |
set showtabline=2 " Always display the tabline, even if there is only one tab | |
set so=7 " set 7 lines to the cursors - when moving vertical | |
set wildmenu " enhanced command line completion | |
set hidden " current buffer can be put into background | |
set showcmd " show incomplete commands | |
"set noshowmode " don't show which mode disabled for PowerLine | |
"set wildmode=list:longest " complete files like a shell | |
set wildmode=longest:full,full | |
set scrolloff=3 " lines of text around cursor | |
set shell=$SHELL | |
set cmdheight=1 " command bar height | |
set title " set terminal title | |
" Searching | |
set ignorecase " case insensitive searching | |
set smartcase " case-sensitive if expresson contains a capital letter | |
set hlsearch " highlight search results | |
set incsearch " set incremental search, like modern browsers | |
set nolazyredraw " don't redraw while executing macros | |
set magic " Set magic on, for regex | |
set showmatch " show matching braces | |
set mat=2 " how many tenths of a second to blink | |
" error bells | |
set noerrorbells | |
set visualbell | |
set t_vb= | |
set tm=500 | |
if has('mouse') | |
set mouse=a | |
endif | |
" set bs=2 " make backspace like normal | |
if &term =~ '^screen' | |
" tmux will send xterm-style keys when its xterm-keys option is on | |
execute "set <xUp>=\e[1;*A" | |
execute "set <xDown>=\e[1;*B" | |
execute "set <xRight>=\e[1;*C" | |
execute "set <xLeft>=\e[1;*D" | |
endif | |
" https://stackoverflow.com/questions/774560/in-vim-how-do-i-get-a-file-to-open-at-the-same-line-number-i-closed-it-at-last | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
\| exe "normal! g'\"" | endif | |
endif | |
" }}} | |
" Section Mappings {{{ | |
let mapleader = "," | |
" We don't have to press shift when we want to get into command mode | |
nnoremap ; : | |
vnoremap ; : | |
" remap esc | |
"inoremap jk <esc> | |
" shortcut to save | |
nmap <leader>, :w<cr> | |
" set paste toggle | |
set pastetoggle=<leader>v | |
" toggle paste mode | |
map <leader>v :set paste!<cr> | |
" Clear match highlighting - clear highlighted search | |
"" noremap <leader><space> :noh<cr>:call clearmatches()<cr> | |
noremap <space> :set hlsearch! hlsearch?<cr> | |
"split navigations | |
"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> | |
" edit ~/.vimrc | |
map <leader>ev :e! ~/.vimrc<cr> | |
" edit gitconfig | |
map <leader>eg :e! ~/.gitconfig<cr> | |
" reload ~/.vimrc | |
map <leader>rv :so ~/.vimrc<cr> | |
" remove extra whitespace | |
" nmap <leader><space> :%s/\s\+$<cr> " todo removed becouse of clear highlighting shortcut (see above) | |
" switch between current and last buffer | |
"nmap <leader>. <c-^> | |
" toggle cursor line | |
nnoremap <leader>i :set cursorline!<cr> | |
" helpers for dealing with other people's code | |
"nmap \t :set ts=2 sts=2 sw=2 noet<cr> | |
"nmap \s :set ts=2 sts=2 sw=2 et<cr> | |
" scroll the viewport faster | |
nnoremap <C-e> 3<C-e> | |
nnoremap <C-y> 3<C-y> | |
" Quick quit | |
noremap <Leader>e :quit<CR> " Quit current window | |
noremap <Leader>E :qa!<CR> " Quit all windows | |
" Quicksave | |
noremap <C-Z> :update<CR> | |
vnoremap <C-Z> <C-C>:update<CR> | |
inoremap <C-Z> <C-O>:update<CR> | |
" Use sane regex's when searching | |
nnoremap / /\v | |
vnoremap / /\v | |
" Fast saving | |
nmap <leader>w :w!<cr> | |
" :W sudo saves the file | |
" (useful for handling the permission-denied error) | |
"command W w !sudo tee % > /dev/null | |
" fix ctrl + arrow | |
"map <ESC>[5D <C-Left> | |
"map <ESC>[5C <C-Right> | |
"map! <ESC>[5D <C-Left> | |
"map! <ESC>[5C <C-Right> | |
" }}} | |
" Section Plugins {{{ | |
" Powerline | |
"set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/ | |
set rtp+=/usr/lib/python3.6/site-packages/powerline/bindings/vim | |
" NERDTree | |
"autocmd VimEnter * NERDTree " opens NERDTree | |
nmap <silent> <F3> :NERDTreeToggle<CR> " NERDTree, Use F3 for toggle NERDTree | |
" }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment