Add zsh, nvim, git configs
This commit is contained in:
11
nvim/.config/nvim/commands.vim
Normal file
11
nvim/.config/nvim/commands.vim
Normal file
@ -0,0 +1,11 @@
|
||||
" Ctags
|
||||
" ^] goes to the tag
|
||||
command MakeTags !ctags -R .
|
||||
|
||||
" Show commands
|
||||
set showcmd
|
||||
|
||||
" Use ripgrep for grepping
|
||||
set grepprg=rg\ --vimgrep
|
||||
|
||||
" vim: ft=vim
|
65
nvim/.config/nvim/init.vim
Normal file
65
nvim/.config/nvim/init.vim
Normal file
@ -0,0 +1,65 @@
|
||||
" Source other files
|
||||
source ~/.config/nvim/plugins.vim
|
||||
source ~/.config/nvim/keybindings.vim
|
||||
source ~/.config/nvim/commands.vim
|
||||
source ~/.config/nvim/search.vim
|
||||
|
||||
" Source vim plugins
|
||||
set rtp+=/usr/share/vim/vimfiles
|
||||
|
||||
" Allow buffers to go to background without needing to write to disk
|
||||
set hidden
|
||||
|
||||
" Disables vi compatibility
|
||||
set nocompatible
|
||||
|
||||
" Colors
|
||||
set termguicolors
|
||||
"set background=light
|
||||
"colorscheme breezy
|
||||
|
||||
" Set tabs to 4 spaces
|
||||
set expandtab
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
|
||||
" Set syntax highlighting
|
||||
syntax enable
|
||||
|
||||
" Set filetype detection
|
||||
if has ("autocmd")
|
||||
filetype on
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
endif
|
||||
|
||||
" Set line numbers
|
||||
set number
|
||||
|
||||
" Set clipboard to X clipboard buffer
|
||||
set clipboard+=unnamedplus
|
||||
|
||||
" Indentation
|
||||
set autoindent
|
||||
set cindent
|
||||
|
||||
" Disables cursor-shape termcodes
|
||||
" Stops the weird q from appearing when changing modes
|
||||
set guicursor=
|
||||
|
||||
|
||||
" Window Management
|
||||
map <C-J> <C-W>j<C-W>_
|
||||
map <C-K> <C-W>k<C-W>_
|
||||
nmap <silent> <A-Up> :wincmd k<CR>
|
||||
nmap <silent> <A-Down> :wincmd j<CR>
|
||||
nmap <silent> <A-Left> :wincmd h<CR>
|
||||
nmap <silent> <A-Right> :wincmd l<CR>
|
||||
set wmh=0
|
||||
|
||||
" ---------- File finding ----------
|
||||
" Provide tab completion
|
||||
set path+=**
|
||||
|
||||
" Show all options when tab completing
|
||||
set wildmenu
|
17
nvim/.config/nvim/keybindings.vim
Normal file
17
nvim/.config/nvim/keybindings.vim
Normal file
@ -0,0 +1,17 @@
|
||||
" Disable ex mode
|
||||
map Q <Nop>
|
||||
|
||||
" Buffer Management
|
||||
"nnoremap <F5> :buffers<cr>:buffer<Space>
|
||||
|
||||
" No arrows
|
||||
map <up> <nop>
|
||||
map <down> <nop>
|
||||
map <left> <nop>
|
||||
map <right> <nop>
|
||||
|
||||
" Spelling
|
||||
inoremap <C-s> <Esc>:set spell!<cr>a
|
||||
nnoremap <C-s> :set spell!<cr>
|
||||
|
||||
" vim: ft=vim
|
24
nvim/.config/nvim/pager.vim
Normal file
24
nvim/.config/nvim/pager.vim
Normal file
@ -0,0 +1,24 @@
|
||||
" Status line
|
||||
set laststatus=0
|
||||
set cmdheight=1
|
||||
set nomodifiable " Only in version 6.0
|
||||
set readonly
|
||||
|
||||
" My xterms have a navy-blue background, so I need this line too.
|
||||
set background=dark
|
||||
|
||||
" Turn syntax on
|
||||
syntax enable
|
||||
|
||||
" No menu bar and tool bar
|
||||
set guioptions=aiMr
|
||||
|
||||
" Key bindings.
|
||||
nmap b <C-B><C-G>
|
||||
nmap q :q!<CR>
|
||||
nmap <Up> <C-Y>
|
||||
nmap <Down> <C-E>
|
||||
|
||||
" To type the following line, type *two* C-V's followed by two spaces. This
|
||||
" is how you map the spacebar.
|
||||
nmap ^V <C-F><C-G>
|
118
nvim/.config/nvim/plugins.vim
Normal file
118
nvim/.config/nvim/plugins.vim
Normal file
@ -0,0 +1,118 @@
|
||||
" vim-plug
|
||||
call plug#begin('~/.local/share/nvim/plugins')
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
Plug 'dense-analysis/ale'
|
||||
"Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||
"Plug 'tweekmonster/deoplete-clang2'
|
||||
Plug 'sbdchd/neoformat'
|
||||
Plug 'junegunn/fzf.vim', { 'do': { -> fzf#install() } }
|
||||
"Plug 'vim-airline/vim-airline'
|
||||
"Plug 'vim-airline/vim-airline-themes'
|
||||
|
||||
call plug#end()
|
||||
|
||||
" Configuration for plugins
|
||||
" ---------- Airline ----------
|
||||
let g:airline#extensions#tabline#enabled = 2
|
||||
let g:airline#extensions#tabline#fnamemod = ':t'
|
||||
let g:airline#extensions#tabline#left_sep = ' '
|
||||
let g:airline#extensions#tabline#left_alt_sep = '|'
|
||||
let g:airline#extensions#tabline#right_sep = ' '
|
||||
let g:airline#extensions#tabline#right_alt_sep = '|'
|
||||
let g:airline_left_sep = ' '
|
||||
let g:airline_left_alt_sep = '|'
|
||||
let g:airline_right_sep = ' '
|
||||
let g:airline_right_alt_sep = '|'
|
||||
let g:airline_theme='simple'
|
||||
|
||||
" --------- Ale ----------
|
||||
let g:ale_linters = {
|
||||
\ 'python': ['pylint'],
|
||||
\ 'vim': ['vint'],
|
||||
\ 'cpp': ['clang'],
|
||||
\ 'c': ['clang']
|
||||
\}
|
||||
|
||||
" ---------- Deoplete ----------
|
||||
let g:deoplete#enable_at_startup = 1
|
||||
|
||||
" ---------- Deoplete-Clang ----------
|
||||
"g:deoplete#sources#clang#libclang_path = "/Library/Developer/CommandLineTools/usr/lib/libclang.dylib"
|
||||
"g:deoplete#sources#clang#clang_header = "/Library/Developer/CommandLineTools/usr/lib/clang"
|
||||
|
||||
" ---------- Fzf ----------
|
||||
map <C-o> <esc>:FZF<cr>
|
||||
|
||||
" Setup for brew-installed fzf
|
||||
set rtp+=/usr/local/opt/fzf
|
||||
|
||||
" Navigate to a tag
|
||||
function! s:tags_sink(line)
|
||||
let parts = split(a:line, '\t\zs')
|
||||
let excmd = matchstr(parts[2:], '^.*\ze;"\t')
|
||||
execute 'silent e' parts[1][:-2]
|
||||
let [magic, &magic] = [&magic, 0]
|
||||
execute excmd
|
||||
let &magic = magic
|
||||
endfunction
|
||||
|
||||
function! s:tags()
|
||||
if empty(tagfiles())
|
||||
echohl WarningMsg
|
||||
echom 'Preparing tags'
|
||||
echohl None
|
||||
call system('ctags -R')
|
||||
endif
|
||||
|
||||
call fzf#run({
|
||||
\ 'source': 'cat '.join(map(tagfiles(), 'fnamemodify(v:val, ":S")')).
|
||||
\ '| grep -v -a ^!',
|
||||
\ 'options': '+m -d "\t" --with-nth 1,4.. -n 1 --tiebreak=index',
|
||||
\ 'down': '40%',
|
||||
\ 'sink': function('s:tags_sink')})
|
||||
endfunction
|
||||
|
||||
command! Tags call s:tags()
|
||||
map <C-t> <esc>:Tags<cr>
|
||||
|
||||
" Search lines in all open buffers
|
||||
function! s:line_handler(l)
|
||||
let keys = split(a:l, ':\t')
|
||||
exec 'buf' keys[0]
|
||||
exec keys[1]
|
||||
normal! ^zz
|
||||
endfunction
|
||||
|
||||
function! s:buffer_lines()
|
||||
let res = []
|
||||
for b in filter(range(1, bufnr('$')), 'buflisted(v:val)')
|
||||
call extend(res, map(getbufline(b,0,"$"), 'b . ":\t" . (v:key + 1) . ":\t" . v:val '))
|
||||
endfor
|
||||
return res
|
||||
endfunction
|
||||
|
||||
command! FZFLines call fzf#run({
|
||||
\ 'source': <sid>buffer_lines(),
|
||||
\ 'sink': function('<sid>line_handler'),
|
||||
\ 'options': '--extended --nth=3..',
|
||||
\ 'down': '60%'
|
||||
\})
|
||||
|
||||
" Select buffer
|
||||
function! s:buflist()
|
||||
redir => ls
|
||||
silent ls
|
||||
redir END
|
||||
return split(ls, '\n')
|
||||
endfunction
|
||||
|
||||
function! s:bufopen(e)
|
||||
execute 'buffer' matchstr(a:e, '^[ 0-9]*')
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <f5> :call fzf#run({
|
||||
\ 'source': reverse(<sid>buflist()),
|
||||
\ 'sink': function('<sid>bufopen'),
|
||||
\ 'options': '+m',
|
||||
\ 'down': len(<sid>buflist()) + 2
|
||||
\ })<CR>
|
13
nvim/.config/nvim/search.vim
Normal file
13
nvim/.config/nvim/search.vim
Normal file
@ -0,0 +1,13 @@
|
||||
" Search settings
|
||||
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" Case-insensitive searching on normal mode
|
||||
nnoremap * /\<<C-R>=expand('<cword>')<CR>\><CR>
|
||||
nnoremap # ?\<<C-R>=expand('<cword>')<CR>\><CR>
|
||||
|
||||
" Wrap scans at the bottom and top
|
||||
set wrapscan
|
||||
|
||||
" vim: ft=vim
|
8
nvim/.config/nvim/spell/en.utf-8.add
Normal file
8
nvim/.config/nvim/spell/en.utf-8.add
Normal file
@ -0,0 +1,8 @@
|
||||
Thermophile
|
||||
Halophiles
|
||||
Coli
|
||||
Nonpolar
|
||||
Carboxyl
|
||||
Amphipathic
|
||||
triacylglycerol
|
||||
Desynthesized
|
BIN
nvim/.config/nvim/spell/en.utf-8.add.spl
Normal file
BIN
nvim/.config/nvim/spell/en.utf-8.add.spl
Normal file
Binary file not shown.
Reference in New Issue
Block a user