Skip to content

sync 20191115 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .coc.vim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let g:coc_global_extensions = ['coc-json', 'coc-tsserver', 'coc-eslint', 'coc-pairs', 'coc-git']
let g:coc_global_extensions = ['coc-json', 'coc-tsserver', 'coc-eslint', 'coc-pairs', 'coc-git', 'coc-css', 'coc-html', 'coc-jest', 'coc-java']

" if hidden is not set, TextEdit might fail.
set hidden
Expand Down Expand Up @@ -72,10 +72,13 @@ autocmd CursorHold * silent call CocActionAsync('highlight')

" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
nmap <F2> <Plug>(coc-rename)

" Remap for format selected region
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
xmap <leader>fs <Plug>(coc-format-selected)
nmap <leader>fs <Plug>(coc-format-selected)
xmap <leader>ff :Format<cr>
nmap <leader>ff :Format<cr>

augroup mygroup
autocmd!
Expand All @@ -100,10 +103,6 @@ xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)

" Use <C-d> for select selections ranges, needs server support, like: coc-tsserver, coc-python
"nmap <silent> <C-d> <Plug>(coc-range-select)
"xmap <silent> <C-d> <Plug>(coc-range-select)

" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')

Expand All @@ -124,5 +123,9 @@ nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
" undo change with coc-git
nnoremap <space>r :CocCommand git.chunkUndo<cr>
nnoremap <leader>z :CocCommand git.chunkUndo<cr>

" Run jest for current project
command! -nargs=0 Jest :call CocAction('runCommand', 'jest.projectTest')
" Run jest for current file
command! -nargs=0 JestCurrent :call CocAction('runCommand', 'jest.fileTest', ['%'])
8 changes: 7 additions & 1 deletion .config/alacritty/alacritty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,13 @@ key_bindings:
- { key: Q, mods: Command, action: Quit }
- { key: W, mods: Command, action: Quit }
- { key: F, mods: Command|Control, action: ToggleFullscreen }
- { key: N, mods: Command, action: SpawnNewInstance }
- { key: N, mods: Command, action: SpawnNewInstance }
# My Custom Bindings, http://defindit.com/ascii.html
- { key: Q, mods: Control, chars: "\x11" }
- { key: S, mods: Alt, chars: "\x1bs" }
- { key: F, mods: Alt, chars: "\x1bF" }
- { key: Return, mods: Shift, chars: "\x1b[13;2u" }
- { key: Return, mods: Control, chars: "\x1b[13;5u" }

- { key: Paste, action: Paste }
- { key: Copy, action: Copy }
Expand Down
2 changes: 2 additions & 0 deletions .config/fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ set -g theme_display_git_master_branch yes
abbr top "htop"
abbr vi "nvim"
abbr cat "bat"
abbr gpl "git pull"
abbr gps "git push"
# usage: yaml2js < test.yaml > out.json
alias yaml2js="python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)'"

Expand Down
4 changes: 2 additions & 2 deletions .config/fish/functions/wttr.fish
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ function wttr
else
set language (string split "_" -- $LANG)[1]
end

curl -H "Accept-Language: $language" wttr.in/$location
# 'F' option to not show the "Follow" line
curl -H "Accept-Language: $language" "wttr.in/$location?F"
end
5 changes: 2 additions & 3 deletions .config/nvim/coc-settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":true,
"git.addGlameToBufferVar": true,
// "git.addGlameToVirtualText": true
// "java.jdt.ls.home": "~/Develop/jdt-ls-0.45.0",
"git.addGBlameToBufferVar": true,
"java.jdt.ls.home": "{HOME}/Develop/jdt-ls-0.45.0",
"eslint.filetypes": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
}
21 changes: 15 additions & 6 deletions .config/nvim/init.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
Expand All @@ -19,14 +20,22 @@ inoremap <C-k> <Esc><C-w>k
inoremap <C-l> <Esc><C-w>l

" Quickly create a new terminal in a vertical split
tnoremap <C-b> <C-\><C-n>:vsp<CR><C-w><C-w>:term<CR>
noremap <C-b> :vsp<CR><C-w><C-w>:term<CR>
inoremap <C-b> <Esc>:vsp<CR><C-w><C-w>:term<CR>
tnoremap <leader>vs <C-\><C-n>:vsp<CR><C-w><C-w>:term<CR>
noremap <leader>vs :vsp<CR><C-w><C-w>:term<CR>
" inoremap <leader>vs <Esc>:vsp<CR><C-w><C-w>:term<CR>

