Mercurial
view vim-setup/.vimrc @ 108:f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Sat, 03 Jan 2026 17:29:12 -0800 |
| parents | 983769fba767 |
| children | 76cd7afa6b8e |
line wrap: on
line source
" 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 = "\<Esc>[38;2;%lu;%lu;%lum" let &t_8b = "\<Esc>[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 <leader>y "+y vnoremap <leader>y "+y " FZF " Add fzf to runtimepath set rtp += ~/.fzf " <leader>ff: Fuzzy file search nnoremap <leader>ff :Files<CR> " <leader>fb: Fuzzy search within buffer nnoremap <leader>fb :Buffers<CR> " <leader>ft: ctag search nnoremap <leader>ft :Tags<CR> " <leader>fs: Ripgrep search for word (normal mode) nnoremap <leader>fs :RG<CR> " <leader>fs: Ripgrep search for selected text (visual mode) vnoremap <leader>fs :<C-u>execute 'Rg ' . getreg('"')<CR> " Open man in vim noremap <c-k> :h <cword><cr> " 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({ ['<C-Space>'] = cmp.mapping.complete(), ['<CR>'] = cmp.mapping.confirm({ select = true }), ['<C-J>'] = cmp.mapping.select_next_item(), ['<C-K>'] = 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', '<leader>rn', vim.lsp.buf.rename, bufopts) -- vim.keymap.set('n', '<leader>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 <silent> gd <cmd>lua vim.lsp.buf.definition()<CR> nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR> nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR> nnoremap <silent> \d <cmd>lua vim.diagnostic.open_float(nil, { border = "rounded" })<CR> nnoremap <silent> [d <cmd>lua vim.diagnostic.goto_prev()<CR> nnoremap <silent> ]d <cmd>lua vim.diagnostic.goto_next()<CR> nnoremap <silent> \ca <cmd>lua vim.lsp.buf.code_action()<CR>