diff --git a/.vimrc b/.vimrc index ec51f44..adf3158 100644 --- a/.vimrc +++ b/.vimrc @@ -10,6 +10,10 @@ " Disable compatibility with vi which can cause unexpected issues set nocompatible +" Detect terminal type and capabilities (must be early for conditional configs) +let g:is_tty = ($TERM =~ 'linux' || $TERM =~ 'screen' || &term =~ 'builtin') +let g:has_true_color = ($COLORTERM == 'truecolor' || $COLORTERM == '24bit') + " Enable type file detection. Vim will be able to try to detect the type of file in use filetype on @@ -91,15 +95,6 @@ set mouse=a " Set encoding set encoding=utf-8 -" Better command-line completion -set wildmenu - -" Show cursor position -set ruler - -" Display line numbers -set number - " Enable folding set foldmethod=indent set foldlevel=99 @@ -114,42 +109,15 @@ set backspace=indent,eol,start " Auto read when file is changed from outside set autoread -" Turn on the Wild menu for command completion -set wildmenu - -" Ignore compiled files -set wildignore=*.o,*~,*.pyc -if has("win16") || has("win32") - set wildignore+=.git\*,.hg\*,.svn\* -else - set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store -endif - -" Always show current position -set ruler - " Height of the command bar set cmdheight=1 " A buffer becomes hidden when it is abandoned set hid -" Configure backspace so it acts as it should act -set backspace=eol,start,indent +" Configure backspace so it acts as it should act (enhanced from earlier basic setting) set whichwrap+=<,>,h,l -" Ignore case when searching -set ignorecase - -" When searching try to be smart about cases -set smartcase - -" Highlight search results -set hlsearch - -" Makes search act like search in modern browsers -set incsearch - " Don't redraw while executing macros (good performance config) set lazyredraw @@ -259,10 +227,6 @@ call plug#end() " => Colors and Fonts " ============================================================================ -" Detect terminal type and capabilities -let g:is_tty = ($TERM =~ 'linux' || $TERM =~ 'screen' || &term =~ 'builtin') -let g:has_true_color = ($COLORTERM == 'truecolor' || $COLORTERM == '24bit') - " Enable true colors support only if terminal supports it if g:has_true_color && has('termguicolors') && !g:is_tty set termguicolors diff --git a/QUICKSTART.md b/QUICKSTART.md index 126c3c2..76fde37 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -10,9 +10,12 @@ Get up and running with this Vim configuration in 5 minutes! git clone https://github.com/m1ngsama/chopsticks.git ~/.vim && cd ~/.vim && ./install.sh ``` +**IMPORTANT:** Always run the install script from the `~/.vim` directory (where you cloned the repository). The script validates this to ensure correct symlink creation. + That's it! The script will: +- Verify it's being run from the correct directory - Backup your existing .vimrc -- Create symlink to the new configuration +- Create and validate symlink to the new configuration - Install vim-plug - Install all plugins automatically diff --git a/README.md b/README.md index 488be61..48f9271 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ A comprehensive, modern Vim configuration optimized for engineering workflows. T git clone https://github.com/m1ngsama/chopsticks.git ~/.vim && cd ~/.vim && ./install.sh ``` -See [QUICKSTART.md](QUICKSTART.md) for detailed getting started guide. +**Note:** The installation script must be run from the cloned `~/.vim` directory. See [QUICKSTART.md](QUICKSTART.md) for detailed getting started guide. ## Features @@ -56,9 +56,13 @@ cd ~/.vim ./install.sh ``` +**IMPORTANT:** You must run the install script from the `~/.vim` directory (the cloned repository directory). Do not copy the script to another location and run it from there. + The installation script will: +- Verify it's being run from the correct directory - Backup your existing configuration - Create necessary symlinks +- Validate symlink creation - Install vim-plug automatically - Install all plugins - Offer to install CoC language servers diff --git a/install.sh b/install.sh index c71a04d..87debfa 100755 --- a/install.sh +++ b/install.sh @@ -13,10 +13,6 @@ YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' # No Color -echo -e "${BOLD}========================================${NC}" -echo -e "${BOLD}Vim Configuration Installer${NC}" -echo -e "${BOLD}========================================${NC}\n" - # Function to print status messages print_status() { echo -e "${GREEN}==>${NC} ${BOLD}$1${NC}" @@ -30,6 +26,18 @@ print_error() { echo -e "${RED}Error:${NC} $1" } +echo -e "${BOLD}========================================${NC}" +echo -e "${BOLD}Vim Configuration Installer${NC}" +echo -e "${BOLD}========================================${NC}\n" + +# Verify .vimrc exists in script directory +if [ ! -f "$SCRIPT_DIR/.vimrc" ]; then + print_error "Cannot find .vimrc in $SCRIPT_DIR" + echo "Please run this script from the chopsticks directory:" + echo " cd ~/.vim && ./install.sh" + exit 1 +fi + # Check if vim is installed if ! command -v vim &> /dev/null; then print_error "Vim is not installed. Please install Vim first." @@ -52,6 +60,19 @@ fi print_status "Creating symlink: $HOME/.vimrc -> $SCRIPT_DIR/.vimrc" ln -sf "$SCRIPT_DIR/.vimrc" "$HOME/.vimrc" +# Verify symlink was created correctly +if [ -L "$HOME/.vimrc" ]; then + LINK_TARGET=$(readlink "$HOME/.vimrc") + if [ "$LINK_TARGET" = "$SCRIPT_DIR/.vimrc" ]; then + echo -e "${GREEN}[OK]${NC} Symlink created successfully" + else + print_warning "Symlink points to unexpected target: $LINK_TARGET" + fi +else + print_error "Failed to create symlink" + exit 1 +fi + # Install vim-plug if not already installed VIM_PLUG_PATH="$HOME/.vim/autoload/plug.vim" if [ ! -f "$VIM_PLUG_PATH" ]; then @@ -100,7 +121,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then if ! command -v node &> /dev/null; then print_error "Node.js is not installed. Please install Node.js first." else - vim -c "CocInstall -sync coc-json coc-tsserver coc-pyright coc-sh coc-html coc-css coc-yaml|q" + vim +'CocInstall -sync coc-json coc-tsserver coc-pyright coc-sh coc-html coc-css coc-yaml' +qall echo -e "${GREEN}[OK]${NC} CoC language servers installed" fi fi