spacemacs, stow

This commit is contained in:
Andrejus
2021-04-26 23:25:43 +01:00
parent 75c7cd09db
commit 31f3fe9064
25 changed files with 632 additions and 56 deletions

View File

@@ -0,0 +1,111 @@
" ============================================================================ "
" === EDITING OPTIONS === "
" ============================================================================ "
"
" Leader key <SPACE>
let g:mapleader=' '
" Use posix-compliant shell
set shell=sh
" Enable syntax highlighting
syntax enable
filetype on
filetype plugin on
" Hides buffers instead of closing them
set hidden
" do not wrap long lines by default
set nowrap
" default encoding
set encoding=utf-8
set fileencoding=utf-8
set fileformat=unix
" Yank and paste with the system clipboard
set clipboard=unnamedplus
" et = expandtab (spaces instead of tabs)
" ts = tabstop (the number of spaces that a tab equates to)
" sw = shiftwidth (the number of spaces to use when indenting
" -- or de-indenting -- a line)
" sts = softtabstop (the number of spaces to use when expanding tabs)
set et sts=4 sw=4 ts=4
set showtabline=4
set foldenable
set foldmethod=indent
set foldlevel=99
set conceallevel=0
set scrolloff=10
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=100
set timeoutlen=300
" Don't pass messages to |ins-completion-menu|.
set shortmess=atT
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
else
set signcolumn=yes
endif
" coc.nvim recommendations
set nobackup
set nowritebackup
" ============================================================================ "
" === UI === "
" ============================================================================ "
" Support italics
hi Comment cterm=italic
" Enable true color support
if (has("termguicolors"))
set termguicolors
hi LineNr ctermbg=NONE guibg=NONE
endif
" Set preview window to appear at bottom and right
set splitbelow
set splitright
" Don't dispay mode in command line (airilne already shows it)
set noshowmode
" Set floating window to be slightly transparent
set winbl=10
" Enable ruler
set ruler
set number
set relativenumber
" Pop-up menu
set pumheight=10
" two lines for command line
set cmdheight=2
" no visual bell
set visualbell t_vb=
" if the search string has an upper case letter in it, the search will be case sensitive
set smartcase
" Redraw on resize
autocmd VimResized * redraw!
" Redraw on writing buffer
autocmd BufWritePost * redraw!

View File

@@ -0,0 +1,104 @@
{
"coc.preferences.extensionUpdateCheck": "daily",
"list.source.files.args": ["--hidden", "--files"],
"suggest.echodocSupport": true,
"python.pythonPath": "python3",
"python.jediEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.pylintEnabled": false,
"languageserver": {
"terraform": {
"command": "terraform-ls",
"args": ["serve"],
"filetypes": ["tf", "terraform"],
"initializationOptions": {},
"settings": {}
},
"elmLS": {
"command": "elm-language-server",
"filetypes": ["elm"],
"rootPatterns": ["elm.json"],
"initializationOptions": {
"elmPath": "elm",
"elmFormatPath": "elm-format",
"elmTestPath": "elm-test",
"elmAnalyseTrigger": "change"
}
}
},
"explorer.width": 30,
"explorer.file.root.template": "[icon] [git] [hidden & 1][root]",
"explorer.icon.enableNerdfont": true,
"explorer.previewAction.onHover": false,
"explorer.icon.enableVimDevicons": false,
"explorer.file.showHiddenFiles": true,
"explorer.file.autoReveal": true,
"explorer.keyMappings.global": {
"i": false,
"gk": "expandablePrev",
"gj": "expandableNext",
"*": "toggleSelection",
"<tab>": "actionMenu",
"h": "collapse",
"l": ["expandable?", "expand", "open"],
"J": ["toggleSelection", "nodeNext"],
"K": ["toggleSelection", "nodePrev"],
"gl": "expandRecursive",
"gh": "collapseRecursive",
"o": ["expanded?", "collapse", "expand"],
"<cr>": ["expandable?", "cd", "open"],
"e": "open",
"s": "open:split",
"v": "open:vsplit",
"t": "open:tab",
"<bs>": "gotoParent",
"gp": "preview:labeling",
"y": "copyFilepath",
"Y": "copyFilename",
"c": "copyFile",
"x": "cutFile",
"p": "pasteFile",
"d": "delete",
"D": "deleteForever",
"a": "addFile",
"A": "addDirectory",
"r": "rename",
".": "toggleHidden",
"R": "refresh",
"?": "help",
"q": "quit",
"<esc>": "esc",
"X": "systemExecute",
"gd": "listDrive",
"f": "search",
"F": "searchRecursive",
"gf": "gotoSource:file",
"gb": "gotoSource:buffer",
"[[": "sourcePrev",
"]]": "sourceNext",
"[d": "diagnosticPrev",
"]d": "diagnosticNext",
"[c": "gitPrev",
"]c": "gitNext",
"<<": "gitStage",
">>": "gitUnstage"
}
}

