vimrc refactor
This commit is contained in:
parent
c1ebd0cb69
commit
36089d0925
1 changed files with 100 additions and 112 deletions
164
vim/.vimrc
164
vim/.vimrc
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
" vim-plug {{{
|
" vim-plug {{{
|
||||||
"automatic installation
|
" Automatic installation
|
||||||
if empty(glob('~/.vim/autoload/plug.vim'))
|
if empty(glob('~/.vim/autoload/plug.vim'))
|
||||||
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
||||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
|
@ -31,85 +31,98 @@
|
||||||
Plug 'relastle/bluewery.vim'
|
Plug 'relastle/bluewery.vim'
|
||||||
Plug 'sainnhe/vim-color-forest-night'
|
Plug 'sainnhe/vim-color-forest-night'
|
||||||
Plug 'justinmk/vim-sneak'
|
Plug 'justinmk/vim-sneak'
|
||||||
|
" Todo:
|
||||||
" Plug 'metakirby5/codi.vim'
|
" GV
|
||||||
|
" Gundo (or undotree?)
|
||||||
|
" Emmett
|
||||||
|
" Fugitive
|
||||||
|
" Vimwiki
|
||||||
|
" Plug 'ryanss/vim-hackernews'
|
||||||
|
" Plug 'mbbill/undotree' or Plug 'sjl/gundo.vim'
|
||||||
|
" Plug 'tpope/vim-projectionist'
|
||||||
|
" Plug 'mileszs/ack.vim'
|
||||||
|
" Plug 'vim-pandoc/vim-pandoc'
|
||||||
|
" Plug 'alfredodeza/pytest.vim'
|
||||||
|
" Plug 'docker/docker'
|
||||||
|
" Plug vim-scripts/indentpython.vim
|
||||||
|
"
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" appearance {{{
|
" appearance {{{
|
||||||
colorscheme zenburn
|
colorscheme zenburn
|
||||||
syntax on "enable syntax
|
syntax on " Enable syntax
|
||||||
set encoding=utf-8 "keep utf-8 encoding
|
set encoding=utf-8 " Keep utf-8 encoding
|
||||||
set scrolloff=3 "keep at least 3 lines above and below cursor
|
set scrolloff=3 " Keep at least 3 lines above and below cursor
|
||||||
set showmode "something something buffers
|
set showmode " Something something buffers
|
||||||
set showcmd "show command in bottom bar
|
set showcmd " Show command in bottom bar
|
||||||
set wildmenu "visual autocomplete for command menu
|
set wildmenu " Visual autocomplete for command menu
|
||||||
set wildmode=list:longest "show all completions on tab
|
set wildmode=list:longest " Show all completions on tab
|
||||||
set laststatus=2 "last window will always have statusline
|
set laststatus=2 " Last window will always have statusline
|
||||||
set showmatch "highlight matching [{()}]
|
set showmatch " Highlight matching [{()}]
|
||||||
set cursorline "highlight current line
|
set cursorline " Highlight current line
|
||||||
|
|
||||||
" remove underline on current line number
|
" remove underline on current line number
|
||||||
hi CursorLineNr cterm=bold
|
hi CursorLineNr cterm=bold
|
||||||
|
|
||||||
"lightline
|
" Lightline
|
||||||
let g:lightline = { 'colorscheme': 'sceaduhelm', }
|
let g:lightline = { 'colorscheme': 'sceaduhelm', }
|
||||||
set fillchars+=vert:│
|
set fillchars+=vert:│
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
"movement {{{
|
" Movement {{{
|
||||||
" TODO: map alt-j and k to move text lines vertically, maintaining indent
|
" TODO: map alt-j and k to move text lines vertically, maintaining indent
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
"folding {{{
|
" Folding {{{
|
||||||
set foldenable "enable folding
|
set foldenable " Enable folding
|
||||||
set foldmethod=marker "fold sections by marker
|
set foldmethod=marker " Fold sections by marker
|
||||||
set foldlevel=0 "fold by default
|
set foldlevel=0 " Fold by default
|
||||||
set modelines=1 "check final line of file for modeline
|
set modelines=1 " Check final line of file for modeline
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" behavior {{{
|
" behavior {{{
|
||||||
set nocompatible "turn off vi compatability nonsense
|
set nocompatible " Turn off vi compatability nonsense
|
||||||
set hidden "hide buffer when opening new file
|
set hidden " Hide buffer when opening new file
|
||||||
set visualbell "use visual bell instead of beeping
|
set visualbell " Use visual bell instead of beeping
|
||||||
set ttyfast "improves smoothness and drawing
|
set ttyfast " Improves smoothness and drawing
|
||||||
set backspace=indent,eol,start "always allow backspacing
|
set backspace=indent,eol,start " Always allow backspacing
|
||||||
set undofile "make .un file for persistent undo
|
set undofile " Make .un file for persistent undo
|
||||||
set relativenumber "make numbers relative to current line
|
set relativenumber " Make numbers relative to current line
|
||||||
set lazyredraw "redraw only when necessary
|
set lazyredraw " Redraw only when necessary
|
||||||
set updatetime=100 "make updates happen faster (gitgutter)
|
set updatetime=100 " Make updates happen faster (gitgutter)
|
||||||
set splitright "make split to right by default
|
set splitright " Make split to right by default
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" searching {{{
|
" searching {{{
|
||||||
set gdefault "remove default g flag on search
|
set gdefault " Remove default g flag on search
|
||||||
set ignorecase "ignore case for searches
|
set ignorecase " Ignore case for searches
|
||||||
set smartcase "case-specific only when uppercase
|
set smartcase " Case-specific only when uppercase
|
||||||
set hlsearch "don't continue to highlight searched phrases.
|
set hlsearch " Don't continue to highlight searched phrases.
|
||||||
set incsearch "but do search as characters are entered
|
set incsearch " But do search as characters are entered
|
||||||
"remap tab to jump by brackets
|
" Remap tab to jump by brackets
|
||||||
" nnoremap <tab> %
|
" Nnoremap <tab> %
|
||||||
" vnoremap <tab> %
|
" Vnoremap <tab> %
|
||||||
" remp tab to jump by window
|
" Remp tab to jump by window
|
||||||
nnoremap <tab> <C-w>w
|
nnoremap <tab> <C-w>w
|
||||||
vnoremap <tab> <C-w>w
|
vnoremap <tab> <C-w>w
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" tab settings {{{
|
" tab settings {{{
|
||||||
set tabstop=4 " number of visual spaces per tab
|
set tabstop=4 " Number of visual spaces per tab
|
||||||
set softtabstop=4 "should always = tabstop
|
set softtabstop=4 " Should always = tabstop
|
||||||
set shiftwidth=4 "indent/outdent by 4 columns
|
set shiftwidth=4 " Indent/outdent by 4 columns
|
||||||
set expandtab "tabs are spaces
|
set expandtab " Tabs are spaces
|
||||||
set shiftround "always indent/outdent to the nearest tabstop
|
set shiftround " Always indent/outdent to the nearest tabstop
|
||||||
"make search terms more visible
|
" Make search terms more visible
|
||||||
highlight Visual ctermbg=DarkGreen ctermfg=Black
|
highlight Visual ctermbg=DarkGreen ctermfg=Black
|
||||||
set autoindent "auto indentation
|
set autoindent " Auto indentation
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" ruler settings {{{
|
" ruler settings {{{
|
||||||
set rulerformat=%l,%-2v\|%4L\ Lines "display line, column, and total lines
|
set rulerformat=%l,%-2v\|%4L\ Lines " Display line, column, and total lines
|
||||||
set ruler "turn on ruler
|
set ruler " Turn on ruler
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" long line handling {{{
|
" long line handling {{{
|
||||||
|
|
@ -122,13 +135,13 @@
|
||||||
" leaders {{{
|
" leaders {{{
|
||||||
:let mapleader = ","
|
:let mapleader = ","
|
||||||
|
|
||||||
"clear search highlighting with leader-space
|
" Clear search highlighting with leader-space
|
||||||
nnoremap <leader><space> :noh<cr>
|
nnoremap <leader><space> :noh<cr>
|
||||||
|
|
||||||
"underline with line of the same length
|
" Underline with line of the same length
|
||||||
nnoremap <leader>- yypv$r-
|
nnoremap <leader>- yypv$r-
|
||||||
|
|
||||||
"insert date on current line
|
" Insert date on current line
|
||||||
nnoremap <leader>d k :r !date <cr>
|
nnoremap <leader>d k :r !date <cr>
|
||||||
|
|
||||||
nnoremap <leader>k :vert new ~/.vim/bindings.md <cr>
|
nnoremap <leader>k :vert new ~/.vim/bindings.md <cr>
|
||||||
|
|
@ -140,7 +153,7 @@
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" hjkl {{{
|
" hjkl {{{
|
||||||
"disable arrow keys in normal and visual mode
|
" Disable arrow keys in normal and visual mode
|
||||||
nnoremap <up> <nop>
|
nnoremap <up> <nop>
|
||||||
nnoremap <down> <nop>
|
nnoremap <down> <nop>
|
||||||
nnoremap <left> <nop>
|
nnoremap <left> <nop>
|
||||||
|
|
@ -149,26 +162,26 @@
|
||||||
inoremap <down> <nop>
|
inoremap <down> <nop>
|
||||||
inoremap <left> <nop>
|
inoremap <left> <nop>
|
||||||
inoremap <right> <nop>
|
inoremap <right> <nop>
|
||||||
"disable h and l
|
" Disable h and l
|
||||||
" nnoremap h <nop>
|
" nnoremap h <nop>
|
||||||
" nnoremap l <nop>
|
" nnoremap l <nop>
|
||||||
"make j and k move by screen line, not file line
|
" Make j and k move by screen line, not file line
|
||||||
nnoremap j gj
|
nnoremap j gj
|
||||||
nnoremap k gk
|
nnoremap k gk
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" split pane navigation {{{
|
" split pane navigation {{{
|
||||||
"map vertical split to \ w, switch to it, open explorer, prompt for filename
|
" Map vertical split to \ w, switch to it, open explorer, prompt for filename
|
||||||
" TODO: make new window prompt use fzf
|
" TODO: make new window prompt use fzf
|
||||||
nnoremap <leader>w <C-w>v<C-w>l:e <C-S-d><BS><BS>open
|
nnoremap <leader>w <C-w>v<C-w>l:e <C-S-d><BS><BS>open
|
||||||
"switch panes wit ctrl + h/j/k/l
|
" Switch panes wit ctrl + h/j/k/l
|
||||||
nnoremap <C-h> <C-w>h
|
nnoremap <C-h> <C-w>h
|
||||||
nnoremap <C-j> <C-w>j
|
nnoremap <C-j> <C-w>j
|
||||||
nnoremap <C-k> <C-w>k
|
nnoremap <C-k> <C-w>k
|
||||||
nnoremap <C-l> <C-w>l
|
nnoremap <C-l> <C-w>l
|
||||||
nnoremap <C-c> :close <cr>
|
nnoremap <C-c> :close <cr>
|
||||||
nnoremap <C-n> :bn <cr>
|
nnoremap <C-n> :bn <cr>
|
||||||
"map resize pane
|
" Map resize pane
|
||||||
" TODO: remap pane resize to something else (leader?)
|
" TODO: remap pane resize to something else (leader?)
|
||||||
map + :vertical resize +5<CR>
|
map + :vertical resize +5<CR>
|
||||||
map - :vertical resize -5<CR>
|
map - :vertical resize -5<CR>
|
||||||
|
|
@ -189,13 +202,13 @@
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" file specific {{{
|
" file specific {{{
|
||||||
"in markdown files, when writing add two spaces to each line to fix spacing
|
" In markdown files, when writing add two spaces to each line to fix spacing
|
||||||
"in compiled version
|
" In compiled version
|
||||||
" au BufWritePost *.md silent! %s/[^ ]\zs$/\1 /
|
" au BufWritePost *.md silent! %s/[^ ]\zs$/\1 /
|
||||||
" TODO: find a better solution
|
" TODO: find a better solution
|
||||||
"bold something in a markdown file
|
" Bold something in a markdown file
|
||||||
" :au FileType markdown nmap <leader>b i**<esc>ea**<esc>b
|
" :au FileType markdown nmap <leader>b i**<esc>ea**<esc>b
|
||||||
"python
|
" Python
|
||||||
" au BufNewFile,BufRead *.py
|
" au BufNewFile,BufRead *.py
|
||||||
"\ set tabstop=4
|
"\ set tabstop=4
|
||||||
"\ set softtabstop=4
|
"\ set softtabstop=4
|
||||||
|
|
@ -204,7 +217,7 @@
|
||||||
"\ set expandtab
|
"\ set expandtab
|
||||||
"\ set autoindent
|
"\ set autoindent
|
||||||
"\ set fileformat=unix
|
"\ set fileformat=unix
|
||||||
""webdev
|
"" Webdev
|
||||||
" au BufNewFile,BufRead *.js, *.html, *.css
|
" au BufNewFile,BufRead *.js, *.html, *.css
|
||||||
"\ set tabstop=2
|
"\ set tabstop=2
|
||||||
"\ set softtabstop=2
|
"\ set softtabstop=2
|
||||||
|
|
@ -250,7 +263,7 @@
|
||||||
" git commands {{{
|
" git commands {{{
|
||||||
" TODO: map fugitive commands
|
" TODO: map fugitive commands
|
||||||
" TODO: check out gv etc
|
" TODO: check out gv etc
|
||||||
" gitgutter hunk view
|
" Gitgutter hunk view
|
||||||
nmap ghv <Plug>(GitGutterPreviewHunk)
|
nmap ghv <Plug>(GitGutterPreviewHunk)
|
||||||
nmap ghn <Plug>(GitGutterNextHunk)
|
nmap ghn <Plug>(GitGutterNextHunk)
|
||||||
nmap ghp <Plug>(GitGutterPrevHunk)
|
nmap ghp <Plug>(GitGutterPrevHunk)
|
||||||
|
|
@ -265,28 +278,3 @@
|
||||||
" folding options, this must be last in file
|
" folding options, this must be last in file
|
||||||
" vim:foldmethod=marker:foldlevel=0
|
" vim:foldmethod=marker:foldlevel=0
|
||||||
|
|
||||||
"todo:
|
|
||||||
"clean up folding
|
|
||||||
"make windows-specific plugin install using conditional activation setting here:
|
|
||||||
"https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
|
|
||||||
"to install:
|
|
||||||
"emmett
|
|
||||||
"codi
|
|
||||||
"fugitive
|
|
||||||
"vimwiki
|
|
||||||
" Plug 'terryma/vim-multiple-cursors'
|
|
||||||
" Plug 'ryanss/vim-hackernews'
|
|
||||||
" Plug 'mbbill/undotree' or Plug 'sjl/gundo.vim'
|
|
||||||
" Plugin 'tpope/vim-projectionist'
|
|
||||||
" Plug 'mileszs/ack.vim'
|
|
||||||
" Plug 'vim-scripts/grep.vim'
|
|
||||||
" Plug 'jpalardy/vim-slime' (maybe not with codi?)
|
|
||||||
" Plug 'vim-pandoc/vim-pandoc'
|
|
||||||
" Plugin 'alfredodeza/pytest.vim'
|
|
||||||
" Plug 'docker/docker'
|
|
||||||
" Plug 'tyrannicaltoucan/vim-quantum'
|
|
||||||
" Plug vim-scripts/indentpython.vim
|
|
||||||
" bind :bnext :blast (leader n, leader p?) map gn :bn<cr> (:bd for
|
|
||||||
" delete and unload) (unimpaired?) (buffer fzf?)
|
|
||||||
" csv.vim
|
|
||||||
"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue