Skip to content

Instantly share code, notes, and snippets.

@wamoyo wamoyo/init.vim

Last active May 9, 2020
Embed
What would you like to do?
nvimrc
filetype plugin indent on
" Setting up vim plug
call plug#begin('~/.config/nvim/plugged')
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
Plug 'scrooloose/nerdtree'
Plug 'garbas/vim-snipmate'
Plug 'tpope/vim-surround'
Plug 'vim-scripts/matchit.zip'
Plug 'ervandew/supertab'
Plug 'vim-scripts/ctrlp.vim'
Plug 'terryma/vim-multiple-cursors'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-repeat'
Plug 'benknoble/vim-synstax'
Plug 'pangloss/vim-javascript'
Plug 'digitaltoad/vim-pug'
Plug 'wavded/vim-stylus'
" Plug 'timakro/vim-searchant'
" Plug 'othree/eregex.vim'
" Plug 'itchyny/lightline.vim'
" Plug 'AutoClose'
" Plug 'mattn/emmet-vim'
call plug#end()
" Basic Settings
set termguicolors
colorscheme xoria256
set nofoldenable
set foldmethod=manual
augroup remember_folds
autocmd!
autocmd BufWinLeave * mkview
autocmd BufWinEnter * silent! loadview
augroup END
set relativenumber
set number
autocmd TermOpen * setlocal nonumber norelativenumber
set expandtab
set tabstop=2
set shiftwidth=2
set autoindent
set hidden
set nowrap
set linebreak
set virtualedit=all
set listchars=tab:>>,trail:~,extends:…,precedes:
set list
set wildmenu
set laststatus=0
set completeopt=
set iskeyword+=-
set confirm
set undofile
set title
set titlestring=%F
" Open vimrc
nnoremap <F9> :edit ~/.config/nvim/init.vim <Enter>
" Open snippets
nnoremap <F7> :edit ~/.config/nvim/plugged/vim-snipmate/snippets/html.snippets <Enter> :edit ~/.config/nvim/plugged/vim-snipmate/snippets/css.snippets <Enter> :edit ~/.config/nvim/plugged/vim-snipmate/snippets/javascript.snippets <Enter> :edit ~/.config/nvim/plugged/vim-snipmate/snippets/json.snippets <Enter> :edit ~/.config/nvim/plugged/vim-snipmate/snippets/jade.snippets <Enter> :edit ~/.config/nvim/plugged/vim-snipmate/snippets/stylus.snippets <Enter> :edit ~/.config/nvim/plugged/vim-snipmate/snippets/svg.snippets <Enter>
" ctrlP key combo
let g:ctrlp_map = 'gl'
" NERDTree key combo
nmap gf :NERDTreeToggle<cr>
autocmd FileType nerdtree nmap <buffer> o go
autocmd FileType nerdtree nmap <buffer> go o
" Wrap Toggle
function! ToggleWrap()
if g:wrapped
set nowrap
set list
set nobreakindent
nnoremap j j
nnoremap k k
let g:wrapped = 0
else
set wrap
set nolist
set breakindent
vnoremap j gj
vnoremap k gk
nnoremap j gj
nnoremap k gk
let g:wrapped = 1
endif
endfunction
let g:wrapped = 0
nnoremap gw :call ToggleWrap() <Enter>
" Remapping Keys
nnoremap t g;zz
vnoremap t g;zz
nnoremap T g,zz
vnoremap T g,zz
"onoremap 0 ^
"nnoremap 0 ^
"vnoremap 0 ^
onoremap - $
nnoremap - $
vnoremap - $
nnoremap m <C-o>
vnoremap m <C-o>
nnoremap M <C-i>
vnoremap M <C-i>
nnoremap ; :
vnoremap ; :
nnoremap e el
vnoremap e el
"nnoremap <C-y> "+y
vnoremap <C-y> "+y
nnoremap <C-p> "+gP
vnoremap <C-p> "+gP
nnoremap P "0P
vnoremap P "0P
nnoremap p P
vnoremap p P
nnoremap o O
nnoremap o O
vnoremap O o
vnoremap O o
nnoremap U <C-r>
nnoremap <silent> <esc> :noh<cr>
inoremap jj <Esc>l
inoremap kk <Esc>l
nnoremap J <C-e>
vnoremap J <C-e>
nnoremap K <C-y>
vnoremap K <C-y>
nnoremap S :wa <CR>
nnoremap s :w <CR>
nnoremap gb :bn <Enter>
nnoremap gB :bp <Enter>
nnoremap <C-w> :w <Enter> :bw <Enter>
nnoremap <C-q> :wa <Enter> :q <Enter>
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-h> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
nmap <silent> <A-l> :wincmd l<CR>
tnoremap <Esc> <C-\><C-n>
" Searchant settings
" let g:searchant_map_stop=0
" nmap <Esc> <Plug>SearchantStop
" commentary.vim plugin
" Visual mode
xmap \ <Plug>Commentary
" Normal mode
nmap \ <Plug>Commentary
" Normal mode, current line
nmap \\ <Plug>CommentaryLine
" Operator pending mode (this lets you do e.g. `dgc` to delete a block of comments)
omap \ <Plug>Commentary
" Special case cgc (you can skip this one, but then `cgc` will also delete an extra blank line)
" nmap cgc <Plug>ChangeCommentary
" some more settings
let g:terminal_scrollback_buffer_size = 100000
" let html_no_rendering=1
" let g:javascript_plugin_jsdoc = 1
" let g:vim_json_syntax_conceal = 0
" autocmd BufNewFile,BufRead *.pug set filetype=pug
" autocmd BufNewFile,BufRead *.styl set filetype=stylus
" autocmd BufNewFile,BufRead *.json set filetype=json
autocmd BufEnter * setlocal formatoptions-=cro
syntax on
" Avoid E173 (n more file(s) to edit)
" if argc() > 1
" au VimEnter * args %
" filetype on
" syntax on
" endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.