View File

@@ -0,0 +1,6 @@
runtime base.vim
runtime plugins.vim
runtime plugins-config.vim
runtime mappings.vim

View File

@@ -0,0 +1,155 @@
" Disable arrow keys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
" Disable manual and ex mode
nnoremap <F1> <nop>
nnoremap Q <nop>
" Quick escape
inoremap jk <Esc>
inoremap kj <Esc>
" Quick save
nnoremap <C-s> :w<CR>
" Better tabbing
" When indenting, reselect previous selection
" if in visual mode
vnoremap < <gv
vnoremap > >gv
" Quick window switching
" Ctrl-[hjkl]
nnoremap <silent> <C-h> <C-w>h
nnoremap <silent> <C-j> <C-w>j
nnoremap <silent> <C-k> <C-w>k
nnoremap <silent> <C-l> <C-w>l
" Quick window resizing
" Alt-[hjkl]
nnoremap <silent> <M-j> :resize -2<CR>
nnoremap <silent> <M-k> :resize +2<CR>
nnoremap <silent> <M-h> :vertical resize -2<CR>
nnoremap <silent> <M-l> :vertical resize +2<CR>
" Quicker omni complete nav
" Ctrl-[jk]
inoremap <expr> <c-j> ("\<C-n>")
inoremap <expr> <c-k> ("\<C-p>")
" Distraction free typing
" <l>l - Toggle Goyo and Limelight
nnoremap <silent> <leader>l :Goyo<cr>
autocmd! User GoyoEnter Limelight
autocmd! User GoyoLeave Limelight!
" Strip whitespace
" <l>y - Remove all trailing whitespace
nnoremap <silent> <leader>y :StripWhitespace<cr>
" fzf
" <l>p - Search files in current workdir
" <l>P - Search files in $HOME
" <l>g - Search commits for current buffer
" <l>G - Search commits in current workdir
" <l>f - Search source in current workdir
" <l>; - Search buffers
nnoremap <silent> <leader>p :Files<cr>
nnoremap <silent> <leader>P :Files ~<cr>
nnoremap <silent> <leader>g :BCommits<cr>
nnoremap <silent> <leader>G :Commits<cr>
nnoremap <silent> <leader>f :Rg<cr>
nnoremap <silent> <leader>; :Buffers<cr>
" coc.nvim explorer
" <l>e - Toggle explorer on/off
" <l>E - Open current file location
nmap <silent> <leader>e :CocCommand explorer<cr>
nmap <silent> <leader>E :CocCommand explorer --reveal expand('<sfile>')<cr>
" coc.nvim
" Ctrl-n - Go to next diagnostic
" Ctrl-p - Go to previous diagnostic
" <l>a - Open action list
" <l>c - Open command list
" <l>d - Jump to definition of current symbol
" <l>r - Jump to references of current symbol
" <l>j - Jump to implementation of current symbol
" <l>s - Fuzzy search current project symbols
" <l>n - Symbol renaming
" <l>k - Symbol renaming
nmap <silent> <C-n> <Plug>(coc-diagnostic-next)
nmap <silent> <C-p> <Plug>(coc-diagnostic-prev)
nmap <silent> <leader>a <Plug>(coc-codeaction-line)
nmap <silent> <leader>d <Plug>(coc-definition)
nmap <silent> <leader>r <Plug>(coc-references)
nmap <silent> <leader>j <Plug>(coc-implementation)
nmap <silent> <leader>s :<C-u>CocList -I -N --top symbols<cr>
nmap <silent> <leader>n <Plug>(coc-rename)
nmap <silent> <leader>c :CocCommand<cr>
" Search shorcuts
" <l>h - Find and replace
" <l>/ - Clear highlighted search terms while preserving history
nnoremap <leader>h :%s///<left><left>
nnoremap <silent> <leader>/ :nohlsearch<cr>
" <c-@> - trigger completion
" <tab> - trigger completion and navigate to next complete item
inoremap <silent><expr> <c-@> coc#refresh()
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
" K - show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<cr>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end

View File

@@ -0,0 +1,27 @@
" Colourscheme
set background=dark
colorscheme base16-seti
" Close preview window when completion is done.
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
" Disable deprecated python2 provider
let g:loaded_python_provider = 0
" " Call method on window enter
" augroup WindowManagement
" autocmd!
" autocmd WinEnter * call Handle_Win_Enter()
" augroup END
" " Change highlight group of preview window when open
" function! Handle_Win_Enter()
" if &previewwindow
" setlocal winhighlight=Normal:MarkdownError
" endif
" endfunction
"
" {{{
let g:startify_custom_header =
\ startify#pad(split(system('fortune | cowsay -f tux'), '\n'))
" }}}

View File

