Skip to content

Instantly share code, notes, and snippets.

@kjaymiller
Last active May 23, 2019 16:04
Show Gist options
  • Save kjaymiller/f8d96970e956a530a6b0cbf89c7cf341 to your computer and use it in GitHub Desktop.
Save kjaymiller/f8d96970e956a530a6b0cbf89c7cf341 to your computer and use it in GitHub Desktop.
My Vimrc File
" Basic Setup:
" From Thoughtbot Talk: https://www.youtube.com/watch?v=XA2WjJbmmoM&t=262s
set nocompatible
" Finding Files:
" Provide tab-completion for all file-related tasks
" ** == Search Recursively
set path+=**
set wildmenu
" Set Tags
"
command! Mt !ctags -R .
"
" Sets the Numbering and the Numberwidth. Also Sets the Relative Numbering
set nu numberwidth=5 relativenumber
" Remove the entire line
nnoremap - dd
" set mapleader to spacebar
let mapleader = ";"
nnoremap <leader>l $
nnoremap <leader>h ^
" Select the entire word with the spacebar
" nnoremap <space> viw
" Test. Delete entire line with tab-d
nnoremap <tab>d dd
nnoremap _ ddp
nnoremap + ddkkp
xnoremap K :move '<-2<CR>gv=gv
xnoremap J :move '>+1<CR>gv=gv
nnoremap <CR><leader>w <C-w>
au BufNewFile,BufRead *.js
\ inoremap ;d def ():<Esc>2hp |
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
au BufNewFile,BufRead *.html
\ inoremap ;d def ():<Esc>2hp |
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
au BufNewFile,BufRead *.py
\ inoremap ;d def ():<Esc>2hp |
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
syntax enable
filetype plugin indent on
inoremap jk <ESC>
" Sets New Windows into to the right and down
:set splitright
:set splitbelow
" 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>
nnoremap sl <C-l>
nnoremap sh <C-h>
nnoremap sj <C-j>
nnoremap sk <C-k>
nnoremap ; :
nnoremap ;;w <C-W>
"
" Snippets
nnoremap ,api :-1read $HOME/.config/nvim/snippets/apispec.yaml<CR>4l
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
"Numbered Lines and Relative Numbers
set number
set relativenumber
set autoindent
set smartindent
set showmatch
set foldenable
set shiftwidth=2
set tabstop=2
inoremap jk <ESC>
command EditConfig edit ~/.config/nvim/init.vim
" highlight next line
highlight ColorColumn ctermbg=red
call matchadd('ColorColumn', '\%81v', 100)
set nowrap
"List Tabs and Trailing Whitespace
set list
exec "set listchars=tab:\u1F4-"
" disable arrow keys
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
:set splitright
:set splitbelow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment