Added cenny dotfiles

This commit is contained in:
Jef Roosens 2021-04-21 14:52:27 +02:00
parent 20ab00736c
commit 885ecb33d0
Signed by: Jef Roosens
GPG key ID: B580B976584B5F30
57 changed files with 7714 additions and 0 deletions

View file

@ -0,0 +1,46 @@
# Plugins
I use quite a lot of plugins, as they greatly improve my workflow or just add
features that you most definitely need if you want to use Vim as your main
editor.
## List of plugins
* [CoC](https://github.com/neoclide/coc.nvim): my autocomplete plugin of
choice. It provide full LSP support, so many of its plugins use the exact
same setup as a VSCode plugin.
* [CtrlP](https://github.com/ctrlpvim/ctrlp.vim): a fuzzy search tool which I
use for most navigation.
* [vim-fugitive](https://github.com/tpope/vim-fugitive): an amazing Git client
for Vim. It has support for all the usual stuff (commits, adding/removing
files etc.), as well as a merge conflict resolver using Vim's built-in diff
view.
* [vim-surround](https://github.com/tpope/vim-surround): adds mappings to
change/remove surrounding characters (e.g. (), "", '' etc.). It integrates
really well with already existing bindings, making it feel like it's a
built-in feature.
* [vim-commentary](https://github.com/tpope/vim-commentary): adds mappings for
commenting/uncommenting lines easily. It has support for basically all
languages I ever use.
* [tagbar](https://github.com/preservim/tagbar): a sidebar chowing you the
layout of the current file. It helps me orient myself within the file/class
I'm currently working on, as well as easing the movement between
classes, functions etc...
* [vim-gitgutter](https://github.com/airblade/vim-gitgutter): shows Git
diff markers in the sidebar.
* [indentline](https://github.com/Yggdroot/indentLine): shows a visual line to
indicate which lines are on the same indentation level.
* vim-python-pep8-indent: makes Vim properly indent Python according to PEP8
* [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object):
allows you to select the current indentation block using the same bindings as
paragraphs, inner brackets, etc...
* NERDTree: file browser, useful for getting your bearings in a large project.
* [vim-toml](https://github.com/cespare/vim-toml): syntax highlighting for toml
files
* [auto-pairs](https://github.com/jiangmiao/auto-pairs): auto-insert matching
pairs
* [Tabular](https://github.com/godlygeek/tabular): useful plugin for aligning
text
* [haskell-vim](https://github.com/neovimhaskell/haskell-vim): indentation for
Haskell
* [ion-vim](https://github.com/vmchale/ion-vim): syntax highlighting for the
[ion shell](https://github.com/redox-os/ion) (my current shell).

View file

@ -0,0 +1,38 @@
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
" Navigating through results list
" Tab to select next result
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
" Shift+Tab to select previous
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Use enter to confirm completion
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Select first option if no option is selected on enter
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>"
" Project refactoring keybinding
nnoremap <silent> <leader>pwr :CocSearch <C-R>=expand("<cword>")<CR><CR>
" Go to definition
nmap gd <Plug>(coc-definition)
nmap gb <C-o>
nmap gi <Plug>(coc-implementation)
nmap gr <Plug>(coc-references)
" Jump between diagnostic positions
nmap <silent> <leader>dk <Plug>(coc-diagnostic-prev)
nmap <silent> <leader>dK <Plug>(coc-diagnostic-prev-error)
nmap <silent> <leader>dj <Plug>(coc-diagnostic-next)
nmap <silent> <leader>dJ <Plug>(coc-diagnostic-next-error)
" Show full diagnostics list
nmap <silent> <leader>dd :CocDiagnostics<CR>

View file

@ -0,0 +1,28 @@
" Remap CtrlP shortcut
let g:ctrlp_map = '<leader>t'
" Enable caching
" I think this'll make it run just a bit faster
let g:ctrlp_use_caching = 1
" Don't clear the cache on exit, so it won't re-index every time we open the
" project
let g:ctrlp_clear_cache_on_exit = 0
" Cache inside the project's .vim directory to keep things tidy
let g:ctrlp_cache_dir = './.vim/cache/ctrlp'
" You can define different listing commands for different version controls
" systems etc.
" I currently only have experience with Git, but I've written the config like
" this to allow for easy expansion if needed.
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
\ },
\ 'fallback': 'find %s -type f'
\ }
" Limit max number of files
" This prevents me from indexing my entire HOME by accident
let g:ctrlp_max_files = 10000
" Also limit recursion depth
let g:ctrlp_max_depth = 40

View file

@ -0,0 +1,12 @@
" Key bindings for quicker Git work
" Status
nnoremap <silent> <leader>gg :Git<CR>
" Commit
nnoremap <silent> <leader>gc :Git commit<CR>
" Push
nnoremap <silent> <leader>gp :Git push<CR>
" Show diffs
nnoremap <silent> <leader>gd :Gvdiffsplit!<CR>
" Easily resolve merges
nnoremap <silent> <leader>gh :diffget //2<CR>
nnoremap <silent> <leader>gl :diffget //3<CR>

View file

@ -0,0 +1,2 @@
" Disable key mappings
let g:gitgutter_map_keys = 0

View file

@ -0,0 +1,2 @@
" Set name of tags file; should put it inside .vim directory
let g:gutentags_ctags_tagfile='.vim/tags'

View file

@ -0,0 +1,2 @@
" Make each indent level have a specific character
let g:indentLine_char_list = ['|', '¦', '┆', '┊']

View file

@ -0,0 +1,47 @@
" Listing of paths to ignore. I think I could use something similar to CtrlP
" here as well, but I want NERDTree to also show some non-version
" controlled files. It ignores the following files:
" Vim
" Other IDEs
" Python
" Java
" Git
" Stack & Haskell
" CMake
" Non-text files
let NERDTreeIgnore = [
\ '^\.vim$[[dir]]',
\ '^\.vscode$[[dir]]', '.*\.code-workspace$[[file]]', '^\.idea$[[dir]]',
\ '^__pycache__$[[dir]]', '^\.pytest_cache$[[dir]]', '^venv$[[dir]]',
\ '\.egg-info$[[dir]]', '^dist$[[dir]]', '^build$[[dir]]',
\ '^\.eggs$[[dir]]',
\ '^out$[[dir]]',
\ '^\.git$[[dir]]',
\ '^\.stack-work$[[dir]]', '\.lock$',
\ '^CMakeFiles$[[dir]]', '^CMakeCache.txt$[[file]]',
\ '.pdf$[[file]]']
" Show files starting with .
let NERDTreeShowHidden = 1
" Hide 'Press ? for help'
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
" Close NERDTree after opening a file
let NERDTreeQuitOnOpen = 1
" Explicitely tell NERDTree to never change my current working directory
let NERDTreeChDirMode = 0
" Sort naturally, e.g. z10.txt comes after z1.txt
let NERDTreeNaturalSort = 1
" Show files, not only directories
let NERDTreeShowFiles = 1
" Don't show line numbers
let NERDTreeShowLineNumbers = 0
" Show NERDTree on the left side
let NERDTreeWinPos = 'left'
" Use the minimal menu system
let NERDTreeMinimalMenu = 1
" Always delete the buffer when you rename the file
let NERDTreeAutoDeleteBuffer = 1
" Open NERDTree on the current file
nnoremap <silent> tt :NERDTreeFind<CR>

View file

@ -0,0 +1,68 @@
" See README.md for more information about the plugins
"
" Load the plugins
call plug#begin('~/.config/nvim/plugged')
" Powerful auto-complete engine
" TODO switch to coc-jedi for Python stuff
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Fast file navigation using fuzzy search
Plug 'ctrlpvim/ctrlp.vim'
" Git client within Vim
Plug 'tpope/vim-fugitive'
" Change surrounding quotes, brackets...
Plug 'tpope/vim-surround'
" Comment out lines easily
Plug 'tpope/vim-commentary'
" Show ctags in sidebar, useful for navigation
Plug 'majutsushi/tagbar'
" Show Git diffs in sidebar
Plug 'airblade/vim-gitgutter'
" Show indentation using thin lines
Plug 'yggdroot/indentline'
" Auto-indent according to PEP8 rules
Plug 'hynek/vim-python-pep8-indent'
" Text object based on current indent level (e.g. Python)
Plug 'michaeljsmith/vim-indent-object'
" Sidebar showing file structure
Plug 'scrooloose/nerdtree'
" Toml syntax highlighting
Plug 'cespare/vim-toml'
" Auto-bracket pairs
Plug 'jiangmiao/auto-pairs'
" This plugin allows you to align text according to specified delimiters
" e.g. this:
" x = 5
" alongname = 15
" can become this:
" x = 15
" alongname = 15
Plug 'godlygeek/tabular'
" Some auto-complete for haskell
Plug 'neovimhaskell/haskell-vim'
Plug 'vmchale/ion-vim'
Plug 'Chiel92/vim-autoformat'
Plug 'leafoftree/vim-vue-plugin'
Plug 'othree/javascript-libraries-syntax.vim'
Plug 'udalov/kotlin-vim'
call plug#end()

View file

@ -0,0 +1,25 @@
" Navigating between tags
" Go to next top-level tag
let g:tagbar_map_nexttag = 'J'
" Same, but previous
let g:tagbar_map_prevtag = 'K'
" Show prototype of current tag
let g:tagbar_map_showproto = 'u'
" Use order from source file
let g:tagbar_sort = 0
" Don't show help tip at the top
let g:tagbar_compact = 1
" Auto-open folds while following cursor
let g:tagbar_autoshowtag = 1
" Don't show status line
let g:no_status_line = 1
" Close tagbar when a tag is selected
let g:tagbar_autoclose = 1
" Open tagbar when opening certain language types
" autocmd BufNewFile,BufReadPre *.py,*.java,*.rs,*.cpp,*.c,*.r TagbarOpen
" Explicitly close tagbar for these types
" autocmd BufNewFile,BufReadPre *.txt,*.rst TagbarClose
nnoremap <silent> tr :TagbarToggle<CR>