@@ -0,0 +1,190 @@
call plug#begin('~/.config/nvim/plugged')
" sensible defaults
Plug 'tpope/vim-sensible'
" colorscheme
Plug 'chriskempson/base16-vim'
" dev icons
Plug 'ryanoasis/vim-devicons'
" {{{
let g:webdevicons_enable_airline_tabline = 1
let g:webdevicons_enable_airline_statusline = 1
let g:webdevicons_enable_startify = 1
" }}}
" status line
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" {{{
" Theme
let g:airline_theme = 'base16_seti'
" Enable extensions
let g:airline_extensions = ['branch', 'coc', 'hunks', 'tabline', 'whitespace', 'fzf']
" Do not draw separators for empty sections (only for the active window) >
let g:airline_skip_empty_sections = 0
" Custom setup that removes filetype/whitespace from default vim airline bar
let g:airline#extensions#default#layout = [['a', 'b', 'c'], ['x', 'z', 'warning', 'error']]
" Customize vim airline per filetype
" 'list' - Only show file type plus current line number out of total
let g:airline_filetype_overrides = {
\ 'coc-explorer': [ ' Explore', '' ],
\ 'fugitive': ['fugitive', '%{airline#util#wrap(airline#extensions#branch#get_head(),80)}'],
\ 'help': [ 'Help', '%f' ],
\ 'startify': [ 'startify', '' ],
\ 'vim-plug': [ 'Plugins', '' ],
\ 'list': [ '%y', '%l/%L'],
\ }
" Enable powerline fonts
let g:airline_powerline_fonts = 1
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
" Enable caching of syntax highlighting groups
let g:airline_highlighting_cache = 1
" Enable tabline
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
" }}}
" start screen
Plug 'mhinz/vim-startify'
" distraction-free typing
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
" DOcumentation GEneraton
Plug 'kkoomen/vim-doge', { 'do': { -> doge#install({ 'headless': 1 }) } }
" auto-close plugins
Plug 'tpope/vim-endwise'
" easier commentary
Plug 'tpope/vim-commentary'
" easier alignment
Plug 'godlygeek/tabular'
" extra visual feedback
Plug 'junegunn/rainbow_parentheses.vim'
" {{{
let g:rainbow_active = 1
let g:rainbow#pairs = [['(', ')'], ['[', ']'], ['{', '}']]
let g:rainbow_conf = {'guis': ['bold']}
" }}}
Plug 'unblevable/quick-scope'
Plug 'ntpeters/vim-better-whitespace'
" heuristic whitepsace
Plug 'tpope/vim-sleuth'
" better motion
Plug 'tpope/vim-surround'
Plug 'justinmk/vim-sneak'
" {{{
let g:sneak#label = 1
let g:sneak#prompt = ' '
" case insensitive
let g:sneak#use_ic_scs = 1
" move to next search if cursor hasn't moved
let g:sneak#s_next = 1
" }}}
" git tools
Plug 'mhinz/vim-signify'
" {{{
let g:signify_sign_add = '+'
let g:signify_sign_delete = '-'
let g:signify_sign_change = '~'
let g:signify_sign_show_count = 0
let g:signify_sign_show_text = 1
" }}}
Plug 'tpope/vim-fugitive'
" fzf
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" {{{
let g:fzf_layout = { 'down': '~40%' }
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
let g:fzf_buffers_jump = 1
" }}}
Plug 'antoinemadec/coc-fzf'
Plug 'airblade/vim-rooter'
" coc
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
" {{{
let g:coc_global_extensions = [
\ 'coc-actions',
\ 'coc-clangd',
\ 'coc-css',
\ 'coc-docker',
\ 'coc-emmet',
\ 'coc-emoji',
\ 'coc-eslint',
\ 'coc-explorer',
\ 'coc-fish',
\ 'coc-fzf-preview',
\ 'coc-git',
\ 'coc-go',
\ 'coc-groovy',
\ 'coc-highlight',
\ 'coc-html',
\ 'coc-json',
\ 'coc-lists',
\ 'coc-marketplace',
\ 'coc-perl',
\ 'coc-prettier',
\ 'coc-python',
\ 'coc-react-refactor',
\ 'coc-rust-analyzer',
\ 'coc-sh',
\ 'coc-snippets',
\ 'coc-styled-components',
\ 'coc-svg',
\ 'coc-swagger',
\ 'coc-tabnine',
\ 'coc-toml',
\ 'coc-tslint',
\ 'coc-tslint-plugin',
\ 'coc-tsserver',
\ 'coc-vimlsp',
\ 'coc-xml',
\ 'coc-yaml',
\ ]
" }}}
" ts
Plug 'HerringtonDarkholme/yats.vim'
Plug 'maxmellon/vim-jsx-pretty'
" elm
Plug 'andys8/vim-elm-syntax'
" debugger
Plug 'puremourning/vimspector'
" {{{
let g:vimspector_enable_mappings = 'HUMAN'
" }}}
" Terminal
Plug 'kassio/neoterm'
call plug#end()