" Quickly create a new terminal in a horizontal split
tnoremap <C-_> <C-\><C-n>:sp<CR><C-w><C-w>:term<CR>
noremap <C-_> :sp<CR><C-w><C-w>:term<CR>
inoremap <C-_> <Esc>:sp<CR><C-w><C-w>:term<CR>

noremap <C-_> :sp<CR><C-w><C-w>:term<CR>
" inoremap <C-_> <Esc>:sp<CR><C-w><C-w>:term<CR>
tnoremap <leader>sp <C-\><C-n>:sp<CR><C-w><C-w>:term<CR>
noremap <leader>sp :sp<CR><C-w><C-w>:term<CR>
" inoremap <leader>vs <Esc>:sp<CR><C-w><C-w>:term<CR>
"
nmap 7 :res +2<CR> " increase pane by 2
nmap 8 :res -2<CR> " decrease pane by 2
nmap 9 :vertical res +2<CR> " vertical increase pane by 2
nmap 0 :vertical res -2<CR> " vertical decrease pane by 2

" live preview substitution.
set inccommand=nosplit
8 changes: 4 additions & 4 deletions .tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ bind - split-window -v -c "#{pane_current_path}"
bind \ split-window -h -c "#{pane_current_path}"

# pane navigation
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
bind -r k select-pane -U # move up
bind -r l select-pane -R # move right
bind h select-pane -L # move left
bind j select-pane -D # move down
bind k select-pane -U # move up
bind l select-pane -R # move right
bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
## quick pane cycling
Expand Down
42 changes: 36 additions & 6 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use space as leader key
let mapleader = "\<Space>"
" set nu
"use comma as leader key
let mapleader = ","
autocmd BufRead,BufNewFile *.ts,*.json,*.js,*.html,Jenkinsfile,Gearsfile,Bogiefile setlocal number
color cobalt2
syntax on
set hlsearch
Expand Down Expand Up @@ -59,11 +59,16 @@ if empty(argv())
endif
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.DS_Store$', '\~$', '\.git']
" let g:NERDTreeChDirMode = 2
let g:NERDTreeChDirMode = 2

" map ctrl + m to toggle comment in normal/visual mode
nmap <C-m> <leader>c<Space>
vmap <C-m> <leader>c<Space>
vmap <C-M> <leader>cs

nmap <leader>rp :%s/
nmap F :%s/

" add extra space
let NERDSpaceDelims=1

Expand All @@ -74,6 +79,23 @@ map <A-F> :Format<cr>

map <C-t> :FZF<cr>

" save using <A-s> in every mode
" when in operator-pending or insert, takes you to normal mode
nnoremap <A-s> :w<Cr>
vnoremap <A-s> <C-c>:write<Cr>
inoremap <A-s> <Esc>:w<Cr>
onoremap <A-s> <Esc>:write<Cr>
" use shift-enter to add trailing comma
inoremap <S-CR> <ESC>A;<ESC>
vnoremap <S-CR> <ESC>A;<ESC>
nnoremap <S-CR> A;<ESC>

" move line up/down
nmap m :m -2<CR>
nmap M :m +1<CR>
vmap m :m -2<CR>
vmap M :m +1<CR>

" lightline
let g:lightline = {
\ 'colorscheme': 'onedark',
Expand Down Expand Up @@ -122,6 +144,9 @@ endfunction
nnoremap H gT
nnoremap L gt

" does not work with ts optional chaining
let g:polyglot_disabled = ['typescript', 'ts']

call plug#begin()
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Expand All @@ -134,16 +159,20 @@ Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-surround'
Plug 'itchyny/lightline.vim'
Plug 'kkoomen/vim-doge'
Plug 'leafgarland/typescript-vim'
call plug#end()


source ~/.coc.vim

" Custom syntax highlighting
au BufNewFile,BufRead Jenkinsfile setf groovy
au BufNewFile,BufRead Jenkinsfile setf groovy
au BufNewFile,BufRead *.ejs setf html
au BufNewFile,BufRead Gearsfile,Bogiefile setf yaml
" jsonc: https://code.visualstudio.com/docs/languages/json#_json-with-comments
autocmd FileType json syntax match Comment +\/\/.\+$+

source ~/.coc.vim
" map recording to 'Q' so it is less annoying
nnoremap Q q
nnoremap q <Nop>
Expand All @@ -152,3 +181,4 @@ nnoremap <leader>qq :q!<cr>
nnoremap <leader>qw :wq<cr>
nnoremap <leader>qa :qall!<cr>