Added new neovim config
parent
b5873bffae
commit
cef1d397f8
|
@ -1,11 +0,0 @@
|
||||||
# File manager history
|
|
||||||
.netrwhist
|
|
||||||
|
|
||||||
# Directory where my swap/undo files are stored
|
|
||||||
.vim/
|
|
||||||
|
|
||||||
# Where plugins are installed; can be done locally
|
|
||||||
plugged/
|
|
||||||
|
|
||||||
# Old file after updating plug.vim
|
|
||||||
plug.vim.old
|
|
|
@ -1,8 +0,0 @@
|
||||||
MIT License
|
|
||||||
Copyright (c) 2021 Jef Roosens
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
@ -1,40 +0,0 @@
|
||||||
# neovim-config
|
|
||||||
|
|
||||||
This repo contains the full Neovim config that I use on a daily basis for
|
|
||||||
college and personal projects. This file explains the basic structure of my
|
|
||||||
config, while setting-specific information can be found inside the config files
|
|
||||||
themselves.
|
|
||||||
|
|
||||||
## Config structure
|
|
||||||
The config exists of a few key components:
|
|
||||||
|
|
||||||
* `coc-settings.json`: config for the
|
|
||||||
[CoC](https://github.com/neoclide/coc.nvim) plugin.
|
|
||||||
* `init.vim`: this is the actual config file that gets loaded. It sources
|
|
||||||
everything else.
|
|
||||||
* `autoload/`: a special directory allowing the files inside to be used in the
|
|
||||||
`:call` command. Its only use is allowing usage of
|
|
||||||
[vim-plug](https://github.com/junegunn/vim-plug), my plugin manager.
|
|
||||||
* `colors/`: contains my themes.
|
|
||||||
* `ftplugin/`: this is where you can put filetype plugins. These are vim
|
|
||||||
scripts that are sourced whenever you open a buffer with the given filetype,
|
|
||||||
e.g. if you open a file with filetype `markdown`, it will source the file
|
|
||||||
`ftplugin/markdown.vim`, if it exists. This allows for custom configs for
|
|
||||||
certain filetypes.
|
|
||||||
* `init/`: contains the various config files sourced by `init.vim`. I could
|
|
||||||
just cram it all into a single file, but I find this difficult to maintain.
|
|
||||||
|
|
||||||
## Choice of leader
|
|
||||||
In my opinion, an important part of any (Neo)vim config is choosing which
|
|
||||||
leader key to use. The default `\` leader wasn't going to cut it for me for
|
|
||||||
three main reasons:
|
|
||||||
|
|
||||||
* Backslash required me to stretch my hand every time
|
|
||||||
* In Belgium (where I live), we use AZERTY instead of QWERTY, and the backslash
|
|
||||||
key is often not present on those keyboards or requires a key combination to
|
|
||||||
type
|
|
||||||
* I use both AZERTY and QWERTY and wanted a key that was the same on both
|
|
||||||
|
|
||||||
Therefore, I chose Space as my main leader key and Tab as my local leader (even
|
|
||||||
though I've never actually used it). This allows me to use the same muscle
|
|
||||||
memory on my refurbished MacBook (AZERTY) and my Ducky (QWERTY).
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
"languageserver": {
|
|
||||||
"haskell": {
|
|
||||||
"command": "haskell-language-server-wrapper",
|
|
||||||
"args": ["--lsp"],
|
|
||||||
"rootPatterns": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"],
|
|
||||||
"filetypes": ["haskell", "lhaskell"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
"languageserver": {
|
|
||||||
"ccls": {
|
|
||||||
"command": "ccls",
|
|
||||||
"filetypes": [
|
|
||||||
"c",
|
|
||||||
"cpp",
|
|
||||||
"objc",
|
|
||||||
"objcpp"
|
|
||||||
],
|
|
||||||
"rootPatterns": [
|
|
||||||
".ccls",
|
|
||||||
"compile_commands.json",
|
|
||||||
".vim/",
|
|
||||||
".git/",
|
|
||||||
".hg/"
|
|
||||||
],
|
|
||||||
"initializationOptions": {
|
|
||||||
"cache": {
|
|
||||||
"directory": "/tmp/ccls"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"haskell": {
|
|
||||||
"command": "haskell-language-server-wrapper",
|
|
||||||
"args": ["--lsp"],
|
|
||||||
"rootPatterns": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"],
|
|
||||||
"filetypes": ["haskell", "lhaskell"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
setlocal colorcolumn=80
|
|
||||||
setlocal textwidth=79
|
|
|
@ -1,2 +0,0 @@
|
||||||
setlocal colorcolumn=80
|
|
||||||
setlocal textwidth=79
|
|
|
@ -1,2 +0,0 @@
|
||||||
set textwidth=79
|
|
||||||
set colorcolumn=80
|
|
|
@ -1,10 +0,0 @@
|
||||||
" Show a visual line at width 120
|
|
||||||
setlocal colorcolumn=80
|
|
||||||
" This auto-wraps the lines after it's reached more than 119 characters.
|
|
||||||
setlocal textwidth=79
|
|
||||||
|
|
||||||
" Spellcheck
|
|
||||||
" Turn on spell check
|
|
||||||
setlocal spell
|
|
||||||
" Set it to English US
|
|
||||||
setlocal spelllang=en
|
|
|
@ -1,6 +0,0 @@
|
||||||
" Show a visual market at text width 80
|
|
||||||
setlocal colorcolumn=80
|
|
||||||
|
|
||||||
" Auto-wrap lines
|
|
||||||
setlocal textwidth=79
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
setlocal colorcolumn=80
|
|
||||||
setlocal textwidth=79
|
|
|
@ -1,2 +0,0 @@
|
||||||
setlocal textwidth=79
|
|
||||||
setlocal colorcolumn=80
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
require("utils")
|
||||||
|
require("settings")
|
||||||
|
require("keys")
|
||||||
|
require("plugins")
|
|
@ -1,25 +0,0 @@
|
||||||
" The leader key is the main modifier used for keybindings.
|
|
||||||
" You can use it inside keybindings by using <leader>
|
|
||||||
" I use space as my leader key
|
|
||||||
let g:mapleader = ' '
|
|
||||||
" Local leader is the same principle as leader, but it's used
|
|
||||||
" for keybindings that are local to the current buffer, to
|
|
||||||
" avoid confusion
|
|
||||||
" I use tab as my local leader
|
|
||||||
let g:maplocalleader = "\<tab>"
|
|
||||||
|
|
||||||
" Here, I source the various config files. I explicitely source them one by one
|
|
||||||
" to ensure their order is always the same (the autocmds are needed later, e.g.
|
|
||||||
" when the colorscheme is sourced)
|
|
||||||
runtime init/autocmds.vim
|
|
||||||
runtime init/keys.vim
|
|
||||||
runtime init/netrw.vim
|
|
||||||
runtime init/settings.vim
|
|
||||||
|
|
||||||
" The configs for the various plugins don't have a particular order to them
|
|
||||||
runtime! init/plugins/*.vim
|
|
||||||
|
|
||||||
" This sources a .vim/local.vim file in the current directory, if it exists.
|
|
||||||
" This allows for project-specific settings, such as on-write autocmd's etc.
|
|
||||||
" The silent! prevents it from showing an error if no local.vim file is found
|
|
||||||
silent! source .vim/local.vim
|
|
|
@ -1,12 +0,0 @@
|
||||||
function! OverwriteBackground()
|
|
||||||
" We only want a transparent background if we're using the dark theme
|
|
||||||
if g:colors_name == 'flattened_dark'
|
|
||||||
highlight Normal guibg=NONE ctermbg=NONE
|
|
||||||
highlight LineNr ctermfg=NONE ctermbg=NONE
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
augroup ColorschemeOverwrite
|
|
||||||
autocmd!
|
|
||||||
autocmd ColorScheme * call OverwriteBackground()
|
|
||||||
augroup END
|
|
|
@ -1,99 +0,0 @@
|
||||||
" zz centers the cursor, so combining this with navigation commands keeps my
|
|
||||||
" cursor centered
|
|
||||||
" nnoremap j jzz
|
|
||||||
" nnoremap k kzz
|
|
||||||
" nnoremap gg ggzz
|
|
||||||
" nnoremap G Gzz
|
|
||||||
|
|
||||||
" I navigate my splits using <leader>hjkl. This setup allows for fast
|
|
||||||
" switching, which is important as I often end up with 3-4 splits after a while
|
|
||||||
nnoremap <silent> <leader>h :wincmd h<CR>
|
|
||||||
nnoremap <silent> <leader>j :wincmd j<CR>
|
|
||||||
nnoremap <silent> <leader>k :wincmd k<CR>
|
|
||||||
nnoremap <silent> <leader>l :wincmd l<CR>
|
|
||||||
|
|
||||||
" These mappings just exist because I'm lazy, and they only really work in
|
|
||||||
" QWERTY
|
|
||||||
nnoremap <silent> <leader>w :w<CR>
|
|
||||||
nnoremap <silent> <leader>q :q<CR>
|
|
||||||
|
|
||||||
" As I don't use the arrow keys for navigation, I remapped them to allow for
|
|
||||||
" resizing of my splits. If you hold down shift, you can control the size of
|
|
||||||
" the splits more precisely
|
|
||||||
nnoremap <silent> <Up> :resize +5<CR>
|
|
||||||
nnoremap <silent> <Down> :resize -5<CR>
|
|
||||||
nnoremap <silent> <Right> :vertical resize +5<CR>
|
|
||||||
nnoremap <silent> <Left> :vertical resize -5<CR>
|
|
||||||
nnoremap <silent> <S-Up> :resize +1<CR>
|
|
||||||
nnoremap <silent> <S-Down> :resize -1<CR>
|
|
||||||
nnoremap <silent> <S-Right> :vertical resize +1<CR>
|
|
||||||
nnoremap <silent> <S-Left> :vertical resize -1<CR>
|
|
||||||
|
|
||||||
" Disable arrow keys in editing & visual mode, as I have no need for them
|
|
||||||
inoremap <Right> <nop>
|
|
||||||
inoremap <Left> <nop>
|
|
||||||
inoremap <Up> <nop>
|
|
||||||
inoremap <Down> <nop>
|
|
||||||
vnoremap <Right> <nop>
|
|
||||||
vnoremap <Left> <nop>
|
|
||||||
vnoremap <Up> <nop>
|
|
||||||
vnoremap <Down> <nop>
|
|
||||||
|
|
||||||
" Tabs bindings
|
|
||||||
" Create tab at the end of the list
|
|
||||||
nnoremap <silent> <leader>ee :$tabnew<CR>
|
|
||||||
" Create tab after current tab
|
|
||||||
nnoremap <silent> <leader>eL :tabnew<CR>
|
|
||||||
" Create tab before current one
|
|
||||||
nnoremap <silent> <leader>eH :-tabnew<CR>
|
|
||||||
" Close current tab
|
|
||||||
nnoremap <silent> <leader>ed :tabclose<CR>
|
|
||||||
" Go to next tab
|
|
||||||
nnoremap <silent> <leader>el :tabnext<CR>
|
|
||||||
" Go to previous tab
|
|
||||||
nnoremap <silent> <leader>eh :tabprevious<CR>
|
|
||||||
" Open new tab with terminal, and switch to insert mode
|
|
||||||
nnoremap <silent> <leader>er :tabnew<CR>:e term://$SHELL<CR>i
|
|
||||||
|
|
||||||
" This function allows me to switch between a dark & light theme. I mainly use
|
|
||||||
" the dark theme, but when I'm sitting outside, the light theme can be much
|
|
||||||
" more readable
|
|
||||||
function! ColorschemeToggle()
|
|
||||||
if g:colors_name == 'flattened_dark'
|
|
||||||
colorscheme flattened_light
|
|
||||||
else
|
|
||||||
colorscheme flattened_dark
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
nnoremap <silent> <leader>c :call ColorschemeToggle()<CR>
|
|
||||||
|
|
||||||
" As I'm constantly tweaking my config, I use keybindings to easily open &
|
|
||||||
" source it without leaving my session
|
|
||||||
nnoremap <silent> <leader>vs :source $MYVIMRC<CR>
|
|
||||||
" Opens CtrlP in my config directory
|
|
||||||
nnoremap <silent> <leader>ve :split<CR>:exec 'CtrlP ' . fnamemodify($MYVIMRC, ':h')<CR>
|
|
||||||
|
|
||||||
" This was probably one of the best ideas I found (it wasn't my original idea).
|
|
||||||
" By remapping Esc to jk, I could switch between modes without moving my hands.
|
|
||||||
" This improved my speed by much more than I was expecting, and helped with not
|
|
||||||
" straining my hands as much.
|
|
||||||
inoremap jk <Esc>
|
|
||||||
inoremap <Esc> <nop>
|
|
||||||
|
|
||||||
" I use this binding to quickly switch between two files.
|
|
||||||
nnoremap <leader>a <C-^>
|
|
||||||
|
|
||||||
" Terminal keybindings
|
|
||||||
" I use the terminal inside Neovim a lot, so I have some keybindings to easily
|
|
||||||
" open one
|
|
||||||
" Use jk in terminal as well
|
|
||||||
tnoremap <silent> jk <C-\><C-n>
|
|
||||||
|
|
||||||
" I explicitely use $SHELL, because my main shell is not necessarily Bash, and
|
|
||||||
" I want to use my main shell inside Vim as well
|
|
||||||
nnoremap <silent> <leader>rr :e term://$SHELL<CR>
|
|
||||||
nnoremap <silent> <leader>rh :vsp<CR>:wincmd h<CR>:e term://$SHELL<CR>
|
|
||||||
nnoremap <silent> <leader>rl :vsp<CR>:e term://$SHELL<CR>
|
|
||||||
nnoremap <silent> <leader>rk :sp<CR>:wincmd k<CR>:e term://$SHELL<CR>
|
|
||||||
nnoremap <silent> <leader>rj :sp<CR>:e term://$SHELL<CR>
|
|
|
@ -1,20 +0,0 @@
|
||||||
" Open in tree view by default
|
|
||||||
let g:netrw_liststyle = 3
|
|
||||||
|
|
||||||
" Hide banner at the top
|
|
||||||
let g:netrw_banner = 0
|
|
||||||
|
|
||||||
" Change how netrc opens files
|
|
||||||
" 1 - horizontal split
|
|
||||||
" 2 - vertical split
|
|
||||||
" 3 - new tab
|
|
||||||
" 4 - previous window
|
|
||||||
let g:netrw_browse_split = 4
|
|
||||||
|
|
||||||
" Width of the view
|
|
||||||
let g:netrw_winsize = 15
|
|
||||||
|
|
||||||
" Start netrc on startup
|
|
||||||
augroup netrc
|
|
||||||
autocmd!
|
|
||||||
augroup END
|
|
|
@ -1,46 +0,0 @@
|
||||||
# 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).
|
|
|
@ -1,47 +0,0 @@
|
||||||
" Default config
|
|
||||||
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>"
|
|
||||||
|
|
||||||
|
|
||||||
" Own config
|
|
||||||
" Project refactoring keybinding
|
|
||||||
nmap <silent> <leader>pwr :CocSearch <C-R>=expand("<cword>")<CR><CR>
|
|
||||||
" Go to definition
|
|
||||||
nmap gd <Plug>(coc-definition)
|
|
||||||
" Return from jump (e.g. go to definition)
|
|
||||||
nmap gb <C-o>
|
|
||||||
" Go to implementation
|
|
||||||
nmap gi <Plug>(coc-implementation)
|
|
||||||
" Show references of word
|
|
||||||
nmap gr <Plug>(coc-references)
|
|
||||||
" Refactor
|
|
||||||
nmap <leader>rf <Plug>(coc-refactor)
|
|
||||||
|
|
||||||
" 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)
|
|
||||||
|
|
||||||
" Code formatting
|
|
||||||
" vnoremap <silent>
|
|
||||||
|
|
||||||
" Show full diagnostics list
|
|
||||||
nmap <silent> <leader>dd :CocDiagnostics<CR>
|
|
|
@ -1,28 +0,0 @@
|
||||||
" 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
|
|
|
@ -1,16 +0,0 @@
|
||||||
" 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>
|
|
||||||
" Open diff tool
|
|
||||||
nnoremap <silent> <leader>gd :Gdiffsplit!<CR>
|
|
||||||
" Open merge tool
|
|
||||||
nnoremap <silent> <leader>gm :Git mergetool<CR>
|
|
||||||
" Easily resolve merges
|
|
||||||
" nnoremap <silent> <leader>gh :diffget //2<CR>
|
|
||||||
" nnoremap <silent> <leader>gl :diffget //3<CR>
|
|
||||||
" Git blame
|
|
||||||
nnoremap <silent> <leader>gb :Git blame<CR>
|
|
|
@ -1,2 +0,0 @@
|
||||||
" Disable key mappings
|
|
||||||
let g:gitgutter_map_keys = 0
|
|
|
@ -1,2 +0,0 @@
|
||||||
" Set name of tags file; should put it inside .vim directory
|
|
||||||
let g:gutentags_ctags_tagfile='.vim/tags'
|
|
|
@ -1,2 +0,0 @@
|
||||||
" Make each indent level have a specific character
|
|
||||||
let g:indentLine_char_list = ['|', '¦', '┆', '┊']
|
|
|
@ -1,47 +0,0 @@
|
||||||
" 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>
|
|
|
@ -1,70 +0,0 @@
|
||||||
" 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 'Chiel92/vim-autoformat'
|
|
||||||
|
|
||||||
Plug 'leafoftree/vim-vue-plugin'
|
|
||||||
|
|
||||||
Plug 'othree/javascript-libraries-syntax.vim'
|
|
||||||
|
|
||||||
Plug 'udalov/kotlin-vim'
|
|
||||||
|
|
||||||
Plug 'editorconfig/editorconfig-vim'
|
|
||||||
|
|
||||||
Plug 'maxmellon/vim-jsx-pretty'
|
|
||||||
|
|
||||||
call plug#end()
|
|
|
@ -1,25 +0,0 @@
|
||||||
" 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>
|
|
|
@ -1,63 +0,0 @@
|
||||||
" Terminal
|
|
||||||
" As I often use non-standard shells, certain things can break if this isn't
|
|
||||||
" explicitely set
|
|
||||||
" TODO maybe use which to find the executable?
|
|
||||||
set shell=/bin/bash
|
|
||||||
|
|
||||||
|
|
||||||
" Makes your cursor centered whenever possible. 999 is just a large number,
|
|
||||||
" making it always centered
|
|
||||||
set scrolloff=999
|
|
||||||
|
|
||||||
" Colorscheme
|
|
||||||
" This forces (Neo)Vim to assume the terminal supports 256 colors.
|
|
||||||
" Without this, some colorschemes (including mine) don't work properly.
|
|
||||||
set termguicolors
|
|
||||||
" Set colorscheme
|
|
||||||
colorscheme flattened_dark
|
|
||||||
hi Normal guibg=NONE ctermbg=NONE
|
|
||||||
hi LineNr ctermfg=NONE ctermbg=NONE
|
|
||||||
|
|
||||||
" Line numbers
|
|
||||||
" I use the combination of absolute and relative line numbers. On the
|
|
||||||
" current line, it shows the absolute; on all the others, the relative.
|
|
||||||
set number relativenumber
|
|
||||||
|
|
||||||
" Splits
|
|
||||||
" I prefer the logic of 'open your main window first, and all other
|
|
||||||
" afterwards', so this makes a new file open below or to the right of the
|
|
||||||
" current one.
|
|
||||||
set splitbelow splitright
|
|
||||||
|
|
||||||
" Indentation
|
|
||||||
" I only use four spaces as indentation. This configures Vim to always use four
|
|
||||||
" spaces, for both manual tabs and automatic indentation.
|
|
||||||
set expandtab tabstop=4 shiftwidth=4
|
|
||||||
|
|
||||||
" Search functionality
|
|
||||||
" Show matches as pattern is being typed
|
|
||||||
set incsearch
|
|
||||||
" Ignore case as long as there are no capital letters in the pattern
|
|
||||||
set smartcase
|
|
||||||
" Don't hightlight search results after search is finished
|
|
||||||
set nohlsearch
|
|
||||||
|
|
||||||
" autocmd BufReadPre * call SetDirs()
|
|
||||||
" Turn on swap files
|
|
||||||
set swapfile
|
|
||||||
set directory=./.vim/swap//
|
|
||||||
" Create file backups
|
|
||||||
" set backup
|
|
||||||
" Store backups in .vim directory, next to swap files
|
|
||||||
" set backupdir=./.vim/backup/,
|
|
||||||
" Temporary, until I've found a fix
|
|
||||||
set nobackup
|
|
||||||
" Create an undo file for each file; this makes undo persistent
|
|
||||||
set undofile
|
|
||||||
set undodir=./.vim/undo//
|
|
||||||
|
|
||||||
" Increases speed of CoC and Gitgutter
|
|
||||||
set updatetime=250
|
|
||||||
|
|
||||||
" Make Vim use pipes instead of temp files when running commands
|
|
||||||
set noshelltemp
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
imap("jk", "<Esc>")
|
||||||
|
imap("<Esc>", "<nop>")
|
||||||
|
|
||||||
|
-- Navigate splits
|
||||||
|
nmap("<leader>h", ":wincmd h<CR>")
|
||||||
|
nmap("<leader>j", ":wincmd j<CR>")
|
||||||
|
nmap("<leader>k", ":wincmd k<CR>")
|
||||||
|
nmap("<leader>l", ":wincmd l<CR>")
|
||||||
|
|
||||||
|
-- Just some laziness
|
||||||
|
nmap("<leader>w", ":w<CR>")
|
||||||
|
nmap("<leader>q", ":q<CR>")
|
||||||
|
|
||||||
|
-- As I don't use arrow keys for navigation, I use them for resizing
|
||||||
|
nmap("<Up>", ":resize +5<CR>")
|
||||||
|
nmap("<Down>", ":resize -5<CR>")
|
||||||
|
nmap("<Right>", ":vertical resize +5<CR>")
|
||||||
|
nmap("<Left>", ":vertical resize -5<CR>")
|
||||||
|
nmap("<S-Up>", ":resize +1<CR>")
|
||||||
|
nmap("<S-Down>", ":resize -1<CR>")
|
||||||
|
nmap("<S-Right>", ":vertical resize +1<CR>")
|
||||||
|
nmap("<S-Left>", ":vertical resize -1<CR>")
|
||||||
|
|
||||||
|
-- Disable arrow keys in editing & visual mode, as I have no need for them
|
||||||
|
imap("<Up>", "<nop>")
|
||||||
|
imap("<Down>", "<nop>")
|
||||||
|
imap("<Left>", "<nop>")
|
||||||
|
imap("<Right>", "<nop>")
|
||||||
|
vmap("<Up>", "<nop>")
|
||||||
|
vmap("<Down>", "<nop>")
|
||||||
|
vmap("<Left>", "<nop>")
|
||||||
|
vmap("<Right>", "<nop>")
|
||||||
|
|
||||||
|
-- These bindings I use for managing tabs
|
||||||
|
nmap("<leader>ee", ":$tabnew<CR>")
|
||||||
|
nmap("<leader>eL", ":tabnew<CR>")
|
||||||
|
nmap("<leader>eH", ":-tabnew<CR>")
|
||||||
|
nmap("<leader>ed", ":tabclose<CR>")
|
||||||
|
nmap("<leader>el", ":tabnext<CR>")
|
||||||
|
nmap("<leader>eh", ":tabprevious<CR>")
|
||||||
|
nmap("<leader>er", ":tabnew<CR>:e term://$SHELL<CR>i")
|
||||||
|
|
||||||
|
-- TODO add config editing keybinds
|
||||||
|
|
||||||
|
nmap("<leader>a", "<C-^>")
|
||||||
|
tmap("jk", "<C-\\><C-n>")
|
||||||
|
|
||||||
|
-- nmap("<leader>rr", ":e term://$SHELL<CR>")
|
||||||
|
-- nmap("<leader>rh", ":vsp<CR>:wincmd h<CR>:e term://$SHELL<CR>")
|
||||||
|
-- nmap("<leader>rl", ":vsp<CR>:e term://$SHELL<CR>")
|
||||||
|
-- nmap("<leader>rk", ":sp<CR>:wincmd k<CR>:e term://$SHELL<CR>")
|
||||||
|
-- nmap("<leader>rj", ":sp<CR>:e term://$SHELL<CR>")
|
||||||
|
|
||||||
|
nmap("<leader>fh", ":vsp<CR>:wincmd h<CR>")
|
||||||
|
nmap("<leader>fj", ":sp<CR>")
|
||||||
|
nmap("<leader>fk", ":sp<CR>:wincmd k<CR>")
|
||||||
|
nmap("<leader>fl", ":vsp<CR>")
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap("n", "gb", "<C-o>", {})
|
|
@ -0,0 +1,169 @@
|
||||||
|
require("impatient")
|
||||||
|
|
||||||
|
-- This part auto-installs Packer if it's not present
|
||||||
|
-- Largely inspired by https://github.com/wbthomason/packer.nvim#bootstrapping
|
||||||
|
local fn = vim.fn
|
||||||
|
local g = vim.g
|
||||||
|
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||||
|
|
||||||
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
|
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||||
|
vim.api.nvim_command('packadd packer.nvim')
|
||||||
|
end
|
||||||
|
|
||||||
|
require('packer').startup(function()
|
||||||
|
use "wbthomason/packer.nvim"
|
||||||
|
-- Improves boot times
|
||||||
|
-- use {"lewis6991/impatient.nvim", rocks = 'mpack'}
|
||||||
|
use "ctrlpvim/ctrlp.vim"
|
||||||
|
use "tpope/vim-fugitive"
|
||||||
|
use "tpope/vim-commentary"
|
||||||
|
use "tpope/vim-surround"
|
||||||
|
use "majutsushi/tagbar"
|
||||||
|
use "airblade/vim-gitgutter"
|
||||||
|
use "hynek/vim-python-pep8-indent"
|
||||||
|
use "michaeljsmith/vim-indent-object"
|
||||||
|
use "preservim/nerdtree"
|
||||||
|
use "cespare/vim-toml"
|
||||||
|
use "jiangmiao/auto-pairs"
|
||||||
|
use "godlygeek/tabular"
|
||||||
|
use "editorconfig/editorconfig-vim"
|
||||||
|
use "neovim/nvim-lspconfig"
|
||||||
|
-- use "hrsh7th/nvim-compe"
|
||||||
|
use "marko-cerovac/material.nvim"
|
||||||
|
use "nvim-lua/completion-nvim"
|
||||||
|
use "steelsojka/completion-buffers"
|
||||||
|
use {"nvim-treesitter/nvim-treesitter", run=":TSUpdate"}
|
||||||
|
use "akinsho/nvim-toggleterm.lua"
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
-- =====PLUGIN CONFIGS=====
|
||||||
|
-- ctrlpvim/ctrlp.vim
|
||||||
|
g.ctrlp_map = "<leader>t"
|
||||||
|
g.ctrlp_use_caching = 1
|
||||||
|
g.ctrlp_clear_cache_on_exit = 0
|
||||||
|
g.ctrlp_cache_dir = "./.vim/cache/ctrlp"
|
||||||
|
g.ctrlp_user_command = {
|
||||||
|
'.git', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'
|
||||||
|
}
|
||||||
|
|
||||||
|
--Limit max number of files
|
||||||
|
--This prevents me from indexing my entire HOME by accident
|
||||||
|
g.ctrlp_max_files = 10000
|
||||||
|
--Also limit recursion depth
|
||||||
|
g.ctrlp_max_depth = 40
|
||||||
|
|
||||||
|
-- tpope/vim-fugitive
|
||||||
|
nmap("<leader>gg", ":Git<CR>")
|
||||||
|
nmap("<leader>gc", ":Git commit<CR>")
|
||||||
|
nmap("<leader>gp", ":Git push<CR>")
|
||||||
|
nmap("<leader>gd", ":Gdiffsplit!<CR>")
|
||||||
|
nmap("<leader>gm", ":Git mergetool<CR>")
|
||||||
|
nmap("<leader>gb", ":Git blame<CR>")
|
||||||
|
|
||||||
|
-- airblade/vim-gitgutter
|
||||||
|
g.gitgutter_map_keys = 0
|
||||||
|
|
||||||
|
-- indentline
|
||||||
|
g.indentLine_char_list = {'|', '¦', '┆', '┊'}
|
||||||
|
|
||||||
|
-- preservim/nerdtree
|
||||||
|
g.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]]'
|
||||||
|
}
|
||||||
|
|
||||||
|
g.NERDTreeShowHidden = 1
|
||||||
|
g.NERDTreeMinimalUI = 1
|
||||||
|
g.NERDTreeDirArrows = 1
|
||||||
|
g.NERDTreeQuitOnOpen = 1
|
||||||
|
g.NERDTreeChDirMode = 0
|
||||||
|
g.NERDTreeNaturalSort = 1
|
||||||
|
g.NERDTreeShowFiles = 1
|
||||||
|
g.NERDTreeShowLineNumbers = 0
|
||||||
|
g.NERDTreeWinPos = 'left'
|
||||||
|
g.NERDTreeMinimalMenu = 1
|
||||||
|
g.NERDTreeAutoDeleteBuffer = 1
|
||||||
|
|
||||||
|
nmap("tt", ":NERDTreeFind<CR>")
|
||||||
|
|
||||||
|
-- majutsushi/tagbar
|
||||||
|
g.tagbar_map_nexttag = "J"
|
||||||
|
g.tagbar_map_prevtag = "K"
|
||||||
|
g.tagbar_map_showproto = "u"
|
||||||
|
g.tagbar_sort = 0
|
||||||
|
g.tagbar_compact = 1
|
||||||
|
g.tagbar_autoshowtag = 1
|
||||||
|
g.no_status_line = 1
|
||||||
|
g.tagbar_autoclose = 1
|
||||||
|
|
||||||
|
nmap("tr", ":TagbarToggle<CR>")
|
||||||
|
|
||||||
|
-- neovim/neovim-lspconfig
|
||||||
|
-- Comes with clang
|
||||||
|
require'lspconfig'.clangd.setup{}
|
||||||
|
-- NPM: dockerfile-language-server-nodejs
|
||||||
|
require'lspconfig'.dockerls.setup{}
|
||||||
|
-- Pacman: haskell-language-server
|
||||||
|
-- AUR: haskell-language-server-bin
|
||||||
|
-- GH: https://github.com/haskell/haskell-language-server
|
||||||
|
require'lspconfig'.hls.setup{}
|
||||||
|
-- Pacman: rust-analyzer
|
||||||
|
-- GH: https://github.com/rust-analyzer/rust-analyzer
|
||||||
|
require'lspconfig'.rust_analyzer.setup{}
|
||||||
|
|
||||||
|
-- material
|
||||||
|
require('material').set()
|
||||||
|
nmap("<leader>c", [[<Cmd>lua require('material.functions').toggle_style()<CR>]])
|
||||||
|
|
||||||
|
-- nvim-lua/completion-nvim
|
||||||
|
vim.api.nvim_exec("autocmd BufEnter * lua require'completion'.on_attach()", false)
|
||||||
|
--Use <Tab> and <S-Tab> to navigate through popup menu
|
||||||
|
vim.api.nvim_set_keymap("i", "<Tab>", 'pumvisible() ? "\\<C-n>" : "\\<Tab>"', {
|
||||||
|
expr = true
|
||||||
|
})
|
||||||
|
vim.api.nvim_set_keymap("i", "<S-Tab>", 'pumvisible() ? "\\<C-p>" : "\\<S-Tab>"', {
|
||||||
|
expr = true
|
||||||
|
})
|
||||||
|
|
||||||
|
--Set completeopt to have a better completion experience
|
||||||
|
vim.o.completeopt = "menuone,noinsert,noselect"
|
||||||
|
|
||||||
|
--Avoid showing message extra message when using completion
|
||||||
|
vim.o.shortmess = vim.o.shortmess .. "c"
|
||||||
|
|
||||||
|
vim.g.completion_chain_complete_list = {
|
||||||
|
default = {
|
||||||
|
{ complete_items = { 'lsp', "buffer", "buffers" } },
|
||||||
|
{ mode = { '<c-p>' } },
|
||||||
|
{ mode = { '<c-n>' } }
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require"nvim-treesitter.configs".setup {
|
||||||
|
highlight = { enable = true }
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.o.hidden = true
|
||||||
|
require("toggleterm").setup {
|
||||||
|
-- open_mapping = "<leader>r",
|
||||||
|
direction = "float",
|
||||||
|
insert_mappings = false,
|
||||||
|
start_in_insert = false
|
||||||
|
}
|
||||||
|
|
||||||
|
nmap("<leader>rr", ":ToggleTerm<CR>")
|
||||||
|
nmap("<leader>ry", ":1ToggleTerm<CR>")
|
||||||
|
nmap("<leader>ru", ":2ToggleTerm<CR>")
|
||||||
|
nmap("<leader>ri", ":3ToggleTerm<CR>")
|
||||||
|
nmap("<leader>ro", ":4ToggleTerm<CR>")
|
||||||
|
nmap("<leader>rp", ":5ToggleTerm<CR>")
|
|
@ -0,0 +1,54 @@
|
||||||
|
local o = vim.o
|
||||||
|
local g = vim.g
|
||||||
|
|
||||||
|
g.mapleader = " "
|
||||||
|
g.maplocalleader = "\\<tab>"
|
||||||
|
|
||||||
|
-- I often use non-standard shells that don't play nicely wiht certain features
|
||||||
|
o.shell = "/bin/bash"
|
||||||
|
|
||||||
|
-- Centers your cursor whenever possible
|
||||||
|
-- 999 is just a really large number (I think it's amount of lines or something)
|
||||||
|
o.scrolloff = 999
|
||||||
|
|
||||||
|
-- Forces Neovim to assume a 256-color terminal; required for certain colorschemes
|
||||||
|
o.termguicolors = true
|
||||||
|
|
||||||
|
-- Set the colorscheme
|
||||||
|
-- g.colors_name = "flattened_dark"
|
||||||
|
|
||||||
|
-- This combo shows the absolute line number on the current line & the relative one on all the others
|
||||||
|
o.number = true
|
||||||
|
o.relativenumber = true
|
||||||
|
|
||||||
|
-- Opens new files to the bottom, right resp. of the current buffer
|
||||||
|
o.splitbelow = true
|
||||||
|
o.splitright = true
|
||||||
|
|
||||||
|
-- Converts tabs to 4 spaces
|
||||||
|
o.expandtab = true
|
||||||
|
o.tabstop = 4
|
||||||
|
o.shiftwidth = 4
|
||||||
|
|
||||||
|
-- Show search matches as I'm typing
|
||||||
|
o.incsearch = true
|
||||||
|
-- Makes search case-sensitive only when using caps
|
||||||
|
o.smartcase = true
|
||||||
|
-- Don't highlight search results after search is finished
|
||||||
|
o.hlsearch = false
|
||||||
|
|
||||||
|
-- Create swap files
|
||||||
|
o.swapfile = true
|
||||||
|
-- Where to store the swap files; I store mine in the current directory
|
||||||
|
o.directory = "./.vim/swap//"
|
||||||
|
|
||||||
|
o.backup = false
|
||||||
|
|
||||||
|
o.undofile = true
|
||||||
|
o.undodir = "./.vim/undo//"
|
||||||
|
|
||||||
|
o.updatetime = 250
|
||||||
|
|
||||||
|
o.shelltemp = false
|
||||||
|
|
||||||
|
-- o.completeopt = "menuone,noselect"
|
|
@ -0,0 +1,11 @@
|
||||||
|
function map(mode, keys, command)
|
||||||
|
vim.api.nvim_set_keymap(mode, keys, command, {
|
||||||
|
silent = true,
|
||||||
|
noremap = true
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
nmap = function(keys, command) map("n", keys, command) end
|
||||||
|
imap = function(keys, command) map("i", keys, command) end
|
||||||
|
vmap = function(keys, command) map("v", keys, command) end
|
||||||
|
tmap = function(keys, command) map("t", keys, command) end
|
|
@ -0,0 +1,165 @@
|
||||||
|
-- Automatically generated packer.nvim plugin loader code
|
||||||
|
|
||||||
|
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||||
|
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_command('packadd packer.nvim')
|
||||||
|
|
||||||
|
local no_errors, error_msg = pcall(function()
|
||||||
|
|
||||||
|
local time
|
||||||
|
local profile_info
|
||||||
|
local should_profile = false
|
||||||
|
if should_profile then
|
||||||
|
local hrtime = vim.loop.hrtime
|
||||||
|
profile_info = {}
|
||||||
|
time = function(chunk, start)
|
||||||
|
if start then
|
||||||
|
profile_info[chunk] = hrtime()
|
||||||
|
else
|
||||||
|
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
time = function(chunk, start) end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function save_profiles(threshold)
|
||||||
|
local sorted_times = {}
|
||||||
|
for chunk_name, time_taken in pairs(profile_info) do
|
||||||
|
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||||
|
end
|
||||||
|
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||||
|
local results = {}
|
||||||
|
for i, elem in ipairs(sorted_times) do
|
||||||
|
if not threshold or threshold and elem[2] > threshold then
|
||||||
|
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
_G._packer = _G._packer or {}
|
||||||
|
_G._packer.profile_output = results
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], true)
|
||||||
|
local package_path_str = "/home/jjr/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?.lua;/home/jjr/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?/init.lua;/home/jjr/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?.lua;/home/jjr/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
|
local install_cpath_pattern = "/home/jjr/.cache/nvim/packer_hererocks/2.0.5/lib/lua/5.1/?.so"
|
||||||
|
if not string.find(package.path, package_path_str, 1, true) then
|
||||||
|
package.path = package.path .. ';' .. package_path_str
|
||||||
|
end
|
||||||
|
|
||||||
|
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||||
|
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], false)
|
||||||
|
time([[try_loadstring definition]], true)
|
||||||
|
local function try_loadstring(s, component, name)
|
||||||
|
local success, result = pcall(loadstring(s))
|
||||||
|
if not success then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[try_loadstring definition]], false)
|
||||||
|
time([[Defining packer_plugins]], true)
|
||||||
|
_G.packer_plugins = {
|
||||||
|
["auto-pairs"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/auto-pairs"
|
||||||
|
},
|
||||||
|
["completion-buffers"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/completion-buffers"
|
||||||
|
},
|
||||||
|
["completion-nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/completion-nvim"
|
||||||
|
},
|
||||||
|
["ctrlp.vim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/ctrlp.vim"
|
||||||
|
},
|
||||||
|
["editorconfig-vim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/editorconfig-vim"
|
||||||
|
},
|
||||||
|
["impatient.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/impatient.nvim"
|
||||||
|
},
|
||||||
|
["material.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/material.nvim"
|
||||||
|
},
|
||||||
|
nerdtree = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/nerdtree"
|
||||||
|
},
|
||||||
|
["nvim-lspconfig"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
["nvim-toggleterm.lua"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/nvim-toggleterm.lua"
|
||||||
|
},
|
||||||
|
["nvim-treesitter"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/nvim-treesitter"
|
||||||
|
},
|
||||||
|
["packer.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/packer.nvim"
|
||||||
|
},
|
||||||
|
tabular = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/tabular"
|
||||||
|
},
|
||||||
|
tagbar = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/tagbar"
|
||||||
|
},
|
||||||
|
["vim-commentary"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/vim-commentary"
|
||||||
|
},
|
||||||
|
["vim-fugitive"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/vim-fugitive"
|
||||||
|
},
|
||||||
|
["vim-gitgutter"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/vim-gitgutter"
|
||||||
|
},
|
||||||
|
["vim-indent-object"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/vim-indent-object"
|
||||||
|
},
|
||||||
|
["vim-python-pep8-indent"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/vim-python-pep8-indent"
|
||||||
|
},
|
||||||
|
["vim-surround"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/vim-surround"
|
||||||
|
},
|
||||||
|
["vim-toml"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/jjr/.local/share/nvim/site/pack/packer/start/vim-toml"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time([[Defining packer_plugins]], false)
|
||||||
|
if should_profile then save_profiles() end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not no_errors then
|
||||||
|
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
exec docker run \
|
||||||
|
--rm \
|
||||||
|
-it \
|
||||||
|
--name neovim-config \
|
||||||
|
-v "$PWD":/root/.config/nvim \
|
||||||
|
archlinux:latest
|
Loading…
Reference in New Issue