From 7fa043bf6582806a18261a5eea3e269ffb29a1e6 Mon Sep 17 00:00:00 2001 From: Chun Li Date: Tue, 11 Feb 2025 21:38:38 -0800 Subject: [PATCH] Add nvim config and update tmux --- config/nvim/init.lua | 4 ++ config/nvim/init.vim | 125 ------------------------------------------- tmux/dot-tmux.conf | 8 --- 3 files changed, 4 insertions(+), 133 deletions(-) create mode 100644 config/nvim/init.lua delete mode 100644 config/nvim/init.vim diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..8dfbe33 --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,4 @@ +-- neovim config +-- Author: Chun Li + + diff --git a/config/nvim/init.vim b/config/nvim/init.vim deleted file mode 100644 index 7d1526c..0000000 --- a/config/nvim/init.vim +++ /dev/null @@ -1,125 +0,0 @@ -""" neovim config -""" Author: Chun Li - - -""" PLUGINS -call plug#begin('~/.vim/plugged') - if filereadable(expand("~/.vimrc.bundles")) - source ~/.vimrc.bundles -endif -call plug#end() - -" Plugin settings -let g:ctrlp_match_window = 'order:ttb,max:20' -let g:NERDSpaceDelims=1 -let g:gitgutter_enabled = 0 - -autocmd FileType racket setlocal commentstring=;\ %s - -" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher -if executable('ag') - " Use Ag over Grep - set grepprg=ag\ --nogroup\ --nocolor - - " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore - let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' -endif - - -""" SET CONFIGS -" enable syntax highlighting -syntax enable -filetype plugin indent on -colorscheme molokai -highlight Comment ctermfg=blue " make comments readable -set autoindent -set autoread " reload files when changed on disk, i.e. via `git checkout` -set backspace=2 " Fix broken backspace in some setups -set backupcopy=yes " see :help crontab -set cc=100 " color column -set clipboard=unnamed " yank and paste with the system clipboard -set directory=/tmp/ " store swapfiles in tmp -set encoding=utf-8 -set expandtab " expand tabs to spaces -set hlsearch " set highlight search -set ignorecase " case-insensitive search -set incsearch " search as you type -set laststatus=2 " always show statusline -set list " show trailing whitespace -set listchars=tab:▸\ ,trail:▫ -set mouse=a " Enable basic mouse behavior such as resizing buffers. -set nocompatible " don't bother with vi compatibility -set number " show line numbers -set ruler " show where you are -set scrolloff=3 " show context above/below cursorline -set shiftwidth=4 " normal mode indentation commands use 4 spaces -set showcmd -set smartcase " case-sensitive search if any caps -set softtabstop=4 " insert mode tab and backspace use 4 spaces -set tabstop=4 " actual tabs occupy 4 characters -set wildignore=log/**,node_modules/**,target/**,tmp/**,*.rbc -set wildmenu " show a navigable menu for tab completion -set wildmode=longest,list,full - - -""" MAPPINGS -" keyboard shortcuts -let mapleader = ',' -" buffer navigation -noremap h -noremap j -noremap k -noremap l -" plugins -nnoremap a :Ag -nnoremap b :CtrlPBuffer -nnoremap d :NERDTreeToggle -nnoremap f :NERDTreeFind -nnoremap t :CtrlP -nnoremap T :CtrlPClearCache:CtrlP -nnoremap ] :TagbarToggle -nnoremap g :GitGutterToggle -nnoremap G :Gblame -noremap :set list! -noremap V :source ~/.vimrc:filetype detect:exe ":echo 'vimrc reloaded'" -" tab creation -:map :tabe -:imap :tabe -:vmap :tabe -" tabbing -:nmap >> -:nmap << -:vmap > -:vmap < -" in case you forgot to sudo -cnoremap w!! %!sudo tee > /dev/null % - - -""" FILETYPES -" fdoc is yaml -autocmd BufRead,BufNewFile *.fdoc set filetype=yaml -" md is markdown -autocmd BufRead,BufNewFile *.md set filetype=markdown -autocmd FileType javascript setlocal expandtab shiftwidth=2 softtabstop=2 -autocmd FileType html setlocal expandtab shiftwidth=2 softtabstop=2 -autocmd FileType css setlocal expandtab shiftwidth=2 softtabstop=2 -autocmd FileType racket setlocal expandtab shiftwidth=2 softtabstop=2 -autocmd FileType lisp setlocal expandtab shiftwidth=2 softtabstop=2 - - -""" FIXES -" automatically rebalance windows on vim resize -autocmd VimResized * :wincmd = -if exists('$TMUX') && !has('nvim') " Support resizing in tmux - set ttymouse=xterm2 -endif -" Fix Cursor in TMUX -if exists('$TMUX') - let &t_SI = "\Ptmux;\\]50;CursorShape=1\x7\\\" - let &t_EI = "\Ptmux;\\]50;CursorShape=0\x7\\\" -else - let &t_SI = "\]50;CursorShape=1\x7" - let &t_EI = "\]50;CursorShape=0\x7" -endif -" Don't copy the contents of an overwritten selection. -vnoremap p "_dP diff --git a/tmux/dot-tmux.conf b/tmux/dot-tmux.conf index f3aa006..8335399 100644 --- a/tmux/dot-tmux.conf +++ b/tmux/dot-tmux.conf @@ -34,14 +34,6 @@ bind-key j select-pane -D bind-key k select-pane -U bind-key l select-pane -R -# uncomment below stanza to enable smart pane switching with awareness of vim splits -# bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L" -# bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux select-pane -D" -# bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux select-pane -U" -# bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux select-pane -R" -# bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys 'C-\\') || tmux select-pane -l" -# bind C-l send-keys 'C-l' - bind-key C-o rotate-window bind-key + select-layout main-horizontal