# HG changeset patch # User MrJuneJune # Date 1764657820 28800 # Node ID 5e6a5d3c68686e9f7d8f14c9ba9065b88abef5bb # Parent c2706ffb442be48cc04f92ad3016938397bf8a90 [Personal] Moving my vim-set up config here. diff -r c2706ffb442b -r 5e6a5d3c6868 react_games/src/Connectfour/latest.tsx --- a/react_games/src/Connectfour/latest.tsx Mon Dec 01 21:00:10 2025 -0800 +++ b/react_games/src/Connectfour/latest.tsx Mon Dec 01 22:43:40 2025 -0800 @@ -1,5 +1,4 @@ import { CSSProperties, memo, useCallback, useReducer } from "react"; -import ReactDOM from "react-dom/client"; /** * Connect4 game is also known as Four Up, Plot Four, Find Four, Captain’s Mistress, Four in a Row, Drop Four, and Gravitrips in the Soviet Union. diff -r c2706ffb442b -r 5e6a5d3c6868 vim-setup/.tmux.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim-setup/.tmux.conf Mon Dec 01 22:43:40 2025 -0800 @@ -0,0 +1,20 @@ +set -g history-limit 500000 +set -g default-terminal "tmux-256color" +set -s escape-time 0 + +setw -g mode-keys vi +set -g mouse on + +bind | split-window -h +bind - split-window -v + +# bind-key -T copy-mode-vi v send-keys -X begin-selection +# bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" +# # if using xclip +# bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard" +# # bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy" + +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R diff -r c2706ffb442b -r 5e6a5d3c6868 vim-setup/.vimrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim-setup/.vimrc Mon Dec 01 22:43:40 2025 -0800 @@ -0,0 +1,208 @@ +" Line numbers +set number +set relativenumber + +" Turn off error +set noerrorbells +set novisualbell +set t_vb= + +" Indentation +set tabstop=2 +set shiftwidth=2 +set expandtab +set autoindent + +" Syntax +syntax on +filetype plugin indent on +set termguicolors +let &t_8f = "\[38;2;%lu;%lu;%lum" +let &t_8b = "\[48;2;%lu;%lu;%lum" +colorscheme nightfly +" Force turn on unless it is over 1M LOC +autocmd BufReadPre * if getfsize(expand("%")) > 1000000 | syntax off | endif + +" Line wrapping +set nowrap + +" Search settings +set ignorecase +set smartcase +set hlsearch +set incsearch + +" Cursor line +set cursorline + +" Appearance +set termguicolors +set background=dark +set signcolumn=yes + +" Backspace behavior +set backspace=indent,eol,start + +" Clipboard +set clipboard+=unnamedplus + +" Split window behavior +set splitright +set splitbelow +set splitbelow + +" General Keymaps +" Map semicolon to colon in normal mode +nnoremap ; : + +" Yank into clipboard +nnoremap y "+y +vnoremap y "+y + +" ff: Fuzzy file search +nnoremap ff :Files + +" fb: Fuzzy search within buffer +nnoremap fb :Buffers + +" ft: ctag search +nnoremap ft :Tags + +" fs: Ripgrep search for word (normal mode) +nnoremap fs :RG + +" fs: Ripgrep search for selected text (visual mode) +vnoremap fs :execute 'Rg ' . getreg('"') + +" Open man in vim +noremap :h + +" vim wiki +" Set the directory where your wiki pages will be stored +let g:wiki_root = expand('~/wiki/') + +" Set wiki syntax and file extensions +let g:wiki_filetypes = ['md', 'wiki'] + +" Enable global mappings (optional) +let g:wiki_global_mappings = 1 + +" Enable links to markdown files +let g:wiki_link_extension = '.md' + +" Turn on man vim mode +runtime! ftplugin/man.vim +" Keyword +set keywordprg=:Man + +" Setup LSP + completion (I will turn on and off depending on sitautions) +lua << EOF +vim.lsp.set_log_level('OFF') + +local cmp = require('cmp') +local luasnip = require('luasnip') +local lspconfig = require('lspconfig') +local util = require('lspconfig.util') + +-- ────────────────────────────── +-- nvim-cmp setup (unchanged) +-- ────────────────────────────── +cmp.setup({ + snippet = { + expand = function(args) luasnip.lsp_expand(args.body) end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp', group_index = 1 }, + { name = 'luasnip', group_index = 1 }, + { name = 'buffer', group_index = 2 }, + }) +}) + +local capabilities = require('cmp_nvim_lsp').default_capabilities() + +-- ts_ls +lspconfig.ts_ls.setup({ + capabilities = capabilities, + root_dir = require('lspconfig.util').root_pattern('tsconfig.json'), + init_options = { + maxTsServerMemory = 8192, + preferences = { + includePackageJsonAutoImports = "auto", + }, + }, + filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }, + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + }, + + -- Force tsserver to reload the tsconfig every time (fixes 95% of path alias issues) + on_attach = function(client, bufnr) + -- Optional: show when LSP attaches + print("ts_ls attached to " .. vim.fn.getcwd()) + end, +}) + +-- Python +lspconfig.basedpyright.setup({ + capabilities = capabilities, + on_attach = function(client, bufnr) + -- Optional: notify when Python LSP attaches + print("basedpyright attached to " .. vim.fn.getcwd()) + + -- Common LSP keymaps (you can put them once at the bottom instead if you prefer) + -- local bufopts = { noremap = true, silent = true, buffer = bufnr } + -- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + -- vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) + -- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + -- vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + -- vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + -- vim.keymap.set('n', '\\d', vim.diagnostic.open_float, bufopts) + -- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, bufopts) + -- vim.keymap.set('n', ']d', vim.diagnostic.goto_next, bufopts) + end, + settings = { + basedpyright = { + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = "workspace", -- or "openFiles" if you have huge monorepos + typeCheckingMode = "standard", -- "strict" if you want maximum strictness + }, + }, + }, + root_dir = util.root_pattern( + "venv", -- This is what I mostly use + "pyproject.toml", -- belows are whatever they use I guess + "setup.py", + "setup.cfg", + "requirements.txt", + ".git" + ), +}) + +EOF + +" Optional key mappings for LSP +nnoremap gd lua vim.lsp.buf.definition() +nnoremap K lua vim.lsp.buf.hover() +nnoremap gr lua vim.lsp.buf.references() +nnoremap \d lua vim.diagnostic.open_float(nil, { border = "rounded" }) +nnoremap [d lua vim.diagnostic.goto_prev() +nnoremap ]d lua vim.diagnostic.goto_next() +nnoremap \ca lua vim.lsp.buf.code_action() diff -r c2706ffb442b -r 5e6a5d3c6868 vim-setup/README.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim-setup/README.md Mon Dec 01 22:43:40 2025 -0800 @@ -0,0 +1,15 @@ +# My vim setup + +Simple vim setup I use for my work flow. + +## How to install and start + +``` +./start.sh +``` + +## Reasoning + +I started out using VSCode when I started coding around 2015? I think it was using around 2GB of RAM or something crazy like that. Anyway, I experimented with different set ups since using vim with plugins, neovims, and etcs + +I realized that IDE is not needed and I just want to write a text into a file to code so updating my vimrc with simple shell script to add two plugins I use; fzf and wiki. diff -r c2706ffb442b -r 5e6a5d3c6868 vim-setup/start.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim-setup/start.sh Mon Dec 01 22:43:40 2025 -0800 @@ -0,0 +1,56 @@ +#!/bin/bash + +set -e + +# Not using plugin management since it is cancer +PLUG_DIR="$HOME/.vim/pack/plugins/start" +THEME_DIR="$HOME/.vim/pack/themes/start" +NEOVIM_DIR="$HOME/.config/nvim/pack" + +mkdir -p "$NEOVIM_DIR" +mkdir -p "$PLUG_DIR" +mkdir -p "$THEME_DIR" + +echo "---Installing system dependencies---" +if [[ "$(uname)" == "Darwin" ]]; then + echo "Assuming OS is mac" + brew install ripgrep vim git curl neovim +else + echo "Assuming OS is linux" + sudo apt update + sudo apt install -y ripgrep vim git curl neovim +fi + +echo "---Installing fzf binary---" +if [ ! -d "$HOME/.fzf" ]; then + git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf + ~/.fzf/install --no-key-bindings --no-completion --no-update-rc +else + echo "fzf already installed" +fi + +echo "---Installing fzf.vim---" +git clone --depth 1 https://github.com/junegunn/fzf.vim.git "$PLUG_DIR/fzf.vim" + +echo "Linking fzf Vim plugin files..." +ln -sf ~/.fzf/plugin "$PLUG_DIR/fzf" +ln -sf ~/.fzf/autoload "$PLUG_DIR/fzf" + +echo "---Installing wiki.vim---" +git clone --depth 1 https://github.com/lervag/wiki.vim.git "$PLUG_DIR/wiki.vim" + +echo "---Installing nightfly colorscheme---" +git clone --depth 1 https://github.com/bluz71/vim-nightfly-colors.git "$THEME_DIR/nightfly" + +echo "---Link to neovim---" +ln -s ~/.vim/pack ~/.config/nvim/pack + +echo "---Set vimrc into neovim" +cat > ~/.config/nvim/init.vim <> ~/.config/nvim/init.vim