Compare commits

...

9 Commits

Author SHA1 Message Date
7c257dd4bd zsh: use full path in $SHELL 2025-08-08 17:42:42 +08:00
0ede2b50b2 minimal environment adjustments 2025-08-04 11:39:23 +08:00
292e6f0f0b vim: make nvim/init.vim great again 2025-08-04 11:33:10 +08:00
855434df21 zsh: new minimal zshrc without ohmyzsh 2025-08-04 11:29:58 +08:00
8cde92a219 vim: F3/F4 to tab left/right
got tired of typing gt/gT all the time
2025-07-31 13:39:16 +08:00
b634feef31 vim: set tildeop 2025-07-21 13:40:24 +08:00
6f97e895d6 vim: unmap grt 2025-07-14 17:33:17 +08:00
78dcc5ea04 vim: i misunderstood coc lists, sorry 2025-07-10 18:40:50 +08:00
2e1f2b8a5e vim: screw list grep/files 2025-07-10 18:26:47 +08:00
6 changed files with 248 additions and 10 deletions

View File

@@ -1,9 +1,14 @@
{
"coc.preferences.jumpCommand": "drop",
"list.normalMappings": {
"e": "action:drop"
"e": "action:drop",
"v":"action:vsplit"
},
"go.goplsPath": "/home/edgar/.local/share/gopath/bin/gopls",
"list.maxPreviewHeight": 16,
"list.floatPreview": true,
"list.source.files.filterByName": true,
"list.source.files.defaultAction": "tabe",
"go.goplsPath": "/usr/bin/gopls",
"go.goplsUseDaemon": true,
"go.goplsOptions": {
"semanticTokens": true

113
nvim_init.vim Normal file
View File

@@ -0,0 +1,113 @@
if exists('g:vscode')
" VSCode extension.
" This is all the config for VSCode-Neovim.
" normal Nvim uses ~/.vimrc.
set backspace=2
set showmatch
set ruler
set mouse=a
set ts=4
set sw=4
set cindent
set cinoptions=:0,l1,g0
set nohlsearch
set ignorecase
set smartcase
set autochdir
set timeout timeoutlen=1000 ttimeoutlen=15
set title
set guicursor=a:blinkon0-Cursor
let g:netrw_mousemaps=0
set nu
set signcolumn=no
set updatetime=1000
command W w
map Q ZZ
func Semicolon()
let line = getline('.')
if match(line, "for") == -1 && match(line, "if") == -1
return "\<End>;"
else
return ';'
endif
endfunc
au BufNewFile,BufRead *.frag,*.vert,*.geom,*.fp,*.vp,*.glsl setf glsl
augroup vimrc_cmaps
autocmd FileType c,cpp,rust,typescript inoremap <buffer><expr> ; Semicolon()
autocmd FileType vim,c,cpp,go,rust,python,typescript,tex inoremap <buffer> ( ()<Left>
autocmd FileType vim,c,cpp,go,rust,python,typescript,tex inoremap <buffer> [ []<Left>
autocmd FileType vim,c,cpp,go,rust,python,typescript inoremap <buffer> " ""<Left>
autocmd FileType vim,c,cpp,go,rust,python,typescript inoremap <buffer> ' ''<Left>
autocmd FileType c,cpp,go,rust,typescript inoremap <buffer> { <End>{<CR>}<Up><End><CR>
autocmd FileType c,cpp,go,rust,typescript inoremap <buffer> <C-]> {}<Left>
autocmd FileType vim,tex,python inoremap <buffer> { {}<Left>
autocmd FileType vim,tex,python inoremap <buffer> <C-]> <End>{<CR>}<Up><End><CR>
augroup END
" Guess what? Despite Neovim being smart enough to distinguish
" <Ctrl-I> from <Tab>, it treats <Ctrl-I> as <Tab> anyways if
" you have a normal mode mapping for <Tab>. Screw me I guess.
" Edit: My bad - Please refer to :h <Tab> or :h CTRL-I. Maybe
" learn to read sometime this century.
"
" https://vi.stackexchange.com/a/46704
" https://github.com/neovim/neovim/pull/17932
"
" This magical line tricks Nvim into being smart again.
nnoremap <C-I> <C-I>
" Use Meta-HJKL for Left/Down/Up/Right.
imap <M-H> <Left>
imap <M-J> <Down>
imap <M-K> <Up>
imap <M-L> <Right>
"""""""""" AsyncRun """"""""""
let g:asyncrun_open = 1
" Deactivate IME when leaving Insert mode.
au InsertLeavePre * AsyncRun -silent which fcitx5-remote >/dev/null && fcitx5-remote -c
"""""""""" Misc """"""""""
set tags+=~/.cache/ctags
lang zh_CN.UTF-8
" Uncomment the following to have Vim jump to the last position when
" reopening a file
au BufReadPost * exe "normal! g'\""
set showmode
else
" ordinary Neovim
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
endif

15
setup.minimal.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
die() { printf "error: $1\n"; exit 1; } >&2
[[ $PWD == "$HOME/.rcfiles" ]] || die "this file assumes you've cloned this folder under ~/.rcfiles"
mkdir -pv ../.config/nvim
ln -sriv vimrc ../.vimrc
ln -sriv nvim_init.vim ../.config/nvim/init.vim
ln -sriv zshrc.minimal ../.zshrc
ln -sriv coc-settings.json ../.config/nvim/coc-settings.json
ln -sriv _clang-format ../.clang-format

View File

@@ -10,7 +10,7 @@ mkdir -pv ../.oh-my-zsh/themes
ln -sriv vimrc ../.vimrc
ln -sriv vimrc ../.config/nvim/init.vim
ln -sriv nvim_init.vim ../.config/nvim/init.vim
ln -sriv oh.my.zshrc ../.zshrc
ln -sriv coc-settings.json ../.config/nvim/coc-settings.json
ln -sriv _clang-format ../.clang-format

13
vimrc
View File

@@ -22,6 +22,7 @@ set cinoptions=:0,l1,g0
set nohlsearch
set ignorecase
set smartcase
set tildeop
set autochdir
set timeout timeoutlen=1000 ttimeoutlen=15
@@ -169,6 +170,8 @@ set tabline=%!MyTabLine()
command W w
map Q ZZ
map <F3> gT
map <F4> gt
func Semicolon()
let line = getline('.')
@@ -259,6 +262,7 @@ nunmap gri
nunmap grr
nunmap gra
nunmap grn
nunmap grt
" Custom list invocation
"let g:coc_enable_locationlist = 0
@@ -344,7 +348,6 @@ set noshowmode
set termguicolors
set t_8f=[38:2::%lu:%lu:%lum
set t_8b=[48:2::%lu:%lu:%lum
@@ -352,13 +355,9 @@ set t_8b=[48:2::%lu:%lu:%lum
command -nargs=* C !g++ %:p <Args>
command -nargs=* CR rightb 15split +term\ g++\ <Args>\ %:p\ &&\ ./a.out
command R rightb 15split +term\ ./a.out
command! -nargs=+ -complete=custom,s:GrepArgs G exe 'CocList --normal grep '.<q-args>
command! -nargs=* G CocList --normal --auto-preview grep -smartcase -folder <Args>
command! -nargs=* F CocList --auto-preview files -folder <Args>
function! s:GrepArgs(...)
let list = ['-S', '-smartcase', '-i', '-ignorecase', '-w', '-word',
\ '-e', '-regex', '-u', '-skip-vcs-ignores', '-t', '-extension']
return join(list, "\n")
endfunction
function MyCDB(file)

106
zshrc.minimal Normal file
View File

@@ -0,0 +1,106 @@
export SHELL=/bin/zsh
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/.local/bin:/usr/local/bin:$PATH
export PROMPT='%n@%m:%~$ '
export HISTFILE="$HOME/.zhistory"
export HISTSIZE=8000
export SAVEHIST=8000
setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
#setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
setopt HIST_BEEP # Beep when accessing nonexistent history.
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Customized
export EDITOR="vim"
bindkey -v
alias ls='ls --color'
alias ll='ls -l'
alias la='ls -a'
alias javac="javac -J-Dfile.encoding=utf8"
alias grep="grep --color=auto"
alias mc='mkcpp'
alias mcv='mkcpp -V'
alias fasm='fasm -m 1677216'
alias pacman='sudo pacman'
alias sctl='sudo systemctl'
alias steamcmd='sudo -u steam steamcmd'
alias gdbtui='gdb -q -tui'
alias gdb='gdb -q'
alias nethack='TERM=xterm-color nethack'
alias -s c=vim
alias -s cpp=vim
alias -s h=vim
alias -s hpp=vim
alias -s go=vim
alias -s java=vim
alias -s txt=vim
alias -s gz='tar -xzvf'
alias -s tgz='tar -xzvf'
alias -s zip='unzip'
alias -s bz2='tar -xjvf'
bindkey '^[OA' history-beginning-search-backward
bindkey '^[[A' history-beginning-search-backward
bindkey '^[OB' history-beginning-search-forward
bindkey '^[[B' history-beginning-search-forward
export LANG="zh_CN.UTF-8"
#export LANGUAGE="zh_CN.UTF-8"
# The following lines were added by compinstall
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]} r:|[._-]=** r:|=** l:|=*'
zstyle :compinstall filename '/home/edgar/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall