Skip to content

Instantly share code, notes, and snippets.

@jesperp
Created April 7, 2021 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesperp/97cd28265b270090ad2ca14624157386 to your computer and use it in GitHub Desktop.
Save jesperp/97cd28265b270090ad2ca14624157386 to your computer and use it in GitHub Desktop.
" ---------[ Vim Plugz ]---------
call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'sheerun/vim-polyglot'
Plug 'mattn/emmet-vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'sainnhe/sonokai'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'coc-extensions/coc-svelte', {'do': 'yarn install --frozen-lockfile'}
Plug 'rescript-lang/vim-rescript'
call plug#end()
" -------------------------------
syntax enable
set nu relativenumber
set ruler
set mouse=nv
set noshowmode
set nowrap
set wildcharm=<C-Z> " Like wildchar but only in macros
set iskeyword+=-
" Leader shortcuts
let mapleader=' '
map <Leader>F :Files<CR>
map <Leader>f :GFiles<CR>
"map <Leader>f :Files<CR>
map <Leader>g :Ag<CR>
map <Leader>t :tabnew<CR>
map <Leader>l :tabnext<CR>
map <Leader>b :Buffers<CR>
map <Leader>h :tabprev<CR>
map <Leader>q :q<CR>
map <Leader>w :w<CR>
map <Leader>- /
colorscheme sonokai
au BufNewFile,BufRead *.vue set filetype=html
au BufNewFile,BufRead *.pcss set filetype=css
"
" Remapping
"
nmap <BS> X
nmap <Tab> >>
nmap <S-Tab> <<
nmap <F5> :set hls!<CR>
nmap <Right> <C-i>
nmap <Left> <C-o>
"
" Configuring plugins
"
let g:user_emmet_leader_key=','
let g:vue_pre_processors = 'detect_on_enter'
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [
\ [ 'mode', 'paste' ],
\ [ 'absolutepath', 'filename', 'filetype' ],
\ [ 'readonly', 'modified' ]
\ ],
\ 'right': [
\ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'charvaluehex' ],
\ ],
\ },
\ 'component': {
\ 'charvaluehex': '0x%B',
\ 'bufnum': 'üîß:%n',
\ },
\ }
function! s:GoToDefinition()
if CocAction('jumpDefinition')
return v:true
endif
let ret = execute("silent! normal \<C-]>")
if ret =~ "Error" || ret =~ "ÈîôËØØ"
call searchdecl(expand('<cword>'))
endif
endfunction
" (g)o to (d)efinition
nmap <silent> gd :call <SID>GoToDefinition()<CR>
" (g)o (b)ack
nmap <silent> gp :bp<CR>
" (g)o (f)orward
nmap <silent> gn :bn<CR>
func Eatchar(pat)
let c = nr2char(getchar(0))
return (c =~ a:pat) ? '' : c
endfunc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment