Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:jackjoe/vim
Browse files Browse the repository at this point in the history
* 'master' of github.com:jackjoe/vim:
  chore: cleanup
  chore: cleanup
  tsserver
  • Loading branch information
pierot committed Jun 28, 2021
2 parents fac525e + 899a427 commit 23581e7
Showing 1 changed file with 4 additions and 149 deletions.
153 changes: 4 additions & 149 deletions vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Plug 'ervandew/supertab'
Plug 'kana/vim-textobj-user'
Plug 'kana/vim-textobj-line'
Plug 'andyl/vim-textobj-elixir'
Plug 'junegunn/vim-easy-align'
Plug 'janko-m/vim-test'

" Nerdtree
Expand Down Expand Up @@ -54,15 +53,13 @@ Plug 'mattn/emmet-vim'

" vim-scripts repos
Plug 'vim-scripts/L9'
" Plug 'vim-scripts/tComment'

" Yank fix
Plug 'bfredl/nvim-miniyank'

" }}}

" General {{{
" map : to ; for qwerty
noremap ; :
set encoding=utf8
Expand Down Expand Up @@ -115,12 +112,6 @@ set shiftround " use multiple of shiftwidth when indenting with
set expandtab
set wrap " set linewrap

function! Tab4Losers()
set softtabstop=4
set shiftwidth=4
set tabstop=4
endfunction

set lbr
set tw=500
set autoindent
Expand Down Expand Up @@ -149,16 +140,8 @@ if v:version > 703 || v:version == 703 && has('patch541')
set formatoptions+=j
endif

" in makefiles, don't expand tabs to spaces, since actual tab characters are
" needed, and have indentation at 8 chars to be sure that all indents are tabs
" (despite the mappings later):
" autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=0

" == Silver Searcher ===========================

" Ag
" brew install the_silver_searcher
" apt-get install silversearcher-ag
if executable('rg')
let g:ackprg = 'rg --vimgrep'
elseif executable('ag')
Expand Down Expand Up @@ -191,8 +174,7 @@ set completeopt=longest,menuone,preview " better completion
set wildmenu " enable ctrl-n and ctrl-p to scroll thru matches
set wildmode=longest:full,list:longest
set wildignore=*.o,*.obj,*~ " stuff to ignore when tab completing
set wildignore+=*node_modules*
set wildignore+=*vim/backups*
set wildignore+=*node_modules*,*vim/backups*
set wildignore+=.git,.yarn " ignore the .git directory
set wildignore+=*.DS_Store " ignore Mac finder/spotlight crap
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.DS_Store
Expand All @@ -204,31 +186,21 @@ endif

" == Color + font ===================================

set ffs=unix,mac,dos " Support all three, in this order
set ffs=unix,mac,dos " Support all three, in this order

" == Git/SVN Errors =====================================

match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'

" == Filetypes =======================================

au BufRead,BufNewFile *.module,*.inc,*.install set filetype=php
au BufRead,BufNewFile *.less,*.scss set filetype=css
au BufRead,BufNewFile *.handlebars,*.hbs set filetype=handlebars
au BufRead,BufNewFile *.tmpl,*.vue set filetype=html
au BufRead,BufNewFile *.go set filetype=go
au BufRead,BufNewFile *.ru,*.rb,Deliverfile set filetype=ruby
au BufNewFile,BufRead Fastfile,Appfile,Snapfile set filetype=ruby
au BufNewFile,BufRead Scanfile,Gymfile,Matchfile set filetype=ruby

" Haskell
" autocmd FileType haskell setlocal expandtab shiftwidth=2 softtabstop=2
" au Bufenter *.hs,*.lhs compiler ghc
" " Extra syntax highlighting
" au BufRead,BufNewFile {Capfile,Gemfile,Rakefile,Thorfile,.caprc,.irbrc,irb_tempfile*} set ft=ruby
" " Spell check certain filetypes (eg Markdown)
" autocmd BufRead,BufNewFile *.md,*.txt setlocal spell

" Searching {{{
set hlsearch " Highlight search things
set incsearch " Make search act like search in modern browsers
Expand All @@ -252,14 +224,6 @@ set mousehide " hide mouse pointer when typing
" Supertab {{{
let g:SuperTabDefaultCompletionType = "<c-n>"
" }}}
"
" Easy Align {{{
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" }}}

" == Yank ================================

Expand All @@ -268,21 +232,6 @@ map p <Plug>(miniyank-autoput)
map P <Plug>(miniyank-autoPut)
" }}}

" == Statusline =========================

function! CurDir()
let curdir = substitute(getcwd(), '/Users/', "~/..", "g")
return curdir
endfunction

function! HasPaste()
if &paste
return 'PASTE MODE '
else
return ''
endif
endfunction

" == Mouse =============================

" Enable mouse in all modes. -> https://bitheap.org/mouseterm/
Expand Down Expand Up @@ -317,26 +266,6 @@ nnoremap k gk
nnoremap gV `[v`]
" }}}

command! KillWhitespace :call StripTrailingWhitespaces()<CR>
function! StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction

" Clean windows weird characters
command! CleanWindowsShit :call CleanWindowsCharacters()<CR>
function! CleanWindowsCharacters()
:%s/\\\\\
//g
endf

" Sudo to write
cmap w!! w !sudo tee % >/dev/null
command! -nargs=0 Sw w !sudo tee % > /dev/null
Expand All @@ -356,9 +285,6 @@ noremap gI `.
" split line and preserve cursor position
nnoremap S mzi<CR><ESC>`z
" escape insert mode
" inoremap jj <ESC>

" == Paste mode ===============================

nnoremap <F2> :set invpaste paste?<CR> " Enable F2 key for toggling pastemode
Expand All @@ -378,7 +304,7 @@ map <leader><leader>l :s/\s\+$//e<CR>:'<,'>s/^/<li>/g<CR>:'<,'>s/$/<\/li>/g<CR>:
" == fzf ===================================

nmap <C-p> :Files<CR>
" nmap <C-t> :Tags<CR>
nmap <C-t> :Tags<CR>
" == Emmet (previously Zencoding) ==========

Expand Down Expand Up @@ -453,46 +379,12 @@ endif
" Do not interfere with vim mapping
inoremap <c-x><c-k> <c-x><c-k>
" == Highlight =========================
" Highlight words to avoid in production

" highlight TechWordsToAvoid ctermbg=red ctermfg=white
" match TechWordsToAvoid /\cconsole\|var_dump\|print_r\|alert\|console/
" autocmd BufWinEnter * match TechWordsToAvoid /\cconsole\|var_dump\|print_r\|alert\|console/
" autocmd InsertEnter * match TechWordsToAvoid /\cconsole\|var_dump\|print_r\|alert\|console/
" autocmd InsertLeave * match TechWordsToAvoid /\cconsole\|var_dump\|print_r\|alert\|console/
" autocmd BufWinLeave * call clearmatches()

" == Javascript =============================

let g:javascript_plugin_flow = 1

" == Prettier =========================

" when running at every change you may want to disable quickfix
" let g:prettier#quickfix_enabled = 0
" let g:prettier#quickfix_auto_focus = 0
"
" let g:prettier#autoformat = 0
"
" let g:prettier#config#tab_width = 2
" let g:prettier#config#print_width = 80
" let g:prettier#config#use_tabs = 'false'
" let g:prettier#config#single_quote = 'true'
" let g:prettier#config#bracket_spacing = 'false'
" let g:prettier#config#jsx_bracket_same_line = 'false'
" let g:prettier#config#arrow_parens = 'avoid'
" let g:prettier#config#semi = 'false'
" let g:prettier#config#trailing_comma = 'es5'
" let g:prettier#config#parser = 'babel'
" let g:prettier#config#html_whitespace_sensitivity = 'css'
"
" autocmd BufWritePre *.js,*.json,*.css,*.scss,*.less,*.graphql Prettier
" autocmd BufWritePre *.md Prettier
" autocmd BufWritePre *.php if expand('%') !~ "blade.php" | Prettier
" autocmd BufWritePre *.php Prettier
" autocmd FileType php let b:prettier_ft_default_args = { 'parser': 'php' }

" no save all, to prevent prettier errors
noremap :wq<cr> <nop>
noremap :x<cr> <nop>
Expand All @@ -505,7 +397,6 @@ map :x<cr> <nop>

" roll our own
autocmd BufWritePost *.exs,*.ex silent :!source .env && mix format --check-equivalent %
" let g:mix_format_on_save = 1

" == Coc ===========================================================

Expand Down Expand Up @@ -541,36 +432,6 @@ else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif

" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Remap for format selected region
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" augroup mygroup
" autocmd!
" " Setup formatexpr specified filetype(s).
" autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" " Update signature help on jump placeholder
" autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
" augroup end

" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Fix autofix problem of current line
" nmap <leader>qf <Plug>(coc-fix-current)

" Use <tab> for select selections ranges, needs server support, like: coc-tsserver, coc-python
nmap <silent> <TAB> <Plug>(coc-range-select)
xmap <silent> <TAB> <Plug>(coc-range-select)
Expand All @@ -589,7 +450,7 @@ command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organize
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}

" CoC
let g:coc_global_extensions = ['coc-eslint', 'coc-flow', 'coc-css', 'coc-json', 'coc-pyls', 'coc-yaml', 'coc-ultisnips', 'coc-snippets', 'coc-elixir', 'coc-tailwindcss', 'coc-tag', 'coc-highlight', 'coc-lists', 'coc-phpls', 'coc-diagnostic', 'coc-prettier', 'coc-tsserver']
let g:coc_global_extensions = ['coc-eslint', 'coc-css', 'coc-json', 'coc-pyls', 'coc-yaml', 'coc-ultisnips', 'coc-snippets', 'coc-elixir', 'coc-tailwindcss', 'coc-tag', 'coc-highlight', 'coc-lists', 'coc-phpls', 'coc-diagnostic', 'coc-prettier', 'coc-tsserver']

" == path helpers ====================================================

Expand Down Expand Up @@ -632,12 +493,6 @@ nnoremap <leader>ts :TestSuite<CR> " test suite
nnoremap <leader>tf :TestFile<CR> " test single file
nnoremap <leader>tn :TestNearest<CR> " test nearest
" == git (fugitive) ==================================================

" nnoremap <leader>gs :Gstatus<CR>
" nnoremap <leader>gp :Gpush<CR>
" nnoremap <leader>gl :Gpull<CR>

" == User defined plugs =====================

if filereadable(expand("~/.vimrc.plugs.local"))
Expand Down

0 comments on commit 23581e7

Please sign in to comment.