Created
January 20, 2018 22:55
-
-
Save davydog187/c4bf38a76ce2eeadb4359d25f90e1fef to your computer and use it in GitHub Desktop.
Stripped down vimrc for ubuntu
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
" .vimrc | |
" !silent is used to suppress error messages if the config line | |
" references plugins/colorschemes that might be missing | |
" Disable Vi compatibility | |
set nocompatible | |
if has("autocmd") | |
" Load files for specific filetypes | |
filetype on | |
filetype indent on | |
filetype plugin on | |
" Languages with specific tabs/space requirements | |
autocmd FileType make setlocal ts=4 sts=4 sw=4 noexpandtab | |
endif | |
" Enable syntax highlighting | |
syntax enable | |
if has("nvim") | |
" set termguicolors | |
endif | |
if has("cmdline_info") | |
" Show the cursor line and column number | |
set ruler | |
" Show partial commands in status line | |
set showcmd | |
" Show whether in insert or replace mode | |
set showmode | |
endif | |
if has("wildmenu") | |
" Show a list of possible completions | |
set wildmenu | |
" Tab autocomplete longest possible part of a string, then list | |
set wildmode=longest,list | |
if has ("wildignore") | |
set wildignore+=*.a,*.pyc,*.o,*.orig | |
set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png | |
set wildignore+=.DS_Store,.git,.hg,.svn | |
set wildignore+=*~,*.sw?,*.tmp | |
endif | |
endif | |
if has("extra_search") | |
" Highlight searches [use :noh to clear] | |
set hlsearch | |
" Highlight dynamically as pattern is typed | |
set incsearch | |
" Ignore case of searches... | |
set ignorecase | |
" ...unless has mixed case | |
set smartcase | |
endif | |
" Open vertical split to the right | |
set splitbelow splitright | |
" Configure fzf https://github.com/junegunn/fzf.vim#commands | |
nnoremap <c-p> :Files<cr> | |
nnoremap <c-m> :History<cr> | |
let g:ackprg = 'rg --vimgrep --no-heading' | |
" nnoremap <c-m> :CtrlPMRU<cr> | |
" Set hidden tabs | |
set hidden | |
" Change mapleader | |
let mapleader="," | |
" Backspace through everything in INSERT mode | |
set backspace=indent,eol,start | |
" Optimize for fast terminal connections | |
set ttyfast | |
" Use UTF-8 without BOM | |
set encoding=utf-8 | |
" Use line wrapping | |
set wrap | |
" Use 4 spaces for indentation | |
set shiftwidth=4 | |
" Use 4 spaces for soft tab | |
set softtabstop=4 | |
" Use 4 spaces for tab | |
set tabstop=4 | |
" Expand tab to spaces | |
set expandtab | |
" Enable relative line numbers + current | |
set relativenumber | |
set number | |
" Highlight current line | |
" set cursorline | |
" Start scrolling three lines before the horizontal window border | |
set scrolloff=3 | |
" Don’t reset cursor to start of line when moving around. | |
set nostartofline | |
" Show 'invisible' characters | |
set list | |
" Set characters used to indicate 'invisible' characters | |
set listchars=tab:▸\ | |
set listchars+=trail:· | |
set listchars+=nbsp:_ | |
"set listchars+=eol:¬ | |
" Strip trailing whitespace (,$) | |
noremap <leader>$ :call s:StripTrailingWhitespace()<CR> | |
" Faster viewport scrolling (3 lines at a time) | |
nnoremap <C-e> 3<C-e> | |
nnoremap <C-y> 3<C-y> | |
vnoremap <C-e> 3<C-e> | |
vnoremap <C-y> 3<C-y> | |
" Ack mapping | |
" Use silver searcher | |
" let g:ackprg = 'ag --nogroup --nocolor --column' | |
nnoremap <C-a><C-p> :Ack<space> | |
nnoremap <C-a><C-j> :Ack<space>-tjs<space> | |
nnoremap <C-a><C-e> :Ack<space>-telixir<space> | |
nnoremap <C-a><C-s> :Ack<space>-tsass<space> | |
let NERDTreeIgnore = ['\.meta$', '\.prefab$'] | |
set clipboard=unnamed | |
" Make `Y` work from the cursor to the end of line (which is more logical) | |
nnoremap Y y$ | |
set guioptions-=L | |
" ----- Mappings learned from Learn Vimscript the hard way | |
" Move the current line down | |
nnoremap <leader>- ddp | |
" Move the current line up | |
nnoremap <leader>_ ddkP | |
" \ will delete a line in mormal mode | |
nnoremap <leader>\ dd | |
" \ will uppercase a line in visual mode | |
vnoremap <leader>\ U | |
" convert the current word to uppercase | |
nnoremap <c-u> viwUe | |
inoremap <c-u> <esc>viwUe | |
" Make space more useful (I think this would do a fold?) | |
" nnoremap <space> za | |
" Open and save vimrc easily | |
nnoremap <leader>ev :vsplit $MYVIMRC<cr> | |
nnoremap <leader>sv :source $MYVIMRC<cr> | |
" Delete all swap files | |
nnoremap <leader>ds :! rm $HOME/.vim/swaps/*<cr> | |
" Open tmux config easily | |
nnoremap <leader>et :vsplit ~/.tmux.conf<cr> | |
" Common mispellings | |
iabbrev adn and | |
" Go to the beginning of the line | |
nnoremap H 0 | |
nnoremap L $ | |
" Surround current word with quotes | |
nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel | |
nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>lel | |
vnoremap <leader>" <esc>`<i"<esc>`>la"<esc>lel | |
" Toggle line numbers | |
nnoremap <leader>n :set number!<cr> | |
" Relative line numbers | |
nnoremap <leader>rn :set rnu!<cr> | |
" Escape insert mode with jk | |
inoremap jk <esc> | |
inoremap <esc> <nop> | |
vnoremap jk <esc> | |
vnoremap <esc> <nop> | |
" Fugitive bindings | |
nnoremap <leader>gb :Git branch -v<cr> | |
nnoremap <leader>gB :Gblame<cr> | |
nnoremap <leader>gs :Gstatus<cr> | |
nnoremap <leader>gd :Git diff<cr> | |
" Change tabs to 4 spaces | |
nnoremap <leader>ct :%s/\t/ /g<cr> | |
if has("autocmd") | |
augroup filetype_elixir | |
au! | |
autocmd FileType elixir autocmd BufEnter * :syntax sync fromstart | |
augroup END | |
endif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment