mirror of
https://github.com/itme-brain/vim.git
synced 2026-05-08 15:40:13 -04:00
removed IDE-like features
This commit is contained in:
parent
e5ff26b6f6
commit
f98c1a98cd
2 changed files with 49 additions and 38 deletions
25
README.md
25
README.md
|
|
@ -1,6 +1,6 @@
|
||||||
# Vim Config
|
# Vim Config
|
||||||
|
|
||||||
Lightweight vim config.
|
Lightweight Vim config that mirrors the core editing feel of the Neovim setup without the IDE stack.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
|
@ -30,8 +30,6 @@ Requires `curl` and `git` for vim-plug bootstrap. On NixOS this is managed via h
|
||||||
| vim-log-highlighting | Syntax highlighting for log files |
|
| vim-log-highlighting | Syntax highlighting for log files |
|
||||||
| vim-highlightedyank | Flash feedback on yank |
|
| vim-highlightedyank | Flash feedback on yank |
|
||||||
| lightline.vim | Statusline |
|
| lightline.vim | Statusline |
|
||||||
| vim-fugitive | Git commands (`:Git status`, `:Git blame`, etc.) |
|
|
||||||
| vim-signify | Git diff signs in the gutter |
|
|
||||||
| vim-anzu | Search match count in statusline |
|
| vim-anzu | Search match count in statusline |
|
||||||
|
|
||||||
## Keybinds
|
## Keybinds
|
||||||
|
|
@ -42,8 +40,8 @@ Leader is `Space`.
|
||||||
| Key | Action |
|
| Key | Action |
|
||||||
|-----|--------|
|
|-----|--------|
|
||||||
| `<leader>e` | Toggle netrw sidebar |
|
| `<leader>e` | Toggle netrw sidebar |
|
||||||
| `<leader>/` | Ripgrep search |
|
| `<leader>/` | Ripgrep search from git root |
|
||||||
| `<leader>ff` | Find files (fzf) |
|
| `<leader>ff` | Find files from git root (fzf) |
|
||||||
| `<leader>fp` | Recent files (fzf) |
|
| `<leader>fp` | Recent files (fzf) |
|
||||||
| `<leader>fb` | Open buffers (fzf) |
|
| `<leader>fb` | Open buffers (fzf) |
|
||||||
| `<leader>?` | Command history (fzf) |
|
| `<leader>?` | Command history (fzf) |
|
||||||
|
|
@ -52,26 +50,17 @@ Leader is `Space`.
|
||||||
| Key | Action |
|
| Key | Action |
|
||||||
|-----|--------|
|
|-----|--------|
|
||||||
| `H` / `L` | Previous / next buffer |
|
| `H` / `L` | Previous / next buffer |
|
||||||
| `<leader>bd` | Force close buffer |
|
| `<leader>bd` | Delete buffer safely |
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
| Key | Action |
|
| Key | Action |
|
||||||
|-----|--------|
|
|-----|--------|
|
||||||
| `<C-h/j/k/l>` | Navigate windows (skips netrw) |
|
| `<C-h/j/k/l>` | Navigate windows (skips netrw) |
|
||||||
| `<C-Arrow>` | Resize windows |
|
| `<C-Arrow>` | Resize windows |
|
||||||
| `<leader>wh` | Horizontal split |
|
| `<leader>wc` | Close window |
|
||||||
|
| `<leader>ws` | Horizontal split |
|
||||||
| `<leader>wv` | Vertical split |
|
| `<leader>wv` | Vertical split |
|
||||||
| `<leader>wd` | Close window |
|
| `<leader>wm` | Maximize window |
|
||||||
|
|
||||||
### Git
|
|
||||||
| Key | Action |
|
|
||||||
|-----|--------|
|
|
||||||
| `<leader>gs` | Git status |
|
|
||||||
| `<leader>gl` | Git log |
|
|
||||||
| `<leader>gd` | Git diff |
|
|
||||||
| `<leader>gb` | Git blame |
|
|
||||||
| `<leader>ga` | Git add |
|
|
||||||
| `<leader>gc` | Git commit |
|
|
||||||
|
|
||||||
### Other
|
### Other
|
||||||
| Key | Action |
|
| Key | Action |
|
||||||
|
|
|
||||||
62
vimrc
62
vimrc
|
|
@ -16,24 +16,25 @@ call plug#begin('~/.vim/plugged')
|
||||||
Plug 'mtdl9/vim-log-highlighting'
|
Plug 'mtdl9/vim-log-highlighting'
|
||||||
Plug 'machakann/vim-highlightedyank'
|
Plug 'machakann/vim-highlightedyank'
|
||||||
Plug 'itchyny/lightline.vim'
|
Plug 'itchyny/lightline.vim'
|
||||||
Plug 'tpope/vim-fugitive'
|
|
||||||
Plug 'mhinz/vim-signify'
|
|
||||||
Plug 'osyo-manga/vim-anzu'
|
Plug 'osyo-manga/vim-anzu'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
let mapleader = "\<Space>"
|
let mapleader = "\<Space>"
|
||||||
set background=dark
|
set background=dark
|
||||||
|
if has('termguicolors')
|
||||||
|
set termguicolors
|
||||||
|
endif
|
||||||
silent! colorscheme base16-onedark
|
silent! colorscheme base16-onedark
|
||||||
|
|
||||||
highlight Normal ctermbg=NONE guibg=NONE
|
highlight Normal ctermbg=NONE guibg=NONE ctermfg=White guifg=#FFFFFF
|
||||||
highlight NonText ctermbg=NONE guibg=NONE
|
highlight NonText ctermbg=NONE guibg=NONE
|
||||||
highlight CursorLine ctermbg=NONE guibg=NONE
|
highlight CursorLine ctermbg=NONE guibg=NONE
|
||||||
highlight CursorLineNr ctermfg=Yellow guifg=#FFCC66 ctermbg=NONE guibg=NONE cterm=bold
|
highlight CursorLineNr ctermfg=Yellow guifg=#E5C07B ctermbg=NONE guibg=NONE cterm=bold gui=bold
|
||||||
highlight HighlightedyankRegion ctermfg=Black guifg=#FFFFFF ctermbg=Yellow guibg=#FFA500
|
highlight HighlightedyankRegion ctermfg=Black guifg=#000000 ctermbg=Yellow guibg=yellow
|
||||||
highlight NormalNC ctermbg=NONE guibg=NONE
|
highlight NormalNC ctermbg=NONE guibg=NONE
|
||||||
highlight Search ctermfg=Black guifg=#000000 ctermbg=Yellow guibg=#FFCC66
|
highlight Search ctermfg=Black guifg=#000000 ctermbg=Yellow guibg=#FFCC66
|
||||||
highlight LineNr ctermbg=NONE guibg=NONE
|
highlight LineNr ctermbg=NONE guibg=NONE
|
||||||
highlight Visual ctermbg=LightGray guibg=#E8E8E8 ctermfg=Black guifg=#000000
|
highlight Visual ctermbg=Gray guibg=Gray ctermfg=Black guifg=Black
|
||||||
|
|
||||||
let g:highlightedyank_highlight_duration = 140
|
let g:highlightedyank_highlight_duration = 140
|
||||||
let g:lightline = { 'colorscheme': 'deus', }
|
let g:lightline = { 'colorscheme': 'deus', }
|
||||||
|
|
@ -74,7 +75,10 @@ set hidden
|
||||||
|
|
||||||
set tabstop=2
|
set tabstop=2
|
||||||
set shiftwidth=2
|
set shiftwidth=2
|
||||||
|
set softtabstop=2
|
||||||
set expandtab
|
set expandtab
|
||||||
|
set smartindent
|
||||||
|
set fillchars=eob:\
|
||||||
|
|
||||||
set statusline=%{exists('*anzu#search_status')?anzu#search_status():''}
|
set statusline=%{exists('*anzu#search_status')?anzu#search_status():''}
|
||||||
|
|
||||||
|
|
@ -102,6 +106,31 @@ function! SafeWincmd(dir)
|
||||||
execute 'wincmd ' . a:dir
|
execute 'wincmd ' . a:dir
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! GitRoot()
|
||||||
|
let l:root = systemlist('git rev-parse --show-toplevel')
|
||||||
|
if v:shell_error == 0 && !empty(l:root) && !empty(l:root[0])
|
||||||
|
return l:root[0]
|
||||||
|
endif
|
||||||
|
return getcwd()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! SafeBdelete()
|
||||||
|
if &filetype ==# 'netrw'
|
||||||
|
echohl WarningMsg | echom 'Cannot delete buffer from netrw' | echohl None
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:buflisted = getbufinfo({'buflisted': 1})
|
||||||
|
if len(l:buflisted) <= 1
|
||||||
|
echohl WarningMsg | echom 'Cannot delete last buffer' | echohl None
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:buf = bufnr('%')
|
||||||
|
bprevious
|
||||||
|
execute 'bdelete ' . l:buf
|
||||||
|
endfunction
|
||||||
|
|
||||||
" --- Plugin management ---
|
" --- Plugin management ---
|
||||||
nnoremap <leader>pu :PlugUpdate<CR>
|
nnoremap <leader>pu :PlugUpdate<CR>
|
||||||
nnoremap <leader>pd :PlugUpgrade<CR>
|
nnoremap <leader>pd :PlugUpgrade<CR>
|
||||||
|
|
@ -114,7 +143,7 @@ nmap N <Plug>(anzu-N-with-echo)
|
||||||
nmap * <Plug>(anzu-star-with-echo)
|
nmap * <Plug>(anzu-star-with-echo)
|
||||||
nmap # <Plug>(anzu-sharp-with-echo)
|
nmap # <Plug>(anzu-sharp-with-echo)
|
||||||
nmap <Esc><Esc> <Plug>(anzu-clear-search-status)
|
nmap <Esc><Esc> <Plug>(anzu-clear-search-status)
|
||||||
nnoremap <Esc> :noh<CR>
|
nnoremap <Esc> :noh<Bar>let @/=""<CR>
|
||||||
|
|
||||||
" --- Visual indentation ---
|
" --- Visual indentation ---
|
||||||
vnoremap < <gv
|
vnoremap < <gv
|
||||||
|
|
@ -137,30 +166,23 @@ nnoremap <C-Up> :resize +10<CR>
|
||||||
nnoremap <C-Down> :resize -10<CR>
|
nnoremap <C-Down> :resize -10<CR>
|
||||||
|
|
||||||
" --- Window management ---
|
" --- Window management ---
|
||||||
nnoremap <leader>wh :split<CR>
|
nnoremap <leader>wc :close<CR>
|
||||||
|
nnoremap <leader>ws :split<CR>
|
||||||
nnoremap <leader>wv :vsplit<CR>
|
nnoremap <leader>wv :vsplit<CR>
|
||||||
nnoremap <leader>wd :q<CR>
|
nnoremap <leader>wm <C-w>_
|
||||||
nnoremap <leader>ww :wincmd w<CR>
|
nnoremap <leader>ww :wincmd w<CR>
|
||||||
nnoremap <leader>wW :wincmd W<CR>
|
nnoremap <leader>wW :wincmd W<CR>
|
||||||
|
|
||||||
" --- Git (fugitive) ---
|
|
||||||
nnoremap <leader>gs :Git status<CR>
|
|
||||||
nnoremap <leader>gl :Git log<CR>
|
|
||||||
nnoremap <leader>ga :Git add<CR>
|
|
||||||
nnoremap <leader>gc :Git commit<CR>
|
|
||||||
nnoremap <leader>gd :Git diff<CR>
|
|
||||||
nnoremap <leader>gb :Git blame<CR>
|
|
||||||
|
|
||||||
" --- File explorer & search ---
|
" --- File explorer & search ---
|
||||||
nnoremap <leader>e :call NetrwToggle()<CR>
|
nnoremap <leader>e :call NetrwToggle()<CR>
|
||||||
nnoremap <leader>/ :Rg<Space>
|
nnoremap <leader>/ :execute 'lcd ' . fnameescape(GitRoot()) <Bar> Rg<Space>
|
||||||
nnoremap <leader>ff :Files<CR>
|
nnoremap <leader>ff :execute 'lcd ' . fnameescape(GitRoot()) <Bar> Files<CR>
|
||||||
nnoremap <leader>fp :History<CR>
|
nnoremap <leader>fp :History<CR>
|
||||||
nnoremap <leader>fb :Buffers<CR>
|
nnoremap <leader>fb :Buffers<CR>
|
||||||
nnoremap <leader>? :History:<CR>
|
nnoremap <leader>? :History:<CR>
|
||||||
|
|
||||||
" --- Buffers ---
|
" --- Buffers ---
|
||||||
nnoremap <leader>bd :bd!<CR>
|
nnoremap <leader>bd :call SafeBdelete()<CR>
|
||||||
nnoremap H :bprevious<CR>
|
nnoremap H :bprevious<CR>
|
||||||
nnoremap L :bnext<CR>
|
nnoremap L :bnext<CR>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue