Remove experimental modules, add initial foldlevel
Vim experimental modules should be short-lived and really used for experimentation, not be always in git and messing up diffs. An initial foldlevel of 2 has been added to vim, this is experimental and if it doesn't suit me can be easily reverted.
This commit is contained in:
parent
3668e11bbe
commit
7917b45859
5 changed files with 3 additions and 658 deletions
|
@ -139,6 +139,9 @@ au FocusLost * :wa
|
|||
" care of it
|
||||
set noshowmode
|
||||
|
||||
" i feel foldlevel 2 is generally pretty usable, for headlines and similar
|
||||
set foldlevel=2
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
|
|
@ -1,201 +0,0 @@
|
|||
" vim: set foldmethod=marker foldlevel=1 nomodeline:
|
||||
" ================================================================================
|
||||
" .init.vim / .vimrc of Marty Oehme {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" - stolen from many different sources including
|
||||
" Steve Losh
|
||||
" Junegunn Choi
|
||||
" Tim Pope
|
||||
|
||||
" this config does not set nocompatible - neovim does this automatically
|
||||
" this config does not set filetype plugin - vim-sensible does this
|
||||
" }}}
|
||||
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" automatically install vim-plug if it does not exist
|
||||
" Note: this installs it in the neovim folder, not the vim folder
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source academia_fzf.vim | q
|
||||
endif
|
||||
|
||||
" automatically install any missing plugins
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
"
|
||||
" set truecolor (neovim)
|
||||
set termguicolors
|
||||
|
||||
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
" one press of backspace.
|
||||
" great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set expandtab
|
||||
|
||||
" set cursor line highlighting, esp useful when using with bracket
|
||||
" highlighting and you don't know which side of the brace the cursor is on
|
||||
set cursorline
|
||||
|
||||
" shows linenumbers relative to the one you are on, for easy movement and
|
||||
" dNUMBERd deletions
|
||||
set number relativenumber
|
||||
|
||||
" keeps an undofile next to files so that you can even undo if vim is closed
|
||||
" in between
|
||||
set undofile
|
||||
|
||||
" ignores case by default but will use case when search is specifically not
|
||||
" all lowercased
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" whenever vim loses focus, save
|
||||
au FocusLost * :wa
|
||||
|
||||
" disables showing us the current mode in the command line since airline takes
|
||||
" care of it
|
||||
set noshowmode
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings (e.g. vim-waikiki for files under
|
||||
" the root dir to the same key -- might lead to incompatibilities, will have
|
||||
" to test)
|
||||
let maplocalleader = "\<Space>"
|
||||
" set jk to escape, in case capslock is not mapped to escape on the system
|
||||
inoremap jk <ESC>
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp academia_fzf.vim<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source academia_fzf.vim<cr>
|
||||
|
||||
|
||||
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" stronger versions of left,right - move all the way
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
|
||||
" }}}
|
||||
" CUSTOMIZATION {{{
|
||||
|
||||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
" automatically switch between relative and absolute numbers as buffers move
|
||||
" into / out of focus (requires number & relativenumber to be set)
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
||||
Plug 'rakr/vim-one'
|
||||
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
|
||||
|
||||
call plug#end()
|
||||
endif
|
||||
|
||||
" FZF Fuzzy Finding
|
||||
" set some fzf defaults
|
||||
let g:fzf_layout = { 'up': '~40%' }
|
||||
let g:fzf_colors =
|
||||
\ { 'fg': ['fg', 'Normal'],
|
||||
\ 'bg': ['bg', 'Normal'],
|
||||
\ 'hl': ['fg', 'Comment'],
|
||||
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
|
||||
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
||||
\ 'hl+': ['fg', 'Statement'],
|
||||
\ 'info': ['fg', 'PreProc'],
|
||||
\ 'border': ['fg', 'Ignore'],
|
||||
\ 'prompt': ['fg', 'Conditional'],
|
||||
\ 'pointer': ['fg', 'Exception'],
|
||||
\ 'marker': ['fg', 'Keyword'],
|
||||
\ 'spinner': ['fg', 'Label'],
|
||||
\ 'header': ['fg', 'Comment'] }
|
||||
let g:fzf_action = {
|
||||
\ 'ctrl-t': 'tab split',
|
||||
\ 'ctrl-x': 'split',
|
||||
\ 'ctrl-v': 'vsplit' }
|
||||
|
||||
" set up fzf-bibtex
|
||||
let g:fzf_bibtex_cache = '~/.cache/'
|
||||
let g:fzf_bibtex_sources = 'academia.bib'
|
||||
|
||||
" prepare bibtex_ls function to look for bib files in cwd/parent/subdirs,
|
||||
" attach the standard bibtex source file
|
||||
" return the command with standard cache directory filled
|
||||
function! s:bibtex_ls(...)
|
||||
let bibfiles = (
|
||||
\ globpath('.', '*.bib', v:true, v:true) +
|
||||
\ globpath('..', '*.bib', v:true, v:true) +
|
||||
\ globpath('*/', '*.bib', v:true, v:true)
|
||||
\ )
|
||||
let bibfiles = join(bibfiles, ' ')
|
||||
let source_cmd = 'bibtex-ls -cache ' . g:fzf_bibtex_cache . ' ' .bibfiles . ' ' . g:fzf_bibtex_sources
|
||||
return source_cmd
|
||||
endfunction
|
||||
|
||||
" insert citation from normal mode at cursor (with brackets)
|
||||
function! s:bibtex_cite_sink(lines)
|
||||
let r=system("bibtex-cite ", a:lines)
|
||||
execute ':normal! i[' . r . ']'
|
||||
endfunction
|
||||
command! -bang -nargs=* CiteRef call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(<q-args>),
|
||||
\ 'sink*': function('<sid>bibtex_cite_sink'),
|
||||
\ 'up': '25%',
|
||||
\ 'options': '--ansi --multi --prompt "Cite> "'
|
||||
\ }))
|
||||
" insert citation from insert mode at cursor (no brackets inserted)
|
||||
function! s:bibtex_cite_sink_insert(lines)
|
||||
let r=system("bibtex-cite ", a:lines)
|
||||
execute ':normal! i' . r
|
||||
call feedkeys('a', 'n')
|
||||
endfunction
|
||||
" insert markdown formatted reference
|
||||
function! s:bibtex_markdown_sink(lines)
|
||||
let r=system("bibtex-markdown -cache " . g:fzf_bibtex_cache . ' ' . g:fzf_bibtex_sources, a:lines)
|
||||
echo join(a:lines, '; ')
|
||||
execute ':normal! i' . r
|
||||
endfunction
|
||||
command! -bang -nargs=* CiteMarkdown call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(),
|
||||
\ 'sink*': function('<sid>bibtex_markdown_sink'),
|
||||
\ 'up': '25%',
|
||||
\ 'options': '--ansi --multi --prompt "Markdown> "'
|
||||
\ }))
|
||||
|
||||
" map @@ to automatically insert citation reference at cursor
|
||||
inoremap <silent> @@ <c-g>u<c-o>:call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(),
|
||||
\ 'sink*': function('<sid>bibtex_cite_sink_insert'),
|
||||
\ 'up': '25%',
|
||||
\ 'options': '--ansi --multi --prompt "Cite> "'}))<CR>
|
||||
" map <leader>cc to insert a complete citation at cursor
|
||||
nnoremap <silent> <leader>cc :CiteRef<cr>
|
||||
" map <leader>cm to insert markdown prettified citation
|
||||
nnoremap <silent> <leader>cm :CiteMarkdown<cr>
|
||||
|
||||
" }}}
|
||||
|
||||
colo one
|
|
@ -1,198 +0,0 @@
|
|||
" vim: set foldmethod=marker foldlevel=1 nomodeline:
|
||||
" ================================================================================
|
||||
" .init.vim / .vimrc of Marty Oehme {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" - stolen from many different sources including
|
||||
" Steve Losh
|
||||
" Junegunn Choi
|
||||
" Tim Pope
|
||||
|
||||
" this config does not set nocompatible - neovim does this automatically
|
||||
" this config does not set filetype plugin - vim-sensible does this
|
||||
" }}}
|
||||
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" automatically install vim-plug if it does not exist
|
||||
" Note: this installs it in the neovim folder, not the vim folder
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source academia_pandoc.vim | q
|
||||
endif
|
||||
|
||||
" automatically install any missing plugins
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
"
|
||||
" set truecolor (neovim)
|
||||
set termguicolors
|
||||
|
||||
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
" one press of backspace.
|
||||
" great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set expandtab
|
||||
|
||||
" set cursor line highlighting, esp useful when using with bracket
|
||||
" highlighting and you don't know which side of the brace the cursor is on
|
||||
set cursorline
|
||||
|
||||
" shows linenumbers relative to the one you are on, for easy movement and
|
||||
" dNUMBERd deletions
|
||||
set number relativenumber
|
||||
|
||||
" keeps an undofile next to files so that you can even undo if vim is closed
|
||||
" in between
|
||||
set undofile
|
||||
|
||||
" ignores case by default but will use case when search is specifically not
|
||||
" all lowercased
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" whenever vim loses focus, save
|
||||
au FocusLost * :wa
|
||||
|
||||
" disables showing us the current mode in the command line since airline takes
|
||||
" care of it
|
||||
set noshowmode
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings (e.g. vim-waikiki for files under
|
||||
" the root dir to the same key -- might lead to incompatibilities, will have
|
||||
" to test)
|
||||
let maplocalleader = "\<Space>"
|
||||
" set jk to escape, in case capslock is not mapped to escape on the system
|
||||
inoremap jk <ESC>
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp academia_pandoc.vim<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source academia_pandoc.vim<cr>
|
||||
|
||||
|
||||
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" stronger versions of left,right - move all the way
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
|
||||
" }}}
|
||||
" CUSTOMIZATION {{{
|
||||
|
||||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
" automatically switch between relative and absolute numbers as buffers move
|
||||
" into / out of focus (requires number & relativenumber to be set)
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
||||
Plug 'rakr/vim-one'
|
||||
|
||||
Plug 'vim-pandoc/vim-pandoc'
|
||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||
|
||||
Plug 'Shougo/deoplete.nvim' " automatic suggestions, can also perhaps be changed for newer plugs
|
||||
|
||||
call plug#end()
|
||||
endif
|
||||
|
||||
" PLUGIN: DEOPLETE
|
||||
" enable deoplete at startup
|
||||
let g:deoplete#enable_at_startup = 1
|
||||
let g:deoplete#enable_ignore_case = 1
|
||||
let g:deoplete#enable_smart_case = 1
|
||||
let g:deoplete#enable_camel_case = 1
|
||||
let g:deoplete#enable_refresh_always = 1
|
||||
let g:deoplete#max_abbr_width = 0
|
||||
let g:deoplete#max_menu_width = 0
|
||||
" call deoplete#custom#var('omni', 'input_patterns', {
|
||||
" \ 'pandoc': '@',
|
||||
" \})
|
||||
" call deoplete#enable()
|
||||
" lazy loading since they require a lot of startup time
|
||||
let s:ide_features_loaded=0
|
||||
function! Autocomplete_linting_init() abort
|
||||
if s:ide_features_loaded || !has('nvim')
|
||||
return
|
||||
endif
|
||||
let s:ide_features_loaded=1
|
||||
call plug#load('ale', 'deoplete.nvim', 'echodoc.vim')
|
||||
call echodoc#enable()
|
||||
call deoplete#custom#var('omni', 'input_patterns', {
|
||||
\ 'pandoc': '@',
|
||||
\})
|
||||
call deoplete#enable()
|
||||
endfunction
|
||||
|
||||
augroup load_ide_features
|
||||
autocmd!
|
||||
autocmd InsertEnter * call Autocomplete_linting_init()
|
||||
augroup END
|
||||
|
||||
set foldlevel=2
|
||||
|
||||
" PLUGIN: vim-pandoc
|
||||
" handle markdown files with pandoc (and pandoc syntax!)
|
||||
let g:pandoc#filetypes#pandoc_markdown = 1
|
||||
" disable all default keymaps
|
||||
let g:pandoc#keyboard#use_default_mappings=0
|
||||
let g:pandoc#hypertext#use_default_mappings=0
|
||||
" if there's a pdf and an html or similar, open the pdf
|
||||
let g:pandoc#command#prefer_pdf=1
|
||||
" look for bibtex files w/ same name as edited one, then .bib in current dir, yaml frontmatter, and finally the globally set bibs file
|
||||
let g:pandoc#biblio#sources="bcyg"
|
||||
" the globally set bibs file
|
||||
let g:pandoc#biblio#bibs=["academia.bib"]
|
||||
let g:pandoc#biblio#use_bibtool=1
|
||||
let g:pandoc#biblio#use_preview=1
|
||||
let g:pandoc#completion#bib#mode='citeproc'
|
||||
let g:pandoc#folding#fold_yaml=1
|
||||
let g:pandoc#folding#fastfolds=1
|
||||
let g:pandoc#spell#default_langs=["en_us", "de_de"]
|
||||
let g:pandoc#hypertext#ausosave_on_edit_open_link=1
|
||||
let g:pandoc#hypertext#create_if_no_alternates_exists=1
|
||||
let g:pandoc#syntax#conceal#use = 1
|
||||
let g:pandoc#syntax#conceal#urls = 1
|
||||
|
||||
" follow and open links with pandoc
|
||||
" open a file with either local means, or let the system decide
|
||||
nnoremap <silent> gX :<C-u>call pandoc#hypertext#OpenSystem()<cr>
|
||||
nnoremap <silent> gx :<C-u>call pandoc#hypertext#OpenLocal()<cr>
|
||||
" open a link in the editor (this buffer, or split)
|
||||
nnoremap <silent> gf :<C-u>call pandoc#hypertext#OpenLink( g:pandoc#hypertext#edit_open_cmd )<cr>
|
||||
nnoremap <silent> <CR> :<C-u>call pandoc#hypertext#OpenLink( g:pandoc#hypertext#edit_open_cmd )<cr>
|
||||
nnoremap <silent> gF :<C-u>call pandoc#hypertext#OpenLink( g:pandoc#hypertext#split_open_cmd )<cr>
|
||||
nnoremap <silent> gF :<C-u>call pandoc#hypertext#OpenLink( g:pandoc#hypertext#split_open_cmd )<cr>
|
||||
" go back a link
|
||||
nnoremap <silent> gb :<C-u>call pandoc#hypertext#BackFromLink()<cr>
|
||||
nnoremap <silent> <BS> :<C-u>call pandoc#hypertext#BackFromLink()<cr>
|
||||
|
||||
" Add pandoc citations to deoplete automatic completions
|
||||
"call deoplete#custom#var('omni', 'input_patterns', {
|
||||
" \ 'pandoc': '@'
|
||||
" \})
|
||||
|
||||
" }}}
|
||||
colo one
|
|
@ -1,153 +0,0 @@
|
|||
" vim: set foldmethod=marker foldlevel=1 nomodeline:
|
||||
" ================================================================================
|
||||
" .init.vim / .vimrc of Marty Oehme {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" - stolen from many different sources including
|
||||
" Steve Losh
|
||||
" Junegunn Choi
|
||||
" Tim Pope
|
||||
|
||||
" this config does not set nocompatible - neovim does this automatically
|
||||
" this config does not set filetype plugin - vim-sensible does this
|
||||
" }}}
|
||||
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
|
||||
" ================================================================================
|
||||
"
|
||||
" automatically install vim-plug if it does not exist
|
||||
" Note: this installs it in the neovim folder, not the vim folder
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source academia.vim | q
|
||||
endif
|
||||
|
||||
" automatically install any missing plugins
|
||||
autocmd VimEnter *
|
||||
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | q
|
||||
\| endif
|
||||
"
|
||||
" set truecolor (neovim)
|
||||
set termguicolors
|
||||
|
||||
" sets tabs to be 2 characters, expanded into spaces, but still removable with
|
||||
" one press of backspace.
|
||||
" great explanation: http://vimcasts.org/transcripts/2/en/
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set softtabstop=2
|
||||
set expandtab
|
||||
|
||||
" set cursor line highlighting, esp useful when using with bracket
|
||||
" highlighting and you don't know which side of the brace the cursor is on
|
||||
set cursorline
|
||||
|
||||
" shows linenumbers relative to the one you are on, for easy movement and
|
||||
" dNUMBERd deletions
|
||||
set number relativenumber
|
||||
|
||||
" keeps an undofile next to files so that you can even undo if vim is closed
|
||||
" in between
|
||||
set undofile
|
||||
|
||||
" ignores case by default but will use case when search is specifically not
|
||||
" all lowercased
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" whenever vim loses focus, save
|
||||
au FocusLost * :wa
|
||||
|
||||
" disables showing us the current mode in the command line since airline takes
|
||||
" care of it
|
||||
set noshowmode
|
||||
|
||||
" highlight everything that goes over 80 columns
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%81v', 100)
|
||||
|
||||
" set our leader key to space since with hjkl, space is largely useless
|
||||
let mapleader = "\<Space>"
|
||||
" maps the leader for buffer local mappings (e.g. vim-waikiki for files under
|
||||
" the root dir to the same key -- might lead to incompatibilities, will have
|
||||
" to test)
|
||||
let maplocalleader = "\<Space>"
|
||||
" set jk to escape, in case capslock is not mapped to escape on the system
|
||||
inoremap jk <ESC>
|
||||
|
||||
" remove search highlights by pressing space+/ - the key for searching the
|
||||
" first place
|
||||
nnoremap <leader>/ :noh<cr>
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
nnoremap <leader>V :vsp academia.vim<cr>
|
||||
" automatically source the vimrc file whenever it is saved (causes slowdown
|
||||
" when done in MANY successions)
|
||||
" au BufWritePost init.vim so ~/.config/nvim/init.vim
|
||||
" source vimrc with keystroke combination
|
||||
nnoremap <leader>VV :source academia.vim<cr>
|
||||
|
||||
|
||||
" 'open new buffer' with leader-t (opens new buffer and switches to it)
|
||||
" open actual new tab with leader-T
|
||||
nnoremap <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" stronger versions of left,right - move all the way
|
||||
nnoremap H ^
|
||||
nnoremap L $
|
||||
|
||||
" }}}
|
||||
" CUSTOMIZATION {{{
|
||||
|
||||
" defines plugin directory
|
||||
" Install plugins from vim with :PlugInstall
|
||||
silent! if plug#begin('~/.local/share/nvim/plugged')
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
" automatically switch between relative and absolute numbers as buffers move
|
||||
" into / out of focus (requires number & relativenumber to be set)
|
||||
Plug 'jeffkreeftmeijer/vim-numbertoggle'
|
||||
Plug 'rakr/vim-one'
|
||||
|
||||
" CUSTOM STUFF BEGINS HERE
|
||||
Plug 'Shougo/unite.vim'
|
||||
Plug 'rafaqz/citation.vim'
|
||||
|
||||
|
||||
call plug#end()
|
||||
endif
|
||||
|
||||
call unite#filters#matcher_default#use(['matcher_fuzzy'])
|
||||
let g:unite_source_grep_command = "rg"
|
||||
|
||||
" Custom mappings for the unite buffer
|
||||
autocmd FileType unite call s:unite_settings()
|
||||
function! s:unite_settings()
|
||||
" Enable navigation with control-j and control-k in insert mode
|
||||
imap <buffer> <C-j> <Plug>(unite_select_next_line)
|
||||
imap <buffer> <C-k> <Plug>(unite_select_previous_line)
|
||||
" control s to split into new buf
|
||||
imap <silent><buffer><expr> <C-s> unite#do_action('split')
|
||||
" simple esc to exit when in insert mode
|
||||
"imap <buffer> <esc> <Plug>(unite_exit)
|
||||
" also esc to exit in normal mode
|
||||
nmap <buffer> <esc> <Plug>(unite_exit)
|
||||
|
||||
nnoremap <silent><buffer><expr> <C-o> unite#do_action('start')
|
||||
imap <silent><buffer><expr> <C-o> unite#do_action('start')
|
||||
nnoremap <silent><buffer><expr> <C-i> unite#do_action('preview')
|
||||
imap <silent><buffer><expr> <C-i> unite#do_action('preview')
|
||||
endfunction
|
||||
|
||||
" citation.vim bibtex citations
|
||||
let g:citation_vim_bibtex_file="academia.bib"
|
||||
let g:citation_vim_mode="bibtex"
|
||||
let g:citation_vim_cache_path='~/.cache/'
|
||||
" insert a citation under cursor (using bibref)
|
||||
nnoremap <silent><leader>cc :<C-u>Unite -buffer-name=citation-start-insert -default-action=append -auto-resize -smartcase -start-insert citation/key<cr>
|
||||
" show info for citation that cursor is currently on
|
||||
nnoremap <silent><leader>ci :<C-u>Unite -input=<C-R><C-W> -default-action=preview -force-immediately citation/combined<cr>
|
||||
|
||||
" }}}
|
||||
colo one
|
|
@ -1,106 +0,0 @@
|
|||
" some things do not work perfectly yet
|
||||
" I have to take a look at the bindings
|
||||
" MOSTLY, it works
|
||||
" but startup takes ages (>1s)
|
||||
|
||||
" one more thing needs to be done for clever coc linting/fixing:
|
||||
" create a file called coc-settings.json in nvim config dir with the
|
||||
" following content:
|
||||
"
|
||||
"{
|
||||
" // Require .prettierrc
|
||||
" "prettier.requireConfig": true,
|
||||
" // Tslint on save
|
||||
" "tslint.enable": true,
|
||||
" "tslint.autoFixOnSave": true,
|
||||
" // Run prettier (and others)
|
||||
" "coc.preferences.formatOnSaveFiletypes": [
|
||||
" "css",
|
||||
" "markdown",
|
||||
" "Markdown",
|
||||
" "javascript",
|
||||
" "javascriptreact",
|
||||
" "typescript",
|
||||
" "typescriptreact"
|
||||
" ]
|
||||
"}
|
||||
|
||||
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}, 'on': [], 'for': []}
|
||||
Plug 'neoclide/coc-snippets', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-prettier', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-eslint', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-tslint', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-html', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-css', {'do': 'yarn install --frozen-lockfile'}
|
||||
" Plug 'neoclide/coc-highlight', {'do': 'yarn install --frozen-lockfile'} " color highlighting
|
||||
Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-yaml', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-rls', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-git', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'fannheyward/coc-rust-analyzer', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'fannheyward/coc-markdownlint', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'fannheyward/coc-texlab', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'iamcco/coc-vimlsp', {'do': 'yarn install --frozen-lockfile'}
|
||||
|
||||
" lazy loading since they require a lot of startup time
|
||||
augroup load_ide_features
|
||||
autocmd!
|
||||
autocmd InsertEnter * call plug#load('coc.nvim')
|
||||
\| autocmd! load_ide_features
|
||||
augroup end
|
||||
|
||||
" https://github.com/neoclide/coc.nvim#example-vim-configuration
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" gd - go to definition of word under cursor
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
|
||||
" gi - go to implementation
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
|
||||
" gr - find references
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" gh - get hint on whatever's under the cursor
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
nnoremap <silent> gh :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if &filetype == 'vim'
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" " Highlight symbol under cursor on CursorHold
|
||||
" autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
nnoremap <silent> <leader>co :<C-u>CocList outline<cr>
|
||||
nnoremap <silent> <leader>cs :<C-u>CocList -I symbols<cr>
|
||||
|
||||
" List errors
|
||||
nnoremap <silent> <leader>cl :<C-u>CocList locationlist<cr>
|
||||
|
||||
" list commands available in tsserver (and others)
|
||||
nnoremap <silent> <leader>cc :<C-u>CocList commands<cr>
|
||||
|
||||
" restart when tsserver gets wonky
|
||||
nnoremap <silent> <leader>cR :<C-u>CocRestart<CR>
|
||||
|
||||
" view all errors
|
||||
nnoremap <silent> <leader>cl :<C-u>CocList locationlist<CR>
|
||||
|
||||
" manage extensions
|
||||
nnoremap <silent> <leader>cx :<C-u>CocList extensions<cr>
|
||||
|
||||
" rename the current word in the cursor
|
||||
nmap <leader>cr <Plug>(coc-rename)
|
||||
nmap <leader>cf <Plug>(coc-format-selected)
|
||||
vmap <leader>cf <Plug>(coc-format-selected)
|
||||
|
||||
" run code actions
|
||||
vmap <leader>ca <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>ca <Plug>(coc-codeaction-selected)
|
Loading…
Reference in a new issue