Makes leader space along with other small changes

Adds commets
Adds leader+s to search/replace current word
master
Jonathan Hodgson 5 years ago
parent 1f5857131f
commit 8963766fac
  1. 46
      vimrc

46
vimrc

@ -14,12 +14,13 @@ call pathogen#helptags()
"Leaders {{{1 "Leaders {{{1
let mapleader = "," let mapleader = "\<Space>"
let maplocalleader = "\\" let maplocalleader = "\\"
" Access colors present in 256 colorspace
let base16colorspace=256
let base16colorspace=256 " Access colors present in 256 colorspace " Set my colourscheme
colorscheme base16-gruvbox-dark-hard colorscheme base16-gruvbox-dark-hard
" Config {{{1 " Config {{{1
@ -54,6 +55,9 @@ set path+=**
set wildmenu set wildmenu
set wildignore+=*.min.js,*.min.css,*/node_modules/*,*/dist/* set wildignore+=*.min.js,*.min.css,*/node_modules/*,*/dist/*
" Allows vim to background buffers without saving
set hidden
" Time vim waits to see if you are pushing another key " Time vim waits to see if you are pushing another key
set timeoutlen=500 set timeoutlen=500
@ -78,6 +82,7 @@ set backspace=indent,eol,start
" Show commands as you type them " Show commands as you type them
set showcmd set showcmd
" Highlighting the current line
set cursorline set cursorline
" Make vim default to the plus register (system clipboard) when yanking etc. " Make vim default to the plus register (system clipboard) when yanking etc.
@ -102,6 +107,7 @@ au!
autocmd VimEnter * silent !echo -ne "\e[1 q" autocmd VimEnter * silent !echo -ne "\e[1 q"
augroup END augroup END
" Makes vim try to keep 5 lines visible at the top and bottom
set scrolloff=5 set scrolloff=5
@ -153,11 +159,8 @@ let g:fzf_command_prefix = 'Fzf'
nnoremap <leader>f = :FzfFiles<cr> nnoremap <leader>f = :FzfFiles<cr>
nnoremap <leader>b = :FzfBuffers<cr> nnoremap <leader>b = :FzfBuffers<cr>
nnoremap <leader>h = :FzfHelptags<cr> nnoremap <leader>h = :FzfHelptags<cr>
nnoremap <leader>/ = :FzfRg " Space is important at the end of this command
nnoremap <leader>/ = :FzfRg
" typescript
let g:typescript_indent_disable = 1
" deoplete " deoplete
@ -183,6 +186,12 @@ function! NewLatex()
setlocal filetype=tex setlocal filetype=tex
endfunction endfunction
function! NewShellscript()
read ~/Templates/boilerplate.sh
normal! ggdd
setlocal filetype=bash
endfunction
" Moves to open window, or focuses it " Moves to open window, or focuses it
" https://www.reddit.com/r/vim/comments/8f80o3/awesome_way_to_navigate_windows_and_autocreate/ " https://www.reddit.com/r/vim/comments/8f80o3/awesome_way_to_navigate_windows_and_autocreate/
function! WinMove(key) function! WinMove(key)
@ -227,7 +236,7 @@ nnoremap <leader>cC :w! \| !compiler <c-r>%<CR>
nnoremap <leader>cl :w! \| !compiler <c-r>% letter<CR><CR> nnoremap <leader>cl :w! \| !compiler <c-r>% letter<CR><CR>
nnoremap <leader>cL :w! \| !compiler <c-r>% letter<CR> nnoremap <leader>cL :w! \| !compiler <c-r>% letter<CR>
" Opens the compiled documetn " Opens the compiled documents
" If something like html, it doesn't need to be compiled first " If something like html, it doesn't need to be compiled first
nnoremap <leader>co :!opout <c-r>%<CR><CR> nnoremap <leader>co :!opout <c-r>%<CR><CR>
@ -255,11 +264,16 @@ inoremap <C-v> <Esc>"+pa
" map gV to select previously pasted " map gV to select previously pasted
nnoremap <expr> gV "`[".getregtype(v:register)[0]."`]" nnoremap <expr> gV "`[".getregtype(v:register)[0]."`]"
"
" Makes :w1 work the same as :w! (saves pushing the shift key)
cnoremap w1 w! cnoremap w1 w!
" Same for quitting
cnoremap q1 q!
cnoremap qa1 qa!
" Set :w!! to save with sudo " Set :w!! to save with sudo
cnoremap w!! w !sudo tee % cnoremap w!! w !sudo tee %
" The same but without shift
cnoremap w11 w !sudo tee % cnoremap w11 w !sudo tee %
"Run current line as command "Run current line as command
@ -268,10 +282,12 @@ vnoremap <leader>q !$SHELL <cr>
" Do Shebang line " Do Shebang line
" inoremap <C-y> <Esc>:sil exe ".!which <cWORD>" <bar> s/^/#!/ <bar> filetype detect<cr>YpDi " inoremap <C-y> <Esc>:sil exe ".!which <cWORD>" <bar> s/^/#!/ <bar> filetype detect<cr>YpDi
inoremap <C-y> <Esc>:sil s/^/#!\/usr\/bin\/env / <bar> filetype detect<cr>YpDi inoremap <C-y> <Esc>:sil s/^/#!\/usr\/bin\/env / <bar> filetype detect<cr>:nohl<cr>YpDi
" Makes leader+s replace on the current wordd
nnoremap <leader>s :%s/<C-R>=expand('<cword>')<CR>//g<left><left>
" DO bullet points " Do bullet points
inoremap <C-j> <esc>:exe "norm Ypf lDB\<C-a>"<cr>A inoremap <C-j> <esc>:exe "norm Ypf lDB\<C-a>"<cr>A
" edit vimrc " edit vimrc
@ -280,12 +296,12 @@ nnoremap <leader>sv :source $MYVIMRC<cr>
" add new line without entering insert mode " add new line without entering insert mode
nnoremap <CR> o<Esc> nnoremap <CR> o<Esc>
nnoremap <S-Enter> O<Esc> nnoremap <leader><CR> O<Esc>
" Make jj in insert mode go to normal mode " Make jj in insert mode go to normal mode
inoremap jj <Esc> inoremap jj <Esc>
" Fix previous spelling mistake " Fix previous spelling mistake in insert mode
inoremap <C-l> <c-g>u<Esc>[s1z=`]a<c-g>u inoremap <C-l> <c-g>u<Esc>[s1z=`]a<c-g>u
@ -314,9 +330,11 @@ noremap! <silent> <Esc>[I <nop>
noremap! <silent> <Esc>[O <nop> noremap! <silent> <Esc>[O <nop>
" Url encode and decode current selection
vnoremap <leader>u :B !urlencode<cr> vnoremap <leader>u :B !urlencode<cr>
vnoremap <leader>U :B !urldecode<cr> vnoremap <leader>U :B !urldecode<cr>
" File Type Specific {{{1 " File Type Specific {{{1
"Make web files fold on indent {{{2 "Make web files fold on indent {{{2
augroup file_web augroup file_web

Loading…
Cancel
Save