From 00664399ecc1315ca8e7f862d8b4d69e133ca88b Mon Sep 17 00:00:00 2001 From: jet tsang zeon-git Date: Thu, 1 Feb 2024 22:50:11 +0800 Subject: init --- tmux.conf | 72 ++++++++++++++++++++++ vimrc | 205 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 277 insertions(+) create mode 100644 tmux.conf create mode 100644 vimrc diff --git a/tmux.conf b/tmux.conf new file mode 100644 index 0000000..78fcae0 --- /dev/null +++ b/tmux.conf @@ -0,0 +1,72 @@ +set-option -g status-style bg=colour235 #base02 +set-option -g status-style fg=colour136 #yellow + +bind-key v split-window -h +bind-key b split-window + +set-window-option -g window-status-style fg=colour244 #base0 +set-window-option -g window-status-style bg=default + +set-window-option -g window-status-current-style fg=colour166 #orange +set-window-option -g window-status-current-style bg=default + +set-option -g pane-border-style fg=colour235 #base02 +set-option -g pane-active-border-style fg=colour240 #base01 + +set-option -g message-style bg=colour235 #base02 +set-option -g message-style fg=colour166 #orange + +set-option -g display-panes-active-colour colour33 #blue +set-option -g display-panes-colour colour166 #orange +set-window-option -g clock-mode-colour green #green + + +set -g status-interval 1 +set -g status-justify centre # center align window list +set -g status-left-length 100 +set -g status-right-length 140 +set -g status-left "#[fg=colour14]#(whoami)@#h #[fg=colour11]#S#[default]" + +set -g status-right '#[fg=green,bg=default,bright]#(tmux-mem-cpu-load) #[fg=yellow,dim,bg=default]#(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") #[fg=white,bright]#(TZ=Asia/Hong_Kong date)' + + +set -g base-index 1 + +set -s escape-time 0 + +setw -g aggressive-resize on + +set -g mouse on + +set -g prefix C-a +unbind C-b +bind C-a send-prefix + +setw -g monitor-activity on +set -g visual-activity on + +set-window-option -g mode-keys vi +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +bind H resize-pane -L +bind J resize-pane -D +bind K resize-pane -U +bind L resize-pane -R + +bind m set-window-option main-pane-height 60\; select-layout main-horizontal + +bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'" + +bind r source-file ~/.tmux.conf \; display-message "Config reloaded..." + +set-window-option -g automatic-rename + +set -g default-terminal "screen-256color" +set-option -g history-limit 13000 + diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..fed86ba --- /dev/null +++ b/vimrc @@ -0,0 +1,205 @@ +" Improved Vim settings +set nocompatible +set background=dark +set nu +set dir=$HOME/.vim_tmp/swap +imap +if !isdirectory(&dir) | call mkdir(&dir, 'p', 0700) | endif + +" Runtime path configuration +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() + +" Vundle plugin management +Plugin 'VundleVim/Vundle.vim' +Plugin 'tpope/vim-fugitive' +Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} +Plugin 'fatih/vim-go' +Plugin 'scrooloose/nerdtree' +Plugin 'Xuyuanp/nerdtree-git-plugin' +Plugin 'kien/ctrlp.vim' +Plugin 'vim-airline/vim-airline' +Plugin 'vim-airline/vim-airline-themes' +Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} +Plugin 'posva/vim-vue' +Plugin 'scrooloose/syntastic' +Plugin 'Chiel92/vim-autoformat' +Plugin 'eugen0329/vim-esearch' +Plugin 'majutsushi/tagbar' +Plugin 'dgryski/vim-godef' +Plugin 'tpope/vim-surround' +Bundle 'sudar/comments.vim' +Plugin 'flazz/vim-colorschemes' +Plugin 'nsf/gocode', {'rtp': 'vim/'} +Plugin 'leafgarland/typescript-vim' +Plugin 'peitalin/vim-jsx-typescript' +Plugin 'rust-lang/rust.vim' +Plugin 'madox2/vim-ai' +Plugin 'neoclide/coc.nvim', {'branch': 'master', 'do': 'npm ci'} + +call vundle#end() +filetype plugin indent on +syntax enable +let g:airline#extensions#tabline#enabled = 1 + +" NERDTree settings +map :NERDTreeToggle +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif +let NERDTreeMinimalUI=1 +let NERDTreeShowHidden=1 + +" CtrlP settings +let g:ctrlp_working_path_mode = 'ra' +set wildignore+=*/tmp/*,*/node_modules/*,*.so,*.swp,*.zip,*.gz,*.tar +let g:ctrlp_custom_ignore = {'dir': '\v[\/]\.(git|hg|svn)$', 'file': '\v\.(exe|so|dll)$'} + +" General settings +set encoding=utf-8 +set t_Co=256 +set term=xterm-256color +set termencoding=utf-8 + +" Syntastic settings +let g:syntastic_javascript_checkers = ['eslint'] +let g:syntastic_always_populate_loc_list = 1 +let g:formatters_javascript = ['eslint'] +let g:formatters_vue = ['eslint'] +noremap :Autoformat + +" Go settings +let g:go_fmt_command = "goimports" +let g:tagbar_type_go = { + \ 'ctagstype' : 'go', + \ 'kinds' : [ + \ 'p:package', + \ 'i:imports:1', + \ 'c:constants', + \ 'v:variables', + \ 't:types', + \ 'n:interfaces', + \ 'w:fields', + \ 'e:embedded', + \ 'm:methods', + \ 'r:constructor', + \ 'f:functions' + \ ], + \ 'sro' : '.', + \ 'kind2scope' : { + \ 't' : 'ctype', + \ 'n' : 'ntype' + \ }, + \ 'scope2kind' : { + \ 'ctype' : 't', + \ 'ntype' : 'n' + \ }, + \ 'ctagsbin' : 'gotags', + \ 'ctagsargs' : '-sort -silent' +\ } +let g:godef_split=2 +let g:syntastic_go_checkers = ['govet', 'errcheck', 'go'] + +" Filetype settings +autocmd BufNewFile,BufRead *.vue set ft=vue +autocmd Filetype yaml setlocal tabstop=8 +autocmd Filetype go setlocal tabstop=8 +autocmd FileType vue :call ESlintVueFormatter() +autocmd FileType javascript :call ESlintJSFormatter() +autocmd FileType javascript nnoremap c I// +autocmd FileType python nnoremap c I# + +" Indentation settings +set ts=8 +set expandtab +set autoindent +set nowrap + +" Mouse and paste settings +set mouse=a +set pastetoggle= + +" Commenting settings +let g:comments_map_keys = 0 +noremap :call CommentLine() +vnoremap :call RangeCommentLine() +noremap :call UnCommentLine() +vnoremap :call RangeUnCommentLine() + +" Color scheme +color blackboard + +" TypeScript settings +let g:typescript_compiler_binary = 'tsc' +let g:typescript_compiler_options = '' +let g:go_gopls_enabled = 0 +autocmd BufNewFile,BufRead *.ts set filetype=typescript +autocmd FileType typescript :set makeprg=tsc +autocmd BufNewFile,BufRead *.tsx,*.jsx set filetype=typescript.tsx + +" Rust settings +let g:rustfmt_autosave = 1 + +" AI integration +let g:vim_ai_complete = { +\ "options": { +\ "model": "gpt-4-turbo-preview", +\ "endpoint_url": "https://api.openai.com/v1/chat/completions", +\ "temperature": 0.1, +\ "request_timeout": 20, +\ }, +\} + +let g:vim_ai_edit = { +\ "options": { +\ "model": "gpt-4-turbo-preview", +\ "endpoint_url": "https://api.openai.com/v1/chat/completions", +\ "temperature": 0.1, +\ "request_timeout": 20, +\ }, +\} + +let initial_prompt =<< trim END +You are going to play a role of a completion engine with following parameters: +Task: Provide compact code/text completion, generation, transformation or explanation +Topic: general programming and text editing +Style: Plain result without any commentary, unless commentary is necessary +Audience: Users of text editor and programmers that need to transform/generate text +END + +let chat_engine_config = { +\ "engine": "chat", +\ "options": { +\ "endpoint_url": "https://api.openai.com/v1/chat/completions", +\ "model": "gpt-4-turbo-preview", +\ "max_tokens": 128000, +\ "temperature": 0.1, +\ "request_timeout": 30, +\ "selection_boundary": "", +\ "initial_prompt": initial_prompt, +\ }, +\} + +let g:vim_ai_complete = chat_engine_config +let g:vim_ai_edit = chat_engine_config +let g:vim_ai_debug = 1 + +" Custom commands +command! GitCommitMessage call GitCommitMessageFn() +command! -range CodeReview ,call CodeReviewFn() + +" Key mappings +nnoremap a :AI +xnoremap a :AI +xnoremap s :AIEdit fix grammar and spelling +nnoremap s :AIEdit fix grammar and spelling +xnoremap c :AIChat +nnoremap c :AIChat +nnoremap r :AIRedo + +" Rust key mappings +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) +nnoremap K :call show_documentation() -- cgit v1.2.3