diff --git a/template/bash/.bashrc b/template/bash/.bashrc index 3231953..26e5ec7 100755 --- a/template/bash/.bashrc +++ b/template/bash/.bashrc @@ -23,17 +23,8 @@ export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" # Keychain eval "$(keychain --eval --agents gpg,ssh --quiet)" -# nvim -alias vi=nvim -alias vim=nvim - -alias ls='ls -hF --color=auto' -alias dir='ls --color=auto --format=long' -alias ll='ls -la' - -# Grep -alias grep='grep -i --color=auto' -alias Grep='grep --color=auto' +# load Aliases +[ -f "$HOME/.aliasrc" ] && source "$HOME/.aliasrc" # Add some colour to LESS/MAN pages export LESSOPEN="| /usr/bin/source-highlight-esc.sh %s" diff --git a/template/nvim/.config/nvim/init.vim b/template/nvim/.config/nvim/init.vim index 3889be4..0902a16 100755 --- a/template/nvim/.config/nvim/init.vim +++ b/template/nvim/.config/nvim/init.vim @@ -35,24 +35,7 @@ Plug 'nathanaelkane/vim-indent-guides' " Plug 'donRaphaco/neotex', { 'for': 'tex' } Plug 'lervag/vimtex' -Plug 'mhinz/neovim-remote' -if has('nvim') - Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } -else - Plug 'Shougo/deoplete.nvim' - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' -endif -Plug 'Shougo/neco-syntax' -Plug 'Shougo/neoinclude.vim' -Plug 'Shougo/neopairs.vim' -Plug 'Shougo/context_filetype.vim' -Plug 'Shougo/neco-vim' -Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' } -Plug 'ternjs/tern_for_vim' - -Plug 'Shougo/neosnippet.vim' -Plug 'Shougo/neosnippet-snippets' +Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'w0rp/ale' @@ -113,7 +96,10 @@ set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux "set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows set timeoutlen=1000 ttimeoutlen=0 " No timeout before keypresses set scrolloff=10 - +set cmdheight=2 +set updatetime=300 +set shortmess+=c +set signcolumn=yes set lazyredraw " Redraw only when we need to. set showmatch " Highlight matching [{()}] @@ -151,9 +137,6 @@ set writebackup " Leader let mapleader="," -" Fold toggle -nnoremap za - " Movement nnoremap j gj nnoremap k gk @@ -164,16 +147,9 @@ nnoremap :nohlsearch " Session save nnoremap s :mksession -" Make p in Visual mode replace the selected text with the yank register -vnoremap p :let current_reg = @"gvdi=current_reg - " :W sudo saves the file command W w !sudo tee % > /dev/null -" Completion with tab -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" - " NERD Tree map :NERDTreeToggle @@ -217,25 +193,15 @@ let g:lightline = { " ########### " Indent guides +" hi IndentGuidesOdd ctermbg=8 hi IndentGuidesEven ctermbg=8 let g:indent_guides_start_level = 2 let g:indent_guides_guide_size = 1 let g:indent_guides_enable_on_vim_startup = 1 -" Deoplete -let g:deoplete#enable_at_startup = 1 -let g:deoplete#num_processes = 1 +" ALE -"call deoplete#custom#option('sources', { -" \ '_': ['buffer'], -" \ 'cpp': ['buffer', 'tag'], -" \}) - -let g:tern#command = ["tern"] -let g:tern#arguments = ["--persistent"] - -" ale let g:ale_completion_enabled = 0 let g:ale_linters_explicit = 1 let g:ale_linters = { @@ -248,43 +214,115 @@ let b:ale_fixers = { \ 'javascript': ['eslint'] \} -" neotex -let g:neotex_enabled = 1 -let g:tex_flavor = 'latex' -let g:neotex_pdflatex_alternative = 'xelatex' - -" neopairs -let g:neopairs#enable = 1 - -" neco-vim -if !exists('g:necovim#complete_functions') - let g:necovim#complete_functions = {} - endif - let g:necovim#complete_functions.Ref = - \ 'ref#complete' - - -" neosnippet - -" Plugin key-mappings. -" Note: It must be "imap" and "smap". It uses mappings. -imap (neosnippet_expand_or_jump) -smap (neosnippet_expand_or_jump) -xmap (neosnippet_expand_target) - -" SuperTab like snippets behavior. -" Note: It must be "imap" and "smap". It uses mappings. -"imap -" \ pumvisible() ? "\" : -" \ neosnippet#expandable_or_jumpable() ? -" \ "\(neosnippet_expand_or_jump)" : "\" -smap neosnippet#expandable_or_jumpable() ? -\ "\(neosnippet_expand_or_jump)" : "\" - - -" For conceal markers. -"if has('conceal') -" set conceallevel=2 concealcursor=niv -"endif -let g:neosnippet#snippets_directory='~/.config/nvim/snippets' +" CoC + +" Use tab for trigger completion with characters ahead and navigate. +" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion. +inoremap coc#refresh() + +" Use to confirm completion, `u` means break undo chain at current position. +" Coc only does snippet and additional edit on confirm. +inoremap pumvisible() ? "\" : "\u\" +" Or use `complete_info` if your vim support it, like: +" inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" + +" Use `[g` and `]g` to navigate diagnostics +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" Remap keys for gotos +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window +nnoremap K :call show_documentation() + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +" Highlight symbol under cursor on CursorHold +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Remap for rename current word +nmap rn (coc-rename) + +" Remap for format selected region +xmap f (coc-format-selected) +nmap f (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: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap for do codeAction of current line +nmap ac (coc-codeaction) +" Fix autofix problem of current line +nmap qf (coc-fix-current) + +" Create mappings for function text object, requires document symbols feature of languageserver. +xmap if (coc-funcobj-i) +xmap af (coc-funcobj-a) +omap if (coc-funcobj-i) +omap af (coc-funcobj-a) + +" Use for select selections ranges, needs server support, like: coc-tsserver, coc-python +" nmap (coc-range-select) +" xmap (coc-range-select) + +" Use `:Format` to format current buffer +command! -nargs=0 Format :call CocAction('format') + +" Use `:Fold` to fold current buffer +command! -nargs=? Fold :call CocAction('fold', ) + +" use `:OR` for organize import of current buffer +command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') + +" Add status line support, for integration with other plugin, checkout `:h coc-status` +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} + +" Using CocList +" Show all diagnostics +nnoremap a :CocList diagnostics +" Manage extensions +nnoremap e :CocList extensions +" Show commands +nnoremap c :CocList commands +" Find symbol of current document +nnoremap o :CocList outline +" Search workspace symbols +nnoremap s :CocList -I symbols +" Do default action for next item. +nnoremap j :CocNext +" Do default action for previous item. +nnoremap k :CocPrev +" Resume latest coc list +nnoremap p :CocListResume diff --git a/template/shell/.aliasrc b/template/shell/.aliasrc new file mode 100644 index 0000000..d7511fd --- /dev/null +++ b/template/shell/.aliasrc @@ -0,0 +1,21 @@ +#!/bin/sh + +# Vim a +command -v vim >/dev/null && alias vi="vi" vim="vim" vimdiff="vimdiff" +command -v nvim >/dev/null && alias vi="nvim" vim="nvim" vimdiff="nvim -d" + +# Verbose +alias \ + cp="cp -iv" \ + mv="mv -iv" \ + rm="rm -v" \ + mkdir="mkdir -pv" \ + dmesg="dmesg --ctime" + +# Color +alias \ + ls="ls -hN --group-directories-first --color=auto" \ + ll="ls -lahN --group-directories-first --color=auto" \ + grep="grep -i --color=auto" \ + Grep="grep --color=auto" \ + diff="diff --color=auto" \ diff --git a/template/zsh/.zshrc b/template/zsh/.zshrc index 30bfbd8..b80060b 100755 --- a/template/zsh/.zshrc +++ b/template/zsh/.zshrc @@ -1,6 +1,9 @@ # Skip all this for non-interactive shells [[ -z "$PS1" ]] && return +# Load aliases +[ -f "$HOME/.aliasrc" ] && source "$HOME/.aliasrc" + ######### # zplug # ######### @@ -87,14 +90,6 @@ setopt NOCLOBBER LS_COLORS='rs=0:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:'; export LS_COLORS -# Aliases -alias s="sudo" -alias ls="ls --color -F" -alias ll="ls --color -lh" -alias mkdir='mkdir -p' -alias dmesg='dmesg --ctime' -alias cd..='cd ..' - # Completion zmodload zsh/complist autoload -Uz compinit diff --git a/themes/dina b/themes/dina new file mode 100644 index 0000000..e006a99 --- /dev/null +++ b/themes/dina @@ -0,0 +1,32 @@ +#!/bin/bash + +FONT="Dina" +ICONFONT="Siji" +FONTSIZE="8" + +declare -A POLYBAR +POLYBAR=(\ + [modulesleft]="i3" \ + [modulescenter]="cpu memory" \ + [modulesright]="eth wifi volume battery time date xkeyboard" \ + [textoffset]="2" \ + [iconfontscale]="1" \ + [antialias]="false" \ + [bottom]="true" \ + [height]="28" \ + [i3label]="%icon%" \ + [wifidev]="wlp3s0" \ + [wifiicon]="" \ + [ethdev]="enp2s0" \ + [ethicon]="" \ + [cpuicon]="CPU:" \ + [ramicon]="RAM:" \ + [dateicon]="" \ + [timeicon]="" \ + [volumeicon]="" \ + [muteicon]="" \ + [layouticon]="" \ + [chargingicon]="" \ + [fullicon]="" \ + [dischargingicon]="" \ +) diff --git a/themes/tamsyn b/themes/tamsyn index 00ba36b..f972d08 100644 --- a/themes/tamsyn +++ b/themes/tamsyn @@ -1,7 +1,7 @@ #!/bin/bash FONT="Misc Tamsyn" -ICONFONT="Wuncon Siji" +ICONFONT="Siji" FONTSIZE="10.5" declare -A POLYBAR