[neovim] Move configuration to lua, replacing COC and ALE with LSP and Treesitter
This commit is contained in:
parent
0c6bb91f41
commit
9f17b691b1
46 changed files with 2448 additions and 34 deletions
319
nvim/.config/nvim/colors/bsolarized.vim
Normal file
319
nvim/.config/nvim/colors/bsolarized.vim
Normal file
|
@ -0,0 +1,319 @@
|
|||
"
|
||||
" }}}
|
||||
|
||||
" Terminals that support italics
|
||||
if has("gui_running") || ( has("unix") && system("tput sitm") == "\033[3m" )
|
||||
let s:terminal_italic=1
|
||||
else
|
||||
let s:terminal_italic=0
|
||||
endif
|
||||
|
||||
|
||||
let g:solarized_termtrans = 0
|
||||
let g:solarized_degrade = 0
|
||||
let g:solarized_bold = 1
|
||||
let g:solarized_underline = 1
|
||||
" note that we need to override this later if the terminal doesn't support
|
||||
let g:solarized_italic = 1
|
||||
let g:solarized_termcolors = 16
|
||||
let g:solarized_contrast = "normal"
|
||||
let g:solarized_visibility = "normal"
|
||||
let g:solarized_diffmode = "normal"
|
||||
let g:solarized_hitrail = 0
|
||||
let g:solarized_menu = 1
|
||||
|
||||
" Colorscheme initialization "{{{
|
||||
" ---------------------------------------------------------------------
|
||||
highlight clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
let colors_name = "bsolarized"
|
||||
|
||||
"}}}
|
||||
" GUI & CSApprox hexadecimal palettes"{{{
|
||||
" ---------------------------------------------------------------------
|
||||
"
|
||||
let s:vmode = "cterm"
|
||||
let s:base03 = "8"
|
||||
let s:base02 = "0"
|
||||
let s:base01 = "10"
|
||||
let s:base00 = "11"
|
||||
let s:base0 = "12"
|
||||
let s:base1 = "14"
|
||||
let s:base2 = "7"
|
||||
let s:base3 = "15"
|
||||
let s:yellow = "3"
|
||||
let s:orange = "9"
|
||||
let s:red = "1"
|
||||
let s:magenta = "5"
|
||||
let s:violet = "13"
|
||||
let s:blue = "4"
|
||||
let s:cyan = "6"
|
||||
let s:green = "2"
|
||||
let s:none = "NONE"
|
||||
let s:none = "NONE"
|
||||
let s:t_none = "NONE"
|
||||
let s:n = "NONE"
|
||||
let s:b = ",bold"
|
||||
let s:bb = ""
|
||||
let s:u = ",underline"
|
||||
let s:i = ",italic"
|
||||
let s:c = ",undercurl"
|
||||
let s:r = ",reverse"
|
||||
let s:s = ",standout"
|
||||
let s:ou = ""
|
||||
let s:ob = ""
|
||||
|
||||
if (has("gui_running") || g:solarized_termtrans == 0)
|
||||
let s:back = s:base03
|
||||
else
|
||||
let s:back = "NONE"
|
||||
endif
|
||||
|
||||
let s:bg_none = ' ctermbg=NONE guibg=NONE'
|
||||
let s:bg_back = ' ctermbg=NONE guibg=#002b36'
|
||||
let s:bg_base03 = ' ctermbg=8 guibg=#002b36'
|
||||
let s:bg_base02 = ' ctermbg=0 guibg=#073642'
|
||||
let s:bg_base01 = ' ctermbg=10 guibg=#586e75'
|
||||
let s:bg_base00 = ' ctermbg=11 guibg=#657b83'
|
||||
let s:bg_base0 = ' ctermbg=12 guibg=#839496'
|
||||
let s:bg_base1 = ' ctermbg=14 guibg=#93a1a1'
|
||||
let s:bg_base2 = ' ctermbg=7 guibg=#eee8d5'
|
||||
let s:bg_base3 = ' ctermbg=15 guibg=#fdf6e3'
|
||||
let s:bg_green = ' ctermbg=2 guibg=#859900'
|
||||
let s:bg_yellow = ' ctermbg=3 guibg=#b58900'
|
||||
let s:bg_orange = ' ctermbg=9 guibg=#cb4b16'
|
||||
let s:bg_red = ' ctermbg=1 guibg=#dc322f'
|
||||
let s:bg_magenta = ' ctermbg=5 guibg=#d33682'
|
||||
let s:bg_violet = ' ctermbg=13 guibg=#6c71c4'
|
||||
let s:bg_blue = ' ctermbg=4 guibg=#268bd2'
|
||||
let s:bg_cyan = ' ctermbg=6 guibg=#2aa198'
|
||||
|
||||
let s:fg_none = ' ctermfg=NONE guifg=NONE'
|
||||
let s:fg_back = ' ctermfg=NONE guifg=#002b36'
|
||||
let s:fg_base03 = ' ctermfg=8 guifg=#002b36'
|
||||
let s:fg_base02 = ' ctermfg=0 guifg=#073642'
|
||||
let s:fg_base01 = ' ctermfg=10 guifg=#586e75'
|
||||
let s:fg_base00 = ' ctermfg=11 guifg=#657b83'
|
||||
let s:fg_base0 = ' ctermfg=12 guifg=#839496'
|
||||
let s:fg_base1 = ' ctermfg=14 guifg=#93a1a1'
|
||||
let s:fg_base2 = ' ctermfg=7 guifg=#eee8d5'
|
||||
let s:fg_base3 = ' ctermfg=15 guifg=#fdf6e3'
|
||||
let s:fg_green = ' ctermfg=2 guifg=#859900'
|
||||
let s:fg_yellow = ' ctermfg=3 guifg=#b58900'
|
||||
let s:fg_orange = ' ctermfg=9 guifg=#cb4b16'
|
||||
let s:fg_red = ' ctermfg=1 guifg=#dc322f'
|
||||
let s:fg_magenta = ' ctermfg=5 guifg=#d33682'
|
||||
let s:fg_violet = ' ctermfg=13 guifg=#6c71c4'
|
||||
let s:fg_blue = ' ctermfg=4 guifg=#268bd2'
|
||||
let s:fg_cyan = ' ctermfg=6 guifg=#2aa198'
|
||||
|
||||
let s:fmt_none = ' cterm=NONE gui=NONE'
|
||||
let s:fmt_bold = ' cterm=bold gui=bold'
|
||||
let s:fmt_bldi = ' cterm=bold,italic gui=bold,italic'
|
||||
let s:fmt_undr = ' cterm=underline gui=underline'
|
||||
let s:fmt_undb = ' cterm=underline,bold gui=underline,bold'
|
||||
let s:fmt_undi = ' cterm=underline,italic gui=underline,italic'
|
||||
let s:fmt_uopt = ' cterm=NONE gui=NONE'
|
||||
let s:fmt_curl = ' cterm=undercurl gui=undercurl'
|
||||
let s:fmt_ital = ' cterm=italic gui=italic'
|
||||
let s:fmt_stnd = ' cterm=standout gui=standout'
|
||||
let s:fmt_revr = ' cterm=reverse gui=reverse'
|
||||
let s:fmt_revb = ' cterm=reverse,bold gui=reverse,bold'
|
||||
let s:fmt_revbb = ' cterm=reverse gui=reverse'
|
||||
let s:fmt_revbbu = ' cterm=reverse,underline gui=reverse,underline'
|
||||
|
||||
let s:sp_none = ' guisp=NONE '
|
||||
let s:sp_back = ' guisp=8 '
|
||||
let s:sp_base03 = ' guisp=8 '
|
||||
let s:sp_base02 = ' guisp=0 '
|
||||
let s:sp_base01 = ' guisp=10 '
|
||||
let s:sp_base00 = ' guisp=11 '
|
||||
let s:sp_base0 = ' guisp=12 '
|
||||
let s:sp_base1 = ' guisp=14 '
|
||||
let s:sp_base2 = ' guisp=7 '
|
||||
let s:sp_base3 = ' guisp=15 '
|
||||
let s:sp_green = ' guisp=2 '
|
||||
let s:sp_yellow = ' guisp=3 '
|
||||
let s:sp_orange = ' guisp=9 '
|
||||
let s:sp_red = ' guisp=1 '
|
||||
let s:sp_magenta = ' guisp=5 '
|
||||
let s:sp_violet = ' guisp=13 '
|
||||
let s:sp_blue = ' guisp=4 '
|
||||
let s:sp_cyan = ' guisp=6 '
|
||||
|
||||
|
||||
hi! link diffAdded Statement
|
||||
hi! link diffLine Identifier
|
||||
"}}}
|
||||
" git & gitcommit highlighting "{{{
|
||||
"git
|
||||
"exe "hi! gitDateHeader"
|
||||
"exe "hi! gitIdentityHeader"
|
||||
"exe "hi! gitIdentityKeyword"
|
||||
"exe "hi! gitNotesHeader"
|
||||
"exe "hi! gitReflogHeader"
|
||||
"exe "hi! gitKeyword"
|
||||
"exe "hi! gitIdentity"
|
||||
"exe "hi! gitEmailDelimiter"
|
||||
"exe "hi! gitEmail"
|
||||
"exe "hi! gitDate"
|
||||
"exe "hi! gitMode"
|
||||
"exe "hi! gitHashAbbrev"
|
||||
"exe "hi! gitHash"
|
||||
"exe "hi! gitReflogMiddle"
|
||||
"exe "hi! gitReference"
|
||||
"exe "hi! gitStage"
|
||||
"exe "hi! gitType"
|
||||
"exe "hi! gitDiffAdded"
|
||||
"exe "hi! gitDiffRemoved"
|
||||
"gitcommit
|
||||
"exe "hi! gitcommitSummary"
|
||||
exe "hi! gitcommitComment" .s:fmt_ital .s:fg_base01 .s:bg_none
|
||||
hi! link gitcommitUntracked gitcommitComment
|
||||
hi! link gitcommitDiscarded gitcommitComment
|
||||
hi! link gitcommitSelected gitcommitComment
|
||||
exe "hi! gitcommitUnmerged" .s:fmt_bold .s:fg_green .s:bg_none
|
||||
exe "hi! gitcommitOnBranch" .s:fmt_bold .s:fg_base01 .s:bg_none
|
||||
exe "hi! gitcommitBranch" .s:fmt_bold .s:fg_magenta .s:bg_none
|
||||
hi! link gitcommitNoBranch gitcommitBranch
|
||||
exe "hi! gitcommitDiscardedType".s:fmt_none .s:fg_red .s:bg_none
|
||||
exe "hi! gitcommitSelectedType" .s:fmt_none .s:fg_green .s:bg_none
|
||||
"exe "hi! gitcommitUnmergedType"
|
||||
"exe "hi! gitcommitType"
|
||||
"exe "hi! gitcommitNoChanges"
|
||||
"exe "hi! gitcommitHeader"
|
||||
exe "hi! gitcommitHeader" .s:fmt_none .s:fg_base01 .s:bg_none
|
||||
exe "hi! gitcommitUntrackedFile".s:fmt_bold .s:fg_cyan .s:bg_none
|
||||
exe "hi! gitcommitDiscardedFile".s:fmt_bold .s:fg_red .s:bg_none
|
||||
exe "hi! gitcommitSelectedFile" .s:fmt_bold .s:fg_green .s:bg_none
|
||||
exe "hi! gitcommitUnmergedFile" .s:fmt_bold .s:fg_yellow .s:bg_none
|
||||
exe "hi! gitcommitFile" .s:fmt_bold .s:fg_base0 .s:bg_none
|
||||
hi! link gitcommitDiscardedArrow gitcommitDiscardedFile
|
||||
hi! link gitcommitSelectedArrow gitcommitSelectedFile
|
||||
hi! link gitcommitUnmergedArrow gitcommitUnmergedFile
|
||||
"exe "hi! gitcommitArrow"
|
||||
"exe "hi! gitcommitOverflow"
|
||||
"exe "hi! gitcommitBlank"
|
||||
" }}}
|
||||
" Utility autocommand "{{{
|
||||
" ---------------------------------------------------------------------
|
||||
" In cases where Solarized is initialized inside a terminal vim session and
|
||||
" then transferred to a gui session via the command `:gui`, the gui vim process
|
||||
" does not re-read the colorscheme (or .vimrc for that matter) so any `has_gui`
|
||||
" related code that sets gui specific values isn't executed.
|
||||
"
|
||||
" Currently, Solarized sets only the cterm or gui values for the colorscheme
|
||||
" depending on gui or terminal mode. It's possible that, if the following
|
||||
" autocommand method is deemed excessively poor form, that approach will be
|
||||
" used again and the autocommand below will be dropped.
|
||||
"
|
||||
" However it seems relatively benign in this case to include the autocommand
|
||||
" here. It fires only in cases where vim is transferring from terminal to gui
|
||||
" mode (detected with the script scope s:vmode variable). It also allows for
|
||||
" other potential terminal customizations that might make gui mode suboptimal.
|
||||
"
|
||||
autocmd GUIEnter * if (s:vmode != "gui") | exe "colorscheme " . g:colors_name | endif
|
||||
"}}}
|
||||
" Highlight Trailing Space {{{
|
||||
" Experimental: Different highlight when on cursorline
|
||||
function! s:SolarizedHiTrail()
|
||||
if g:solarized_hitrail==0
|
||||
hi! clear solarizedTrailingSpace
|
||||
else
|
||||
syn match solarizedTrailingSpace "\s*$"
|
||||
exe "hi! solarizedTrailingSpace " .s:fmt_undr .s:fg_red .s:bg_none .s:sp_red
|
||||
endif
|
||||
endfunction
|
||||
augroup SolarizedHiTrail
|
||||
autocmd!
|
||||
if g:solarized_hitrail==1
|
||||
autocmd! Syntax * call s:SolarizedHiTrail()
|
||||
autocmd! ColorScheme * if g:colors_name == "solarized" | call s:SolarizedHiTrail() | else | augroup! s:SolarizedHiTrail | endif
|
||||
endif
|
||||
augroup END
|
||||
" }}}
|
||||
" Menus "{{{
|
||||
" ---------------------------------------------------------------------
|
||||
" Turn off Solarized menu by including the following assignment in your .vimrc:
|
||||
"
|
||||
" let g:solarized_menu=0
|
||||
|
||||
function! s:SolarizedOptions()
|
||||
new "new buffer
|
||||
setf vim "vim filetype
|
||||
let failed = append(0, s:defaults_list)
|
||||
let failed = append(0, s:colorscheme_list)
|
||||
let failed = append(0, s:options_list)
|
||||
let failed = append(0, s:lazycat_list)
|
||||
0 "jump back to the top
|
||||
endfunction
|
||||
if !exists(":SolarizedOptions")
|
||||
command SolarizedOptions :call s:SolarizedOptions()
|
||||
endif
|
||||
|
||||
function! SolarizedMenu()
|
||||
if exists("g:loaded_solarized_menu")
|
||||
try
|
||||
silent! aunmenu Solarized
|
||||
endtry
|
||||
endif
|
||||
let g:loaded_solarized_menu = 1
|
||||
|
||||
if g:colors_name == "solarized" && g:solarized_menu != 0
|
||||
|
||||
amenu &Solarized.&Contrast.&Low\ Contrast :let g:solarized_contrast="low" \| colorscheme solarized<CR>
|
||||
amenu &Solarized.&Contrast.&Normal\ Contrast :let g:solarized_contrast="normal" \| colorscheme solarized<CR>
|
||||
amenu &Solarized.&Contrast.&High\ Contrast :let g:solarized_contrast="high" \| colorscheme solarized<CR>
|
||||
an &Solarized.&Contrast.-sep- <Nop>
|
||||
amenu &Solarized.&Contrast.&Help:\ Contrast :help 'solarized_contrast'<CR>
|
||||
|
||||
amenu &Solarized.&Visibility.&Low\ Visibility :let g:solarized_visibility="low" \| colorscheme solarized<CR>
|
||||
amenu &Solarized.&Visibility.&Normal\ Visibility :let g:solarized_visibility="normal" \| colorscheme solarized<CR>
|
||||
amenu &Solarized.&Visibility.&High\ Visibility :let g:solarized_visibility="high" \| colorscheme solarized<CR>
|
||||
an &Solarized.&Visibility.-sep- <Nop>
|
||||
amenu &Solarized.&Visibility.&Help:\ Visibility :help 'solarized_visibility'<CR>
|
||||
|
||||
amenu &Solarized.&Background.&Toggle\ Background :ToggleBG<CR>
|
||||
amenu &Solarized.&Background.&Dark\ Background :set background=dark \| colorscheme solarized<CR>
|
||||
amenu &Solarized.&Background.&Light\ Background :set background=light \| colorscheme solarized<CR>
|
||||
an &Solarized.&Background.-sep- <Nop>
|
||||
amenu &Solarized.&Background.&Help:\ ToggleBG :help togglebg<CR>
|
||||
|
||||
if g:solarized_bold==0 | let l:boldswitch="On" | else | let l:boldswitch="Off" | endif
|
||||
exe "amenu &Solarized.&Styling.&Turn\\ Bold\\ ".l:boldswitch." :let g:solarized_bold=(abs(g:solarized_bold-1)) \\| colorscheme solarized<CR>"
|
||||
if g:solarized_italic==0 | let l:italicswitch="On" | else | let l:italicswitch="Off" | endif
|
||||
exe "amenu &Solarized.&Styling.&Turn\\ Italic\\ ".l:italicswitch." :let g:solarized_italic=(abs(g:solarized_italic-1)) \\| colorscheme solarized<CR>"
|
||||
if g:solarized_underline==0 | let l:underlineswitch="On" | else | let l:underlineswitch="Off" | endif
|
||||
exe "amenu &Solarized.&Styling.&Turn\\ Underline\\ ".l:underlineswitch." :let g:solarized_underline=(abs(g:solarized_underline-1)) \\| colorscheme solarized<CR>"
|
||||
|
||||
amenu &Solarized.&Diff\ Mode.&Low\ Diff\ Mode :let g:solarized_diffmode="low" \| colorscheme solarized<CR>
|
||||
amenu &Solarized.&Diff\ Mode.&Normal\ Diff\ Mode :let g:solarized_diffmode="normal" \| colorscheme solarized<CR>
|
||||
amenu &Solarized.&Diff\ Mode.&High\ Diff\ Mode :let g:solarized_diffmode="high" \| colorscheme solarized<CR>
|
||||
|
||||
if g:solarized_hitrail==0 | let l:hitrailswitch="On" | else | let l:hitrailswitch="Off" | endif
|
||||
exe "amenu &Solarized.&Experimental.&Turn\\ Highlight\\ Trailing\\ Spaces\\ ".l:hitrailswitch." :let g:solarized_hitrail=(abs(g:solarized_hitrail-1)) \\| colorscheme solarized<CR>"
|
||||
an &Solarized.&Experimental.-sep- <Nop>
|
||||
amenu &Solarized.&Experimental.&Help:\ HiTrail :help 'solarized_hitrail'<CR>
|
||||
|
||||
an &Solarized.-sep1- <Nop>
|
||||
|
||||
amenu &Solarized.&Autogenerate\ options :SolarizedOptions<CR>
|
||||
|
||||
an &Solarized.-sep2- <Nop>
|
||||
|
||||
amenu &Solarized.&Help.&Solarized\ Help :help solarized<CR>
|
||||
amenu &Solarized.&Help.&Toggle\ Background\ Help :help togglebg<CR>
|
||||
amenu &Solarized.&Help.&Removing\ This\ Menu :help solarized-menu<CR>
|
||||
|
||||
an 9999.77 &Help.&Solarized\ Colorscheme :help solarized<CR>
|
||||
an 9999.78 &Help.&Toggle\ Background :help togglebg<CR>
|
||||
an 9999.79 &Help.-sep3- <Nop>
|
||||
|
||||
endif
|
||||
endfunction
|
||||
|
||||
autocmd ColorScheme * if g:colors_name != "solarized" | silent! aunmenu Solarized | else | call SolarizedMenu() | endif
|
||||
|
||||
"}}}
|
410
nvim/.config/nvim/colors/bsolarized2.lua
Normal file
410
nvim/.config/nvim/colors/bsolarized2.lua
Normal file
|
@ -0,0 +1,410 @@
|
|||
-- ---------------------------------------------------------------------
|
||||
-- COLOR VALUES
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Download palettes and files from: http://ethanschoonover.com/solarized
|
||||
--
|
||||
-- L\*a\*b values are canonical (White D65, Reference D50), other values are
|
||||
-- matched in sRGB space.
|
||||
--
|
||||
-- SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B sRGB HSB
|
||||
-- --------- ------- ---- ------- ----------- ---------- ----------- -----------
|
||||
-- base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21
|
||||
-- base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26
|
||||
-- base01 #586e75 10/7 brgreen 240 #4e4e4e 45 -07 -07 88 110 117 194 25 46
|
||||
-- base00 #657b83 11/7 bryellow 241 #585858 50 -07 -07 101 123 131 195 23 51
|
||||
-- base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59
|
||||
-- base1 #93a1a1 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63
|
||||
-- base2 #eee8d5 7/7 white 254 #d7d7af 92 -00 10 238 232 213 44 11 93
|
||||
-- base3 #fdf6e3 15/7 brwhite 230 #ffffd7 97 00 10 253 246 227 44 10 99
|
||||
-- yellow #b58900 3/3 yellow 136 #af8700 60 10 65 181 137 0 45 100 71
|
||||
-- orange #cb4b16 9/3 brred 166 #d75f00 50 50 55 203 75 22 18 89 80
|
||||
-- red #dc322f 1/1 red 160 #d70000 50 65 45 220 50 47 1 79 86
|
||||
-- magenta #d33682 5/5 magenta 125 #af005f 50 65 -05 211 54 130 331 74 83
|
||||
-- violet #6c71c4 13/5 brmagenta 61 #5f5faf 50 15 -45 108 113 196 237 45 77
|
||||
-- blue #268bd2 4/4 blue 33 #0087ff 55 -10 -45 38 139 210 205 82 82
|
||||
-- cyan #2aa198 6/6 cyan 37 #00afaf 60 -35 -05 42 161 152 175 74 63
|
||||
-- green #859900 2/2 green 64 #5f8700 60 -20 65 133 153 0 68 100 60
|
||||
--
|
||||
-- ---------------------------------------------------------------------
|
||||
-- COLORSCHEME HACKING
|
||||
-- ---------------------------------------------------------------------
|
||||
--
|
||||
-- Useful commands for testing colorschemes:
|
||||
-- :source $VIMRUNTIME/syntax/hitest.vim
|
||||
-- :help highlight-groups
|
||||
-- :help cterm-colors
|
||||
-- :help group-name
|
||||
--
|
||||
-- Useful links for developing colorschemes:
|
||||
-- http://www.vim.org/scripts/script.php?script_id=2937
|
||||
-- http://vimcasts.org/episodes/creating-colorschemes-for-vim/
|
||||
-- http://www.frexx.de/xterm-256-notes/"
|
||||
|
||||
local table = require('table')
|
||||
|
||||
function highlight(opts)
|
||||
assert(opts.name, "The name of the group is missing")
|
||||
|
||||
local histr = "highlight! " .. opts.name .. " "
|
||||
|
||||
if opts.fg then
|
||||
histr = histr .. "ctermfg=" .. opts.fg[1] .. " "
|
||||
histr = histr .. "guifg=" .. opts.fg[2] .. " "
|
||||
end
|
||||
|
||||
if opts.bg then
|
||||
histr = histr .. "ctermbg=" .. opts.bg[1] .. " "
|
||||
histr = histr .. "guibg=" .. opts.bg[2] .. " "
|
||||
end
|
||||
|
||||
if opts.attrs then
|
||||
histr = histr .. "cterm=" .. table.concat(opts.attrs, ",") .. " "
|
||||
histr = histr .. "gui=" .. table.concat(opts.attrs, ",") .. " "
|
||||
end
|
||||
|
||||
if opts.sp then
|
||||
histr = histr .. "guisp=" .. opts.sp[2] .. " "
|
||||
end
|
||||
|
||||
if opts.link then
|
||||
histr = "highlight! link " .. opts.name .. " " .. opts.link
|
||||
end
|
||||
|
||||
if opts.clear then
|
||||
histr = "highlight! clear " .. opts.name
|
||||
end
|
||||
|
||||
vim.cmd(histr)
|
||||
end
|
||||
|
||||
local config = {
|
||||
termtrans = false
|
||||
}
|
||||
|
||||
local colors = {
|
||||
base03 = { "8", "#002b36" },
|
||||
base02 = { "0", "#073642" },
|
||||
base01 = { "10", "#586e75" },
|
||||
base00 = { "11", "#657b83" },
|
||||
base0 = { "12", "#839496" },
|
||||
base1 = { "14", "#93a1a1" },
|
||||
base2 = { "7", "#eee8d5" },
|
||||
base3 = { "15", "#fdf6e3" },
|
||||
yellow = { "3", "#859900" },
|
||||
orange = { "9", "#b58900" },
|
||||
red = { "1", "#cb4b16" },
|
||||
magenta = { "5", "#dc322f" },
|
||||
violet = { "13", "#d33682" },
|
||||
blue = { "4", "#6c71c4" },
|
||||
cyan = { "6", "#268bd2" },
|
||||
green = { "2", "#2aa198" },
|
||||
none = { "NONE", "NONE" },
|
||||
back = { "8", "#002b36" },
|
||||
}
|
||||
|
||||
if config.termtrans then
|
||||
colors.back = colors.none
|
||||
end
|
||||
|
||||
local attrs = {
|
||||
none = "NONE",
|
||||
bbold = "",
|
||||
bold = "bold",
|
||||
underline = "underline",
|
||||
italic = "italic",
|
||||
curly = "undercurl",
|
||||
reverse = "reverse",
|
||||
standout = "standout",
|
||||
strike = "strikethrough",
|
||||
ou = "",
|
||||
ob = "",
|
||||
}
|
||||
|
||||
vim.cmd [[
|
||||
highlight clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
]]
|
||||
|
||||
vim.g.colors_name = "bsolarized2"
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Builtin groups
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
-- ColorColumn used for the columns set with 'colorcolumn'
|
||||
highlight {name="ColorColumn", bg=colors.base02}
|
||||
|
||||
-- Conceal placeholder characters substituted for concealed text (see
|
||||
-- 'conceallevel')
|
||||
highlight {name="Conceal", fg=colors.blue}
|
||||
|
||||
-- Cursor character under the cursor
|
||||
highlight {name="Cursor", fg=colors.base03, bg=colors.base01}
|
||||
|
||||
-- lCursor the character under the cursor when |language-mapping| is
|
||||
-- used (see 'guicursor')
|
||||
highlight {name="lcursor", link="Cursor"}
|
||||
|
||||
-- CursorIM like Cursor, but used when in IME mode |CursorIM|
|
||||
highlight {name="CursorIM", link="Cursor"}
|
||||
|
||||
-- CursorColumn Screen-column at the cursor, when 'cursorcolumn' is set.
|
||||
highlight {name="CursorColumn", bg=colors.base02}
|
||||
|
||||
-- CursorLine Screen-line at the cursor, when 'cursorline' is set.
|
||||
-- Low-priority if foreground (ctermfg OR guifg) is not set.
|
||||
highlight {name="CursorLine", bg=colors.base02, attrs={attrs.none}}
|
||||
|
||||
-- Directory directory names (and other special names in listings)
|
||||
highlight {name="Directory", fg=colors.blue}
|
||||
|
||||
-- DiffAdd diff mode: Added line |diff.txt|
|
||||
-- DiffChange diff mode: Changed line |diff.txt|
|
||||
-- DiffDelete diff mode: Deleted line |diff.txt|
|
||||
-- DiffText diff mode: Changed text within a changed line |diff.txt|
|
||||
highlight {name="DiffAdd", fg=colors.green, bg=colors.base02, attrs={attrs.bold}}
|
||||
highlight {name="DiffChange", fg=colors.yellow, bg=colors.base02, attrs={attrs.bold}}
|
||||
highlight {name="DiffDelete", fg=colors.red, bg=colors.base02, attrs={attrs.bold}}
|
||||
highlight {name="DiffText", fg=colors.blue, bg=colors.base02, attrs={attrs.bold}}
|
||||
|
||||
-- EndOfBuffer filler lines (~) after the end of the buffer. By default,
|
||||
-- this is highlighted like |hl-NonText|.
|
||||
--KEEP DEFAULT
|
||||
|
||||
-- TermCursor cursor in a focused terminal
|
||||
--KEEP DEFAULT
|
||||
|
||||
-- TermCursorNC cursor in an unfocused terminal
|
||||
--KEEP DEFAULT
|
||||
|
||||
-- ErrorMsg error messages on the command line
|
||||
highlight {name="ErrorMsg", fg=colors.base03, bg=colors.red, attrs={attrs.bold}}
|
||||
|
||||
-- VertSplit the column separating vertically split windows
|
||||
highlight {name="VertSplit", fg=colors.base00, bg=colors.base00}
|
||||
|
||||
-- Folded line used for closed folds
|
||||
highlight {name="Folded", fg=colors.base0, bg=colors.base02, sp=colors.base03, attrs={attrs.underline, attrs.bold}}
|
||||
|
||||
-- FoldColumn 'foldcolumn'
|
||||
highlight {name="FoldColumn", fg=colors.base0, bg=colors.base02}
|
||||
|
||||
-- SignColumn column where |signs| are displayed
|
||||
--highlight {name="SignColumn", fg=colors.base0, attrs={attrs.none}}
|
||||
highlight {name="SignColumn", link="LineNr"}
|
||||
|
||||
-- IncSearch 'incsearch' highlighting; also used for the text replaced
|
||||
-- with ":s///c"
|
||||
highlight {name="IncSearch", link="Search"}
|
||||
|
||||
-- Substitute |:substitute| replacement text highlighting
|
||||
highlight {name="Substitute", link="Search"}
|
||||
|
||||
-- LineNr Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set.
|
||||
highlight {name="LineNr", fg=colors.base01, bg=colors.base02, attrs={attrs.none}}
|
||||
|
||||
-- LineNrAbove Line number for when the 'relativenumber' option is set,
|
||||
-- above the cursor line.
|
||||
--KEEP DEFAULT
|
||||
|
||||
-- LineNrBelow Line number for when the 'relativenumber' option is set,
|
||||
-- below the cursor line.
|
||||
--KEEP DEFAULT
|
||||
|
||||
-- CursorLineNr Like LineNr when 'cursorline' is set and 'cursorlineopt'
|
||||
-- contains "number" or is "both", for the cursor line.
|
||||
highlight {name="CursorLineNr", fg=colors.base0, bg=colors.back, attrs={attrs.bold}}
|
||||
|
||||
-- MatchParen The character under the cursor or just before it, if it is
|
||||
-- a paired bracket, and its match. |pi_paren.txt|
|
||||
highlight {name="MatchParen", fg=colors.red, bg=colors.base00, attrs={attrs.bold}}
|
||||
|
||||
-- ModeMsg 'showmode' message (e.g., "-- INSERT --")
|
||||
highlight {name="ModeMsg", fg=colors.blue}
|
||||
|
||||
-- MsgArea Area for messages and cmdline
|
||||
--KEEP DEFAULT
|
||||
|
||||
-- MsgSeparator Separator for scrolled messages, `msgsep` flag of 'display'
|
||||
--KEEP DEFAULT
|
||||
|
||||
-- MoreMsg |more-prompt|
|
||||
highlight {name="MoreMsg", fg=colors.blue}
|
||||
|
||||
-- NonText '@' at the end of the window, characters from 'showbreak'
|
||||
-- and other characters that do not really exist in the text (e.g., ">"
|
||||
-- displayed when a double-wide character doesn't fit at the end of the
|
||||
-- line). See also |hl-EndOfBuffer|.
|
||||
highlight {name="NonText", fg=colors.base01, attrs={attrs.none}}
|
||||
|
||||
-- Normal normal text
|
||||
highlight {name="Normal", fg=colors.base0, bg=colors.back, attr={attrs.none}}
|
||||
|
||||
-- NormalFloat Normal text in floating windows.
|
||||
--KEEP DEFAULT : links to Pmenu
|
||||
|
||||
-- NormalNC normal text in non-current windows
|
||||
--KEEP DEFAULT : cleared
|
||||
|
||||
-- Pmenu Popup menu: normal item.
|
||||
highlight {name="Pmenu", fg=colors.base0, bg=colors.base02, attrs={attrs.reverse}}
|
||||
|
||||
-- PmenuSel Popup menu: selected item.
|
||||
highlight {name="PmenuSel", fg=colors.base01, bg=colors.base2, attrs={attrs.reverse}}
|
||||
|
||||
-- PmenuSbar Popup menu: scrollbar.
|
||||
highlight {name="PmenuSbar", fg=colors.base2, bg=colors.base0, attrs={attrs.reverse}}
|
||||
|
||||
-- PmenuThumb Popup menu: Thumb of the scrollbar.
|
||||
highlight {name="PmenuThumb", fg=colors.base0, bg=colors.base03, attrs={attrs.reverse}}
|
||||
|
||||
-- Question |hit-enter| prompt and yes/no questions
|
||||
highlight {name="Question", fg=colors.cyan, bg=colors.none, attrs={attrs.bold}}
|
||||
|
||||
-- QuickFixLine Current |quickfix| item in the quickfix window. Combined
|
||||
-- with |hl-CursorLine| when the cursor is there.
|
||||
--KEEP DEFAULT : links to Search
|
||||
|
||||
-- Search Last search pattern highlighting (see 'hlsearch'). Also
|
||||
-- used for similar items that need to stand out.
|
||||
highlight {name="Search", bg=colors.yellow}
|
||||
|
||||
-- SpecialKey Unprintable characters: text displayed differently from
|
||||
-- what it really is. But not 'listchars' whitespace. |hl-Whitespace|
|
||||
highlight {name="SpecialKey", fg=colors.base00, bg=colors.base02, attrs={attrs.bold}}
|
||||
|
||||
-- SpellBad Word that is not recognized by the spellchecker. |spell|
|
||||
-- Combined with the highlighting used otherwise.
|
||||
-- SpellCap Word that should start with a capital. |spell| Combined with
|
||||
-- the highlighting used otherwise.
|
||||
-- SpellLocal Word that is recognized by the spellchecker as one that is
|
||||
-- used in another region. |spell| Combined with the highlighting used
|
||||
-- otherwise.
|
||||
-- SpellRare Word that is recognized by the spellchecker as one that is
|
||||
-- hardly ever used. |spell| Combined with the highlighting used otherwise.
|
||||
highlight {name="SpellBad", bg=colors.none, attrs={attrs.curly}, sp=colors.red}
|
||||
highlight {name="SpellCap", bg=colors.none, attrs={attrs.curly}, sp=colors.violet}
|
||||
highlight {name="SpellRare", bg=colors.none, attrs={attrs.curly}, sp=colors.cyan}
|
||||
highlight {name="SpellLocal", bg=colors.none, attrs={attrs.curly}, sp=colors.yellow}
|
||||
|
||||
-- StatusLine status line of current window
|
||||
-- StatusLineNC status lines of not-current windows Note: if this is equal
|
||||
-- to "StatusLine" Vim will use "^^^" in the status line of the current
|
||||
-- window.
|
||||
highlight {name="StatusLine", fg=colors.base1, bg=colors.base02, attrs={attrs.reverse}}
|
||||
highlight {name="StatusLineNC", fg=colors.base00, bg=colors.base02, attrs={attrs.reverse}}
|
||||
|
||||
-- TabLine tab pages line, not active tab page label
|
||||
-- TabLineFill tab pages line, where there are no labels
|
||||
-- TabLineSel tab pages line, active tab page label
|
||||
highlight {name="TabLine", fg=colors.base0, bg=colors.base02, attrs={attrs.underline}, sp=colors.base0}
|
||||
highlight {name="TabLineFill", fg=colors.base0, bg=colors.base02, attrs={attrs.underline}, sp=colors.base0}
|
||||
highlight {name="TabLineSel", fg=colors.base01, bg=colors.base2, attrs={attrs.underline, attrs.reverse}, sp=colors.base0}
|
||||
|
||||
-- Title titles for output from ":set all", ":autocmd" etc.
|
||||
highlight {name="Title", fg=colors.orange, bg=colors.base2, attrs={attrs.bold}}
|
||||
|
||||
-- Visual Visual mode selection
|
||||
-- VisualNOS Visual mode selection when vim is "Not Owning the
|
||||
-- Selection".
|
||||
highlight {name="Visual", fg=colors.base01, bg=colors.base03, attrs={attrs.reverse}}
|
||||
highlight {name="VisualNOS", fg=colors.none, bg=colors.base03, attrs={attrs.reverse, attrs.standout}}
|
||||
|
||||
-- WarningMsg warning messages
|
||||
highlight {name="WarningMsg", fg=colors.red, bg=colors.none, attrs={attrs.bold}}
|
||||
|
||||
-- Whitespace "nbsp", "space", "tab" and "trail" in 'listchars'
|
||||
-- KEEP DEFAULT : links to NonText
|
||||
|
||||
-- WildMenu current match in 'wildmenu' completion
|
||||
highlight {name="WildMenu", fg=colors.base2, bg=colors.base02, attrs={attrs.reverse}}
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Syntax groups
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
-- *Comment any comment
|
||||
highlight {name="Comment", fg=colors.base01, attrs={attrs.italic}}
|
||||
|
||||
-- *Constant any constant
|
||||
-- String a string constant: "this is a string"
|
||||
-- Character a character constant: 'c', '\n'
|
||||
-- Number a number constant: 234, 0xff
|
||||
-- Boolean a boolean constant: TRUE, false
|
||||
-- Float a floating point constant: 2.3e10
|
||||
highlight {name="Constant", fg=colors.cyan}
|
||||
|
||||
-- *Identifier any variable name
|
||||
-- Function function name (also: methods for classes)
|
||||
highlight {name="Identifier", fg=colors.blue}
|
||||
|
||||
-- *Statement any statement
|
||||
-- Conditional if, then, else, endif, switch, etc.
|
||||
-- Repeat for, do, while, etc.
|
||||
-- Label case, default, etc.
|
||||
-- Operator "sizeof", "+", "*", etc.
|
||||
-- Keyword any other keyword
|
||||
-- Exception try, catch, throw
|
||||
highlight {name="Statement", fg=colors.green}
|
||||
|
||||
-- *PreProc generic Preprocessor
|
||||
-- Include preprocessor #include
|
||||
-- Define preprocessor #define
|
||||
-- Macro same as Define
|
||||
-- PreCondit preprocessor #if, #else, #endif, etc.
|
||||
highlight {name="PreProc", fg=colors.orange}
|
||||
|
||||
-- *Type int, long, char, etc.
|
||||
-- StorageClass static, register, volatile, etc.
|
||||
-- Structure struct, union, enum, etc.
|
||||
-- Typedef A typedef
|
||||
highlight {name="Type", fg=colors.yellow}
|
||||
|
||||
-- *Special any special symbol
|
||||
-- SpecialChar special character in a constant
|
||||
-- Tag you can use CTRL-] on this
|
||||
-- Delimiter character that needs attention
|
||||
-- SpecialComment special things inside a comment
|
||||
-- Debug debugging statements
|
||||
highlight {name="Special", fg=colors.red}
|
||||
|
||||
-- *Underlined text that stands out, HTML links
|
||||
highlight {name="Underlined", fg=colors.violet}
|
||||
|
||||
-- *Ignore left blank, hidden |hl-Ignore|
|
||||
highlight {name="Ignore", fg=colors.none, bg=colors.none, attrs={attrs.none}}
|
||||
|
||||
-- *Error any erroneous construct
|
||||
highlight {name="Error", fg=colors.base03, bg=colors.red, attrs={attrs.bold}}
|
||||
|
||||
-- *Todo anything that needs extra attention; mostly the keywords
|
||||
-- TODO FIXME and XXX
|
||||
highlight {name="Todo", fg=colors.magenta, bg=colors.none, attrs={attrs.bold}}
|
||||
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- NvimTree syntax
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
highlight {name="NvimTreeSymlink", fg=colors.violet}
|
||||
highlight {name="NvimTreeFolderName", link="Directory"}
|
||||
highlight {name="NvimTreeRootFolder", link="Directory"}
|
||||
highlight {name="NvimTreeFolderIcon", link="Directory"}
|
||||
highlight {name="NvimTreeEmptyFolderName", link="Directory"}
|
||||
highlight {name="NvimTreeOpenedFolderName", link="Directory"}
|
||||
highlight {name="NvimTreeExecFile", fg=colors.blue}
|
||||
highlight {name="NvimTreeOpenedFile", attrs={attrs.bold}}
|
||||
highlight {name="NvimTreeSpecialFile", fg=colors.magenta}
|
||||
highlight {name="NvimTreeImageFile", fg=colors.cyan}
|
||||
highlight {name="NvimTreeIndentMarker", fg=colors.base01}
|
||||
|
||||
highlight {name="NvimTreeGitDirty", fg=colors.yellow, attrs={attrs.bold}}
|
||||
highlight {name="NvimTreeGitStaged", fg=colors.green, attrs={attrs.bold}}
|
||||
highlight {name="NvimTreeGitMerge", fg=colors.orange, attrs={attrs.bold}}
|
||||
highlight {name="NvimTreeGitRenamed", fg=colors.green, attrs={attrs.bold}}
|
||||
highlight {name="NvimTreeGitNew", fg=colors.green, attrs={attrs.bold}}
|
||||
highlight {name="NvimTreeGitDeleted", fg=colors.red, attrs={attrs.strike}}
|
||||
|
||||
--highlight {name="NvimTreeWindowPicker", link=""}
|
3
nvim/.config/nvim/init.lua
Normal file
3
nvim/.config/nvim/init.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
require "settings"
|
||||
require "lsp"
|
||||
require "plugins"
|
|
@ -1,34 +0,0 @@
|
|||
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||
let &packpath = &runtimepath
|
||||
source ~/.vimrc
|
||||
|
||||
if exists('g:started_by_firenvim')
|
||||
set laststatus=0
|
||||
set showtabline=0
|
||||
endif
|
||||
|
||||
let g:firenvim_config = {
|
||||
\ 'globalSettings': {
|
||||
\ 'alt': 'all',
|
||||
\ },
|
||||
\ 'localSettings': { }
|
||||
\ }
|
||||
|
||||
function! s:IsFirenvimActive(event) abort
|
||||
if !exists('*nvim_get_chan_info')
|
||||
return 0
|
||||
endif
|
||||
let l:ui = nvim_get_chan_info(a:event.chan)
|
||||
return has_key(l:ui, 'client') && has_key(l:ui.client, "name") &&
|
||||
\ l:ui.client.name is# "Firenvim"
|
||||
endfunction
|
||||
|
||||
function! OnUIEnter(event) abort
|
||||
if s:IsFirenvimActive(a:event)
|
||||
set laststatus=0
|
||||
endif
|
||||
endfunction
|
||||
autocmd UIEnter * call OnUIEnter(deepcopy(v:event))
|
||||
|
||||
let fc = g:firenvim_config['localSettings']
|
||||
let fc['https://share\.waarp\.org/'] = { 'takeover': 'never', 'priority': 1 }
|
7
nvim/.config/nvim/lua/lsp/ansiblels.lua
Normal file
7
nvim/.config/nvim/lua/lsp/ansiblels.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local common = require('lsp.common')
|
||||
|
||||
require('lspconfig').ansiblels.setup {
|
||||
capabilities = common.cap,
|
||||
on_attach = common.attach,
|
||||
filetypes = { "yaml.ansible" }
|
||||
}
|
6
nvim/.config/nvim/lua/lsp/bashls.lua
Normal file
6
nvim/.config/nvim/lua/lsp/bashls.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local common = require('lsp.common')
|
||||
|
||||
require('lspconfig').bashls.setup {
|
||||
capabilities = common.cap,
|
||||
on_attach = common.attach,
|
||||
}
|
46
nvim/.config/nvim/lua/lsp/common.lua
Normal file
46
nvim/.config/nvim/lua/lsp/common.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
local M = {}
|
||||
|
||||
M.cap = capabilities
|
||||
M.attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>d', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>dp', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>dn', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>dl', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>s', '<cmd>lua vim.lsp.buf.document_highlight()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ss', '<cmd>lua vim.lsp.buf.clear_references()<CR>', opts)
|
||||
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
vim.cmd [[
|
||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
|
||||
hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
|
||||
hi LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow
|
||||
]]
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
8
nvim/.config/nvim/lua/lsp/cssls.lua
Normal file
8
nvim/.config/nvim/lua/lsp/cssls.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
local common = require('lsp.common')
|
||||
|
||||
require('lspconfig').cssls.setup {
|
||||
capabilities = common.cap,
|
||||
on_attach = common.attach,
|
||||
cmd = { "vscode-css-languageserver", "--stdio" },
|
||||
}
|
||||
|
90
nvim/.config/nvim/lua/lsp/efm.lua
Normal file
90
nvim/.config/nvim/lua/lsp/efm.lua
Normal file
|
@ -0,0 +1,90 @@
|
|||
local common = require('lsp.common')
|
||||
|
||||
local eslint = {
|
||||
lintCommand = 'eslint -f visualstudio --stdin --stdin-filename ${INPUT}',
|
||||
lintIgnoreExitCode = true,
|
||||
lintStdin = true,
|
||||
lintFormats = {
|
||||
"%f(%l,%c): %tarning %m",
|
||||
"%f(%l,%c): %trror %m",
|
||||
},
|
||||
}
|
||||
|
||||
local mdlint = {
|
||||
lintCommand = 'markdownlint -s ',
|
||||
lintStdin = true,
|
||||
lintFormats = {
|
||||
'%f:%l %m',
|
||||
'%f:%l:%c %m',
|
||||
'%f: %l: %m',
|
||||
}
|
||||
}
|
||||
|
||||
local shellcheck = {
|
||||
lintCommand = 'shellcheck -f gcc -x',
|
||||
lintSource = 'shellcheck',
|
||||
lintFormats = {
|
||||
'%f:%l:%c: %trror: %m',
|
||||
'%f:%l:%c: %tarning: %m',
|
||||
'%f:%l:%c: %tote: %m',
|
||||
}
|
||||
}
|
||||
|
||||
local fish = {
|
||||
lintCommand = 'fish -n ',
|
||||
lintSource = 'fish',
|
||||
lintFormats = {
|
||||
'%sline %l: %m',
|
||||
}
|
||||
}
|
||||
|
||||
local golangcilint = {
|
||||
lintCommand = "golangci-lintw run --print-issued-lines=false",
|
||||
lintSource = "golangci-lint",
|
||||
lintIgnoreExitCode = true,
|
||||
lintFormats = {
|
||||
'%f:%l:%c: %m',
|
||||
'%f:%l: %m',
|
||||
},
|
||||
}
|
||||
|
||||
local stylelint = {
|
||||
lintCommand = "stylelint",
|
||||
lintSource = "stylelint",
|
||||
lintIgnoreExitCode = true,
|
||||
lintFormats = {
|
||||
"%-P%f",
|
||||
[[%*[\ ]%l:%c%*[\ ]%*[✖⚠]%*[\ ]%m]],
|
||||
"%-Q",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
require('lspconfig').efm.setup {
|
||||
capabilities = common.cap,
|
||||
on_attach = common.attach,
|
||||
filetypes = {
|
||||
"bash",
|
||||
"css",
|
||||
"fish",
|
||||
"javascript",
|
||||
"markdown",
|
||||
"scss",
|
||||
"sh",
|
||||
"vimwiki"
|
||||
},
|
||||
settings = {
|
||||
rootMarkers = {".git/"},
|
||||
languages = {
|
||||
bash = { shellcheck },
|
||||
css = { stylelint },
|
||||
fish = { fish },
|
||||
javascript = { eslint },
|
||||
markdown = { mdlint },
|
||||
scss = { stylelint },
|
||||
sh = { shellcheck },
|
||||
vimwiki = { mdlint },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7
nvim/.config/nvim/lua/lsp/ember.lua
Normal file
7
nvim/.config/nvim/lua/lsp/ember.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local common = require('lsp.common')
|
||||
|
||||
require('lspconfig').bashls.setup {
|
||||
capabilities = common.cap,
|
||||
on_attach = common.attach,
|
||||
}
|
||||
|
7
nvim/.config/nvim/lua/lsp/esbonio.lua
Normal file
7
nvim/.config/nvim/lua/lsp/esbonio.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local common = require('lsp.common')
|
||||
|
||||
require('lspconfig').esbonio.setup {
|
||||
capabilities = common.cap,
|
||||
on_attach = common.attach,
|
||||
}
|
||||
|
6
nvim/.config/nvim/lua/lsp/golangci_lint_ls.lua
Normal file
6
nvim/.config/nvim/lua/lsp/golangci_lint_ls.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local common = require('lsp.common')
|
||||
|
||||
require('lspconfig').golangci_lint_ls.setup {
|
||||
capabilities = common.cap,
|
||||
on_attach = common.attach,
|
||||
}
|
103
nvim/.config/nvim/lua/lsp/gopls.lua
Normal file
103
nvim/.config/nvim/lua/lsp/gopls.lua
Normal file
|
@ -0,0 +1,103 @@
|
|||
local common = require('lsp.common')
|
||||
|
||||
function goimports(timeout_ms)
|
||||
local context = { only = { "source.organizeImports" } }
|
||||
vim.validate { context = { context, "t", true } }
|
||||
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = context
|
||||
|
||||
-- See the implementation of the textDocument/codeAction callback
|
||||
-- (lua/vim/lsp/handler.lua) for how to do this properly.
|
||||
local results = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, timeout_ms)
|
||||
if not results or next(results) == nil then return end
|
||||
local actions
|
||||
for i, result in pairs(results) do
|
||||
if result then
|
||||
actions = result.result
|
||||
break
|
||||
end
|
||||
end
|
||||
print(vim.inspect(actions))
|
||||
if not actions then return end
|
||||
local action = actions[1]
|
||||
|
||||
-- textDocument/codeAction can return either Command[] or CodeAction[]. If it
|
||||
-- is a CodeAction, it can have either an edit, a command or both. Edits
|
||||
-- should be executed first.
|
||||
if action.edit or type(action.command) == "table" then
|
||||
if action.edit then
|
||||
vim.lsp.util.apply_workspace_edit(action.edit)
|
||||
end
|
||||
if type(action.command) == "table" then
|
||||
vim.lsp.buf.execute_command(action.command)
|
||||
end
|
||||
else
|
||||
vim.lsp.buf.execute_command(action)
|
||||
end
|
||||
end
|
||||
|
||||
function format_with_imports(timeout_ms)
|
||||
goimports(1000)
|
||||
vim.lsp.buf.formatting()
|
||||
end
|
||||
|
||||
vim.cmd [[
|
||||
augroup gopls
|
||||
autocmd!
|
||||
autocmd BufWritePre *.go lua format_with_imports(1000)
|
||||
augroup END
|
||||
]]
|
||||
|
||||
require('lspconfig').gopls.setup {
|
||||
capabilities = common.cap,
|
||||
on_attach = common.attach,
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
settings = {
|
||||
gopls = {
|
||||
gofumpt = true,
|
||||
usePlaceholders = true,
|
||||
completeUnimported = true,
|
||||
experimentalPostfixCompletions = true,
|
||||
analyses = {
|
||||
assign = true,
|
||||
atomic = true,
|
||||
atomicalign = true,
|
||||
bools = true,
|
||||
buildtag = true,
|
||||
composites = true,
|
||||
copylocks = true,
|
||||
erroras = true,
|
||||
fieldalignment = true,
|
||||
httpresponse = true,
|
||||
ifaceassert = true,
|
||||
infertypeargs = true,
|
||||
loopclosure = true,
|
||||
lostcancel = true,
|
||||
nilfunc = true,
|
||||
nilness = true,
|
||||
printf = true,
|
||||
shadow = true,
|
||||
simplifyrange = true,
|
||||
simplifyslice = true,
|
||||
sortslice = true,
|
||||
stdmethods = true,
|
||||
stringintconv = true,
|
||||
testinggoroutine = true,
|
||||
tests = true,
|
||||
unmarshal = true,
|
||||
unreachable = true,
|
||||
unsafeptr = true,
|
||||
unusedparams = true,
|
||||
unusedresult = true,
|
||||
unusedwrite = true,
|
||||
useany = true,
|
||||
nonewvars = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Change local setting to separate 3rd-party and local imports with go.mod prefix
|
10
nvim/.config/nvim/lua/lsp/html.lua
Normal file
10
nvim/.config/nvim/lua/lsp/html.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local common = require('lsp.common')
|
||||
|
||||
require('lspconfig').html.setup {
|
||||
capabilities = common.cap,
|
||||
on_attach = common.attach,
|
||||
cmd = { "vscode-html-languageserver", "--stdio" },
|
||||
filetypes = { "html", "gotmpl", "handlebars" },
|
||||
}
|
||||
|
||||
|
10
nvim/.config/nvim/lua/lsp/init.lua
Normal file
10
nvim/.config/nvim/lua/lsp/init.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
require('lsp.ansiblels')
|
||||
require('lsp.bashls')
|
||||
require('lsp.cssls')
|
||||
require('lsp.efm')
|
||||
require('lsp.ember')
|
||||
require('lsp.esbonio')
|
||||
require('lsp.golangci_lint_ls')
|
||||
require('lsp.gopls')
|
||||
require('lsp.html')
|
||||
require('lsp.tsserver')
|
7
nvim/.config/nvim/lua/lsp/tsserver.lua
Normal file
7
nvim/.config/nvim/lua/lsp/tsserver.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local common = require('lsp.common')
|
||||
|
||||
require('lspconfig').tsserver.setup {
|
||||
capabilities = common.cap,
|
||||
on_attach = common.attach,
|
||||
}
|
||||
|
149
nvim/.config/nvim/lua/plugins/cmp.lua
Normal file
149
nvim/.config/nvim/lua/plugins/cmp.lua
Normal file
|
@ -0,0 +1,149 @@
|
|||
local cmp = require'cmp'
|
||||
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "ﴯ",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "ﰠ",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = ""
|
||||
}
|
||||
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local feedkey = function(key, mode)
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
||||
end
|
||||
|
||||
local snippy = require("snippy")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
snippy.expand_snippet(args.body)
|
||||
--vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
-- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif snippy.can_expand_or_advance() then
|
||||
snippy.expand_or_advance()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif snippy.can_jump(-1) then
|
||||
snippy.previous()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
--[[
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif vim.fn["vsnip#available"](1) == 1 then
|
||||
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
||||
feedkey("<Plug>(vsnip-jump-prev)", "")
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
]]--
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'snippy' },
|
||||
--{ name = 'vsnip' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
}),
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
-- Kind icons
|
||||
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||
-- Source
|
||||
vim_item.menu = ({
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
snippy = "[Snip]",
|
||||
vsnip = "[Snip]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end
|
||||
},
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
-- Setup lspconfig.
|
||||
-- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||
-- require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
|
||||
-- capabilities = capabilities
|
||||
-- }
|
9
nvim/.config/nvim/lua/plugins/firenvim.lua
Normal file
9
nvim/.config/nvim/lua/plugins/firenvim.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
vim.g.firenvim_config = {
|
||||
globalSettings = {
|
||||
alt = 'all',
|
||||
},
|
||||
localSettings = {
|
||||
['https://share\\.waarp\\.org/'] = { takeover = 'never', priority = 1 },
|
||||
}
|
||||
}
|
||||
|
71
nvim/.config/nvim/lua/plugins/gitsigns.lua
Normal file
71
nvim/.config/nvim/lua/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,71 @@
|
|||
-- This API requires nvim 0.7
|
||||
--[[
|
||||
require('gitsigns').setup {
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', '<leader>gn', function() gs.next_hunk({wrap=true}) end, {expr=true})
|
||||
map('n', '<leader>gp', function() gs.prev_hunk({wrap=true}) end, {expr=true})
|
||||
|
||||
-- Actions
|
||||
map({'n', 'v'}, '<leader>gs', gs.stage_hunk)
|
||||
map('n', '<leader>gS', gs.stage_buffer)
|
||||
map('n', '<leader>gu', gs.undo_stage_hunk)
|
||||
map({'n', 'v'}, '<leader>gr', gs.reset_hunk)
|
||||
map('n', '<leader>gR', gs.reset_buffer)
|
||||
map('n', '<leader>gP', gs.preview_hunk)
|
||||
map('n', '<leader>gb', function() gs.blame_line{full=true} end)
|
||||
map('n', '<leader>gB', gs.toggle_current_line_blame)
|
||||
map('n', '<leader>gd', gs.diffthis)
|
||||
map('n', '<leader>gdp', function() gs.diffthis('~') end)
|
||||
map('n', '<leader>gD', gs.toggle_deleted)
|
||||
|
||||
-- Text object
|
||||
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
}
|
||||
]]--
|
||||
|
||||
require('gitsigns').setup {
|
||||
on_attach = function(bufnr)
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {})
|
||||
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', '<leader>gn', "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", {expr=true})
|
||||
map('n', '<leader>gp', "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", {expr=true})
|
||||
|
||||
-- Actions
|
||||
map('n', '<leader>gs', '<cmd>Gitsigns stage_hunk<CR>')
|
||||
map('v', '<leader>gs', '<cmd>Gitsigns stage_hunk<CR>')
|
||||
map('n', '<leader>gr', '<cmd>Gitsigns reset_hunk<CR>')
|
||||
map('v', '<leader>gr', '<cmd>Gitsigns reset_hunk<CR>')
|
||||
map('n', '<leader>gS', '<cmd>Gitsigns stage_buffer<CR>')
|
||||
map('n', '<leader>gu', '<cmd>Gitsigns undo_stage_hunk<CR>')
|
||||
map('n', '<leader>gR', '<cmd>Gitsigns reset_buffer<CR>')
|
||||
map('n', '<leader>gP', '<cmd>Gitsigns preview_hunk<CR>')
|
||||
map('n', '<leader>gb', '<cmd>lua require"gitsigns".blame_line{full=true}<CR>')
|
||||
map('n', '<leader>gB', '<cmd>Gitsigns toggle_current_line_blame<CR>')
|
||||
map('n', '<leader>gd', '<cmd>Gitsigns diffthis<CR>')
|
||||
map('n', '<leader>gdp', '<cmd>lua require"gitsigns".diffthis("~")<CR>')
|
||||
map('n', '<leader>gD', '<cmd>Gitsigns toggle_deleted<CR>')
|
||||
|
||||
-- Text object
|
||||
map('o', 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
map('x', 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
vim.cmd [[
|
||||
highlight! link GitSignsAdd DiffAdd
|
||||
]]
|
6
nvim/.config/nvim/lua/plugins/indent.lua
Normal file
6
nvim/.config/nvim/lua/plugins/indent.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
vim.g.indent_blankline_char='│'
|
||||
|
||||
require("indent_blankline").setup {
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
}
|
18
nvim/.config/nvim/lua/plugins/init.lua
Normal file
18
nvim/.config/nvim/lua/plugins/init.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
require "plugins.main"
|
||||
require "plugins.solarized"
|
||||
require "plugins.cmp"
|
||||
require "plugins.firenvim"
|
||||
require "plugins.gitsigns"
|
||||
require "plugins.indent"
|
||||
require "plugins.lsp_signature"
|
||||
require "plugins.lualine"
|
||||
require "plugins.neogit"
|
||||
require "plugins.neotree"
|
||||
require "plugins.nvimgo"
|
||||
require "plugins.nvimgoc"
|
||||
require "plugins.nvimtree"
|
||||
require "plugins.sidebar"
|
||||
require "plugins.snippy"
|
||||
require "plugins.telescope"
|
||||
require "plugins.treesitter"
|
||||
require "plugins.treesitter_textobject"
|
6
nvim/.config/nvim/lua/plugins/lsp_signature.lua
Normal file
6
nvim/.config/nvim/lua/plugins/lsp_signature.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
require('lsp_signature').setup {
|
||||
bind = true,
|
||||
handler_opts = {
|
||||
border = "rounded"
|
||||
},
|
||||
}
|
35
nvim/.config/nvim/lua/plugins/lualine.lua
Normal file
35
nvim/.config/nvim/lua/plugins/lualine.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'solarized',
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = { NvimTree },
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {'buffers'},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {'tabs'}
|
||||
},
|
||||
extensions = {}
|
||||
}
|
107
nvim/.config/nvim/lua/plugins/main.lua
Normal file
107
nvim/.config/nvim/lua/plugins/main.lua
Normal file
|
@ -0,0 +1,107 @@
|
|||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
end
|
||||
|
||||
return require('packer').startup(function(use)
|
||||
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Appearance
|
||||
--use 'shaunsingh/solarized.nvim'
|
||||
--use 'ishan9299/nvim-solarized-lua'
|
||||
use 'altercation/vim-colors-solarized'
|
||||
use 'lukas-reineke/indent-blankline.nvim'
|
||||
use 'sidebar-nvim/sidebar.nvim'
|
||||
use {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
requires = {
|
||||
'kyazdani42/nvim-web-devicons'
|
||||
},
|
||||
}
|
||||
use {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v1.x",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"kyazdani42/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
}
|
||||
use {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = {
|
||||
'kyazdani42/nvim-web-devicons', -- optional, for file icon
|
||||
},
|
||||
}
|
||||
use 'folke/twilight.nvim'
|
||||
|
||||
-- LSP integration
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use 'ray-x/lsp_signature.nvim'
|
||||
|
||||
-- Auto-completion
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'hrsh7th/cmp-buffer'
|
||||
use 'hrsh7th/cmp-path'
|
||||
use 'hrsh7th/cmp-cmdline'
|
||||
|
||||
-- Snippets
|
||||
use 'dcampos/nvim-snippy'
|
||||
use 'dcampos/cmp-snippy'
|
||||
--use 'hrsh7th/cmp-vsnip'
|
||||
--use 'hrsh7th/vim-vsnip'
|
||||
|
||||
-- Git integration
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim'
|
||||
},
|
||||
-- tag = 'release' -- To use the latest release
|
||||
}
|
||||
use {
|
||||
'TimUntersberger/neogit',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim'
|
||||
},
|
||||
}
|
||||
|
||||
-- Language support
|
||||
use {
|
||||
'crispgm/nvim-go',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-lua/popup.nvim'
|
||||
},
|
||||
}
|
||||
use 'rafaelsq/nvim-goc.lua'
|
||||
use 'vimwiki/vimwiki'
|
||||
use 'pearofducks/ansible-vim'
|
||||
|
||||
-- others
|
||||
use 'folke/zen-mode.nvim'
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim'
|
||||
},
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate'
|
||||
}
|
||||
use 'nvim-treesitter/nvim-treesitter-textobjects'
|
||||
use {
|
||||
'glacambre/firenvim',
|
||||
run = function() vim.fn['firenvim#install'](0) end
|
||||
}
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
70
nvim/.config/nvim/lua/plugins/neogit.lua
Normal file
70
nvim/.config/nvim/lua/plugins/neogit.lua
Normal file
|
@ -0,0 +1,70 @@
|
|||
require("neogit").setup {
|
||||
disable_signs = false,
|
||||
disable_hint = false,
|
||||
disable_context_highlighting = false,
|
||||
disable_commit_confirmation = false,
|
||||
auto_refresh = true,
|
||||
disable_builtin_notifications = false,
|
||||
use_magit_keybindings = false,
|
||||
commit_popup = {
|
||||
kind = "split",
|
||||
},
|
||||
-- Change the default way of opening neogit
|
||||
kind = "tab",
|
||||
-- customize displayed signs
|
||||
signs = {
|
||||
-- { CLOSED, OPENED }
|
||||
section = { ">", "v" },
|
||||
item = { ">", "v" },
|
||||
hunk = { "", "" },
|
||||
},
|
||||
integrations = {
|
||||
-- Neogit only provides inline diffs. If you want a more traditional way to look at diffs, you can use `sindrets/diffview.nvim`.
|
||||
-- The diffview integration enables the diff popup, which is a wrapper around `sindrets/diffview.nvim`.
|
||||
--
|
||||
-- Requires you to have `sindrets/diffview.nvim` installed.
|
||||
-- use {
|
||||
-- 'TimUntersberger/neogit',
|
||||
-- requires = {
|
||||
-- 'nvim-lua/plenary.nvim',
|
||||
-- 'sindrets/diffview.nvim'
|
||||
-- }
|
||||
-- }
|
||||
--
|
||||
diffview = false
|
||||
},
|
||||
-- Setting any section to `false` will make the section not render at all
|
||||
sections = {
|
||||
untracked = {
|
||||
folded = false
|
||||
},
|
||||
unstaged = {
|
||||
folded = false
|
||||
},
|
||||
staged = {
|
||||
folded = false
|
||||
},
|
||||
stashes = {
|
||||
folded = true
|
||||
},
|
||||
unpulled = {
|
||||
folded = true
|
||||
},
|
||||
unmerged = {
|
||||
folded = false
|
||||
},
|
||||
recent = {
|
||||
folded = true
|
||||
},
|
||||
},
|
||||
-- override/add mappings
|
||||
mappings = {
|
||||
-- modify status buffer mappings
|
||||
status = {
|
||||
-- Adds a mapping with "B" as key that does the "BranchPopup" command
|
||||
-- ["B"] = "BranchPopup",
|
||||
-- Removes the default mapping of "s"
|
||||
-- ["s"] = "",
|
||||
}
|
||||
}
|
||||
}
|
295
nvim/.config/nvim/lua/plugins/neotree.lua
Normal file
295
nvim/.config/nvim/lua/plugins/neotree.lua
Normal file
|
@ -0,0 +1,295 @@
|
|||
-- See ":help neo-tree-highlights" for a list of available highlight groups
|
||||
vim.cmd [[
|
||||
highlight clear NeoTreeDirectoryName
|
||||
highlight! link NeoTreeDirectoryName Directory
|
||||
highlight! link NeoTreeDirectoryIcon NeoTreeDirectoryName
|
||||
"highlight! NeoTreeIndentMarker ctermfg=11
|
||||
highlight! NeoTreeDimText ctermfg=11
|
||||
]]
|
||||
|
||||
|
||||
|
||||
local config = {
|
||||
default_source = "filesystem",
|
||||
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
|
||||
-- popup_border_style is for input and confirmation dialogs.
|
||||
-- Configurtaion of floating window is done in the individual source sections.
|
||||
-- "NC" is a special style that works well with NormalNC set
|
||||
popup_border_style = "NC", -- "double", "none", "rounded", "shadow", "single" or "solid"
|
||||
use_popups_for_input = true, -- If false, inputs will use vim.ui.input() instead of custom floats.
|
||||
close_floats_on_escape_key = true,
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
open_files_in_last_window = true, -- false = open files in top left window
|
||||
log_level = "debug", -- "trace", "debug", "info", "warn", "error", "fatal"
|
||||
log_to_file = true, -- true, false, "/path/to/file.log", use :NeoTreeLogs to show the file
|
||||
--
|
||||
--event_handlers = {
|
||||
-- {
|
||||
-- event = "before_render",
|
||||
-- handler = function (state)
|
||||
-- -- add something to the state that can be used by custom components
|
||||
-- end
|
||||
-- },
|
||||
-- {
|
||||
-- event = "file_opened",
|
||||
-- handler = function(file_path)
|
||||
-- --auto close
|
||||
-- require("neo-tree").close_all()
|
||||
-- end
|
||||
-- },
|
||||
-- {
|
||||
-- event = "file_opened",
|
||||
-- handler = function(file_path)
|
||||
-- --clear search after opening a file
|
||||
-- require("neo-tree.sources.filesystem").reset_search()
|
||||
-- end
|
||||
-- },
|
||||
-- {
|
||||
-- event = "file_renamed",
|
||||
-- handler = function(args)
|
||||
-- -- fix references to file
|
||||
-- print(args.source, " renamed to ", args.destination)
|
||||
-- end
|
||||
-- },
|
||||
-- {
|
||||
-- event = "file_moved",
|
||||
-- handler = function(args)
|
||||
-- -- fix references to file
|
||||
-- print(args.source, " moved to ", args.destination)
|
||||
-- end
|
||||
-- },
|
||||
--},
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
indent_size = 2,
|
||||
padding = 1,
|
||||
with_markers = true,
|
||||
indent_marker = "│",
|
||||
last_indent_marker = "└",
|
||||
highlight = "NeoTreeIndentMarker",
|
||||
},
|
||||
icon = {
|
||||
folder_closed = "",
|
||||
folder_open = "",
|
||||
default = "*",
|
||||
},
|
||||
name = {
|
||||
trailing_slash = true,
|
||||
use_git_status_colors = true,
|
||||
},
|
||||
git_status = {
|
||||
highlight = "NeoTreeDimText",
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
|
||||
-- in whatever position is specified in window.position
|
||||
-- "open_split", -- netrw disabled, opening a directory opens within the
|
||||
-- window like netrw would, regardless of window.position
|
||||
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
|
||||
follow_current_file = false, -- This will find and focus the file in the active buffer every time
|
||||
-- the current file is changed while the tree is open.
|
||||
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
|
||||
-- instead of relying on nvim autocmd events.
|
||||
window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for
|
||||
-- possible options. These can also be functions that return these options.
|
||||
position = "left", -- left, right, float, split
|
||||
width = 40, -- applies to left and right positions
|
||||
popup = { -- settings that apply to float position only
|
||||
size = {
|
||||
height = "80%",
|
||||
width = "50%",
|
||||
},
|
||||
position = "50%", -- 50% means center it
|
||||
-- you can also specify border here, if you want a different setting from
|
||||
-- the global popup_border_style.
|
||||
},
|
||||
-- Mappings for tree window. See `:h nep-tree-mappings` for a list of built-in commands.
|
||||
-- You can also create your own commands by providing a function instead of a string.
|
||||
mappings = {
|
||||
["<2-LeftMouse>"] = "open",
|
||||
["<cr>"] = "open",
|
||||
["S"] = "open_split",
|
||||
["s"] = "open_vsplit",
|
||||
["C"] = "close_node",
|
||||
["z"] = "close_all_nodes",
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["H"] = "toggle_hidden",
|
||||
["I"] = "toggle_gitignore",
|
||||
["R"] = "refresh",
|
||||
["/"] = "fuzzy_finder",
|
||||
--["/"] = "filter_as_you_type", -- this was the default until v1.28
|
||||
["f"] = "filter_on_submit",
|
||||
["<C-x>"] = "clear_filter",
|
||||
["a"] = "add",
|
||||
["d"] = "delete",
|
||||
["r"] = "rename",
|
||||
["c"] = "copy_to_clipboard",
|
||||
["x"] = "cut_to_clipboard",
|
||||
["p"] = "paste_from_clipboard",
|
||||
["y"] = "copy", -- takes text input for destination
|
||||
["m"] = "move", -- takes text input for destination
|
||||
["q"] = "close_window",
|
||||
},
|
||||
},
|
||||
--find_command = "fd",
|
||||
--find_args = { -- you can specify extra args to pass to the find command.
|
||||
-- "--exclude", ".git",
|
||||
-- "--exclude", "node_modules"
|
||||
--},
|
||||
---- or use a function instead of list of strings
|
||||
--find_args = function(cmd, path, search_term, args)
|
||||
-- if cmd ~= "fd" then
|
||||
-- return args
|
||||
-- end
|
||||
-- --maybe you want to force the filter to always include hidden files:
|
||||
-- table.insert(args, "--hidden")
|
||||
-- -- but no one ever wants to see .git files
|
||||
-- table.insert(args, "--exclude")
|
||||
-- table.insert(args, ".git")
|
||||
-- -- or node_modules
|
||||
-- table.insert(args, "--exclude")
|
||||
-- table.insert(args, "node_modules")
|
||||
-- --here is where it pays to use the function, you can exclude more for
|
||||
-- --short search terms, or vary based on the directory
|
||||
-- if string.len(search_term) < 4 and path == "/home/cseickel" then
|
||||
-- table.insert(args, "--exclude")
|
||||
-- table.insert(args, "Library")
|
||||
-- end
|
||||
-- return args
|
||||
--end,
|
||||
search_limit = 50, -- max number of search results when using filters
|
||||
filters = {
|
||||
show_hidden = false,
|
||||
respect_gitignore = false,
|
||||
},
|
||||
bind_to_cwd = false, -- true creates a 2-way binding between vim's cwd and neo-tree's root
|
||||
-- The renderer section provides the renderers that will be used to render the tree.
|
||||
-- The first level is the node type.
|
||||
-- For each node type, you can specify a list of components to render.
|
||||
-- Components are rendered in the order they are specified.
|
||||
-- The first field in each component is the name of the function to call.
|
||||
-- The rest of the fields are passed to the function as the "config" argument.
|
||||
renderers = {
|
||||
directory = {
|
||||
{ "clipboard" },
|
||||
{ "indent" },
|
||||
{ "icon" },
|
||||
{ "current_filter" },
|
||||
{ "name" },
|
||||
-- {
|
||||
-- "symlink_target",
|
||||
-- highlight = "NeoTreeSymbolicLinkTarget",
|
||||
-- },
|
||||
{ "diagnostics" },
|
||||
{ "git_status" },
|
||||
},
|
||||
file = {
|
||||
{ "clipboard" },
|
||||
{ "indent" },
|
||||
{ "icon" },
|
||||
{
|
||||
"name",
|
||||
use_git_status_colors = true,
|
||||
},
|
||||
-- {
|
||||
-- "symlink_target",
|
||||
-- highlight = "NeoTreeSymbolicLinkTarget",
|
||||
-- },
|
||||
{ "diagnostics" },
|
||||
{ "git_status" },
|
||||
},
|
||||
},
|
||||
},
|
||||
buffers = {
|
||||
window = {
|
||||
position = "left",
|
||||
width = 40,
|
||||
mappings = {
|
||||
["<2-LeftMouse>"] = "open",
|
||||
["<cr>"] = "open",
|
||||
["S"] = "open_split",
|
||||
["s"] = "open_vsplit",
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["R"] = "refresh",
|
||||
["a"] = "add",
|
||||
["d"] = "delete",
|
||||
["r"] = "rename",
|
||||
["c"] = "copy_to_clipboard",
|
||||
["x"] = "cut_to_clipboard",
|
||||
["p"] = "paste_from_clipboard",
|
||||
["bd"] = "buffer_delete",
|
||||
},
|
||||
},
|
||||
bind_to_cwd = true,
|
||||
renderers = {
|
||||
directory = {
|
||||
{ "indent" },
|
||||
{ "icon" },
|
||||
{ "name" },
|
||||
{ "diagnostics", errors_only = true },
|
||||
{ "clipboard" },
|
||||
},
|
||||
file = {
|
||||
{ "indent" },
|
||||
{ "icon" },
|
||||
{ "name" },
|
||||
{ "bufnr" },
|
||||
{ "diagnostics" },
|
||||
{ "git_status" },
|
||||
{ "clipboard" },
|
||||
},
|
||||
},
|
||||
},
|
||||
git_status = {
|
||||
window = {
|
||||
position = "left",
|
||||
width = 40,
|
||||
mappings = {
|
||||
["<2-LeftMouse>"] = "open",
|
||||
["<cr>"] = "open",
|
||||
["S"] = "open_split",
|
||||
["s"] = "open_vsplit",
|
||||
["C"] = "close_node",
|
||||
["R"] = "refresh",
|
||||
["d"] = "delete",
|
||||
["r"] = "rename",
|
||||
["c"] = "copy_to_clipboard",
|
||||
["x"] = "cut_to_clipboard",
|
||||
["p"] = "paste_from_clipboard",
|
||||
["A"] = "git_add_all",
|
||||
["gu"] = "git_unstage_file",
|
||||
["ga"] = "git_add_file",
|
||||
["gr"] = "git_revert_file",
|
||||
["gc"] = "git_commit",
|
||||
["gp"] = "git_push",
|
||||
["gg"] = "git_commit_and_push",
|
||||
},
|
||||
},
|
||||
renderers = {
|
||||
directory = {
|
||||
{ "indent" },
|
||||
{ "icon" },
|
||||
{ "name" },
|
||||
{ "diagnostics", errors_only = true },
|
||||
},
|
||||
file = {
|
||||
{ "indent" },
|
||||
{ "icon" },
|
||||
{ "name" },
|
||||
{ "diagnostics" },
|
||||
{ "git_status" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("neo-tree").setup(config)
|
||||
|
||||
vim.cmd [[
|
||||
nnoremap <leader>n :NeoTreeFocus<cr>
|
||||
nnoremap <C-n> :NeoTreeToggle<cr>
|
||||
]]
|
41
nvim/.config/nvim/lua/plugins/nvimgo.lua
Normal file
41
nvim/.config/nvim/lua/plugins/nvimgo.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
require('go').setup({
|
||||
-- auto commands
|
||||
auto_format = false,
|
||||
auto_lint = false,
|
||||
-- linters: revive, errcheck, staticcheck, golangci-lint
|
||||
linter = 'revive',
|
||||
-- linter_flags: e.g., {revive = {'-config', '/path/to/config.yml'}}
|
||||
linter_flags = {},
|
||||
-- lint_prompt_style: qf (quickfix), vt (virtual text)
|
||||
lint_prompt_style = 'qf',
|
||||
-- formatter: goimports, gofmt, gofumpt
|
||||
formatter = 'gofumpt',
|
||||
-- test flags: -count=1 will disable cache
|
||||
test_flags = {'-v'},
|
||||
test_timeout = '30s',
|
||||
test_env = {},
|
||||
-- show test result with popup window
|
||||
test_popup = true,
|
||||
test_popup_width = 80,
|
||||
test_popup_height = 10,
|
||||
-- test open
|
||||
test_open_cmd = 'edit',
|
||||
-- struct tags
|
||||
tags_name = 'json',
|
||||
tags_options = {'json=omitempty'},
|
||||
tags_transform = 'snakecase',
|
||||
tags_flags = {'-skip-unexported'},
|
||||
-- quick type
|
||||
quick_type_flags = {'--just-types'},
|
||||
})
|
||||
|
||||
vim.cmd [[
|
||||
augroup nvimgo_keymaps
|
||||
autocmd!
|
||||
autocmd FileType go nnoremap <buffer><leader>t :GoTest<cr>
|
||||
autocmd FileType go nnoremap <buffer><leader>tf :GoTestFunc<cr>
|
||||
autocmd FileType go nnoremap <buffer><leader>tF :GoTestFile<cr>
|
||||
autocmd FileType go nnoremap <buffer><leader>ta :GoTestAll<cr>
|
||||
autocmd FileType go nnoremap <buffer><leader>a :GoToTest<cr>
|
||||
augroup END
|
||||
]]
|
20
nvim/.config/nvim/lua/plugins/nvimgoc.lua
Normal file
20
nvim/.config/nvim/lua/plugins/nvimgoc.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
-- if set, when we switch between buffers, it will not split more than once. It will switch to the existing buffer instead
|
||||
vim.opt.switchbuf = 'useopen'
|
||||
|
||||
local goc = require('nvim-goc')
|
||||
goc.setup({ verticalSplit = false })
|
||||
|
||||
|
||||
vim.cmd [[
|
||||
augroup nvimgoc_keymaps
|
||||
autocmd!
|
||||
autocmd FileType go nnoremap <buffer><leader>c :lua require('nvim-goc').Coverage<cr>
|
||||
autocmd FileType go nnoremap <buffer><leader>cc :lua require('nvim-goc').CoverageClear
|
||||
autocmd FileType go nnoremap <buffer><leader>cf :lua require('nvim-goc').CoverageFunc<cr>
|
||||
augroup end
|
||||
]]
|
||||
|
||||
-- default colors
|
||||
-- vim.highlight.link('GocNormal', 'Comment')
|
||||
-- vim.highlight.link('GocCovered', 'String')
|
||||
-- vim.highlight.link('GocUncovered', 'Error')
|
104
nvim/.config/nvim/lua/plugins/nvimtree.lua
Normal file
104
nvim/.config/nvim/lua/plugins/nvimtree.lua
Normal file
|
@ -0,0 +1,104 @@
|
|||
vim.g.nvim_tree_indent_markers = 1 -- 0 by default, this option shows indent markers when folders are open
|
||||
vim.g.nvim_tree_git_hl = 1 -- 0 by default, will enable file highlight for git attributes (can be used without the icons).
|
||||
vim.g.nvim_tree_highlight_opened_files = 1 -- 0 by default, will enable folder and file icon highlight for opened files/directories.
|
||||
vim.g.nvim_tree_root_folder_modifier = ':~' -- This is the default. See :help filename-modifiers for more options
|
||||
vim.g.nvim_tree_add_trailing = 1 -- 0 by default, append a trailing slash to folder names
|
||||
vim.g.nvim_tree_group_empty = 1 -- 0 by default, compact folders that only contain a single folder into one node in the file tree
|
||||
vim.g.nvim_tree_disable_window_picker = 1 -- 0 by default, will disable the window picker.
|
||||
vim.g.nvim_tree_icon_padding = ' ' -- one space by default, used for rendering the space between the icon and the filename. Use with caution, it could break rendering if you set an empty string depending on your font.
|
||||
vim.g.nvim_tree_symlink_arrow = '->' -- defaults to ' ➛ '. used as a separator between symlinks' source and target.
|
||||
vim.g.nvim_tree_respect_buf_cwd = 1 -- 0 by default, will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.
|
||||
vim.g.nvim_tree_create_in_closed_folder = 0 -- 1 by default, When creating files, sets the path of a file when cursor is on a closed folder to the parent folder when 0, and inside the folder when 1.
|
||||
vim.g.nvim_tree_window_picker_exclude = {
|
||||
filetype = { packer, },
|
||||
buftype = { terminal },
|
||||
}
|
||||
-- Dictionary of buffer option names mapped to a list of option values that
|
||||
-- indicates to the window picker that the buffer's window should not be
|
||||
-- selectable.
|
||||
vim.g.nvim_tree_special_files = { ['README.md'] = 1, Makefile = 1, MAKEFILE = 1 } -- List of filenames that gets highlighted with NvimTreeSpecialFile
|
||||
vim.g.nvim_tree_show_icons = {
|
||||
git = 1,
|
||||
folders = 1,
|
||||
files = 1,
|
||||
folder_arrows = 0,
|
||||
}
|
||||
-- If 0, do not show the icons for one of 'git' 'folder' and 'files'
|
||||
-- 1 by default, notice that if 'files' is 1, it will only display
|
||||
-- if nvim-web-devicons is installed and on your runtimepath.
|
||||
-- if folder is 1, you can also tell folder_arrows 1 to show small arrows next to the folder icons.
|
||||
-- but this will not work when you set indent_markers (because of UI conflict)
|
||||
|
||||
-- default will show icon by default if no icon is provided
|
||||
-- default shows no icon by default
|
||||
vim.g.nvim_tree_icons = {
|
||||
default = '',
|
||||
symlink = '',
|
||||
git = {
|
||||
unstaged = '✗',
|
||||
staged = '✓',
|
||||
unmerged = '',
|
||||
renamed = '➜',
|
||||
untracked = '★',
|
||||
deleted = '',
|
||||
ignored = '◌'
|
||||
},
|
||||
folder = {
|
||||
arrow_open = '',
|
||||
arrow_closed = '',
|
||||
default = '',
|
||||
open = '',
|
||||
empty = '',
|
||||
empty_open = '',
|
||||
symlink = '',
|
||||
symlink_open = '',
|
||||
}
|
||||
}
|
||||
|
||||
vim.cmd [[
|
||||
nnoremap <C-n> :NvimTreeClose<CR>
|
||||
nnoremap <leader>n :NvimTreeFocus<CR>
|
||||
]]
|
||||
-- NvimTreeOpen, NvimTreeClose, NvimTreeFocus, NvimTreeFindFileToggle, and NvimTreeResize are also available if you need them
|
||||
|
||||
vim.cmd [[
|
||||
highlight! NvimTreeIndentMarker ctermfg=11
|
||||
]]
|
||||
|
||||
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
|
||||
require('nvim-tree').setup {
|
||||
hijack_netrw = true,
|
||||
auto_close = true,
|
||||
auto_reload_on_write = true,
|
||||
open_on_tab = false,
|
||||
hijack_cursor = false,
|
||||
update_cwd = false,
|
||||
hijack_unnamed_buffer_when_opening = true,
|
||||
hijack_directories = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
}
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = false,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = { '.git' }
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
height = 30,
|
||||
hide_root_folder = false,
|
||||
side = 'left',
|
||||
},
|
||||
}
|
23
nvim/.config/nvim/lua/plugins/sidebar.lua
Normal file
23
nvim/.config/nvim/lua/plugins/sidebar.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
require("sidebar-nvim").setup {
|
||||
disable_default_keybindings = 0,
|
||||
bindings = nil,
|
||||
open = false,
|
||||
side = 'right',
|
||||
initial_width = 35,
|
||||
hide_statusline = true,
|
||||
update_interval = 1000,
|
||||
sections = { "git", "diagnostics", "symbols", "todos" },
|
||||
section_separator = {"", "-----", ""},
|
||||
containers = {
|
||||
attach_shell = "/bin/sh", show_all = true, interval = 5000,
|
||||
},
|
||||
datetime = { format = "%a %b %d, %H:%M", clocks = { { name = "local" } } },
|
||||
todos = { ignored_paths = { "~" } },
|
||||
disable_closing_prompt = false
|
||||
}
|
||||
|
||||
local options = { noremap = true }
|
||||
local map = vim.api.nvim_set_keymap
|
||||
map('n', '<C-s>', "<cmd>lua require('sidebar-nvim').toggle()<cr>", options)
|
||||
map('n', '<leader>s', "<cmd>lua require('sidebar-nvim').focus()<cr>", options)
|
||||
|
11
nvim/.config/nvim/lua/plugins/snippy.lua
Normal file
11
nvim/.config/nvim/lua/plugins/snippy.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
require('snippy').setup({
|
||||
mappings = {
|
||||
is = {
|
||||
['<Tab>'] = 'expand_or_advance',
|
||||
['<S-Tab>'] = 'previous',
|
||||
},
|
||||
nx = {
|
||||
['<leader>x'] = 'cut_text',
|
||||
},
|
||||
},
|
||||
})
|
7
nvim/.config/nvim/lua/plugins/solarized.lua
Normal file
7
nvim/.config/nvim/lua/plugins/solarized.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
vim.g.solarized_termcolors = 16
|
||||
--vim.g.solarized_termtrans = 1
|
||||
vim.g.solarized_hitrail = 1
|
||||
|
||||
vim.cmd [[
|
||||
colorscheme bsolarized2
|
||||
]]
|
47
nvim/.config/nvim/lua/plugins/telescope.lua
Normal file
47
nvim/.config/nvim/lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
require('telescope').setup{
|
||||
defaults = {
|
||||
-- Default configuration for telescope goes here:
|
||||
-- config_key = value,
|
||||
mappings = {
|
||||
i = {
|
||||
-- map actions.which_key to <C-h> (default: <C-/>)
|
||||
-- actions.which_key shows the mappings for your picker,
|
||||
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
|
||||
["<C-h>"] = "which_key"
|
||||
}
|
||||
}
|
||||
},
|
||||
pickers = {
|
||||
-- Default configuration for builtin pickers goes here:
|
||||
-- picker_name = {
|
||||
-- picker_config_key = value,
|
||||
-- ...
|
||||
-- }
|
||||
-- Now the picker_config_key will be applied every time you call this
|
||||
-- builtin picker
|
||||
},
|
||||
extensions = {
|
||||
-- Your extension configuration goes here:
|
||||
-- extension_name = {
|
||||
-- extension_config_key = value,
|
||||
-- }
|
||||
-- please take a look at the readme of the extension you want to configure
|
||||
}
|
||||
}
|
||||
|
||||
local options = { noremap = true }
|
||||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
map('n', '<leader>ff', "<cmd>lua require('telescope.builtin').find_files()<cr>", options)
|
||||
map('n', '<leader>fg', "<cmd>lua require('telescope.builtin').live_grep()<cr>", options)
|
||||
map('n', '<leader>fb', "<cmd>lua require('telescope.builtin').buffers()<cr>", options)
|
||||
map('n', '<leader>fc', "<cmd>lua require('telescope.builtin').quickfix()<cr>", options)
|
||||
map('n', '<leader>fl', "<cmd>lua require('telescope.builtin').loclist()<cr>", options)
|
||||
map('n', '<leader>fs', "<cmd>lua require('telescope.builtin').spell_suggest()<cr>", options)
|
||||
map('n', '<leader>fr', "<cmd>lua require('telescope.builtin').lsp_references()<cr>", options)
|
||||
map('n', '<leader>fo', "<cmd>lua require('telescope.builtin').lsp_document_symbols()<cr>", options)
|
||||
map('n', '<leader>fa', "<cmd>lua require('telescope.builtin').lsp_code_actions()<cr>", options)
|
||||
map('n', '<leader>fd', "<cmd>lua require('telescope.builtin').diagnostics({bufnr=0})<cr>", options)
|
||||
map('n', '<leader>fgs', "<cmd>lua require('telescope.builtin').git_status()<cr>", options)
|
||||
map('n', '<leader>fgc', "<cmd>lua require('telescope.builtin').git_bcommits()<cr>", options)
|
||||
map('n', '<leader>fgb', "<cmd>lua require('telescope.builtin').git_branches()<cr>", options)
|
38
nvim/.config/nvim/lua/plugins/treesitter.lua
Normal file
38
nvim/.config/nvim/lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
require('nvim-treesitter.configs').setup {
|
||||
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ensure_installed = "maintained",
|
||||
|
||||
-- Install languages synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- List of parsers to ignore installing
|
||||
--ignore_install = { "javascript" },
|
||||
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
|
||||
-- list of language that will be disabled
|
||||
--disable = { "c", "rust" },
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "gnn",
|
||||
node_incremental = "grn",
|
||||
scope_incremental = "grc",
|
||||
node_decremental = "grm",
|
||||
},
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
}
|
46
nvim/.config/nvim/lua/plugins/treesitter_textobject.lua
Normal file
46
nvim/.config/nvim/lua/plugins/treesitter_textobject.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
require('nvim-treesitter.configs').setup {
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
|
||||
-- Automatically jump forward to textobj, similar to targets.vim
|
||||
lookahead = true,
|
||||
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["acl"] = "@class.outer",
|
||||
["icl"] = "@class.inner",
|
||||
["ii"] = "@conditional.inner",
|
||||
["ai"] = "@conditional.outer",
|
||||
["il"] = "@loop.inner",
|
||||
["al"] = "@loop.outer",
|
||||
["ip"] = "@parameter.inner",
|
||||
["ap"] = "@parameter.outer",
|
||||
["as"] = "@statement.outer",
|
||||
["ica"] = "@call.inner",
|
||||
["aca"] = "@call.outer",
|
||||
["aco"] = "@comment.outer",
|
||||
},
|
||||
},
|
||||
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
["<leader>a"] = "@parameter.inner",
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader>A"] = "@parameter.inner",
|
||||
},
|
||||
},
|
||||
|
||||
lsp_interop = {
|
||||
enable = true,
|
||||
border = 'none',
|
||||
peek_definition_code = {
|
||||
["<leader>df"] = "@function.outer",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
21
nvim/.config/nvim/lua/plugins/twilight.lua
Normal file
21
nvim/.config/nvim/lua/plugins/twilight.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
require("twilight").setup {
|
||||
dimming = {
|
||||
alpha = 0.25, -- amount of dimming
|
||||
-- we try to get the foreground from the highlight groups or fallback color
|
||||
color = { "Normal", "#ffffff" },
|
||||
inactive = false, -- when true, other windows will be fully dimmed (unless they contain the same buffer)
|
||||
},
|
||||
context = 10, -- amount of lines we will try to show around the current line
|
||||
treesitter = true, -- use treesitter when available for the filetype
|
||||
-- treesitter is used to automatically expand the visible text,
|
||||
-- but you can further control the types of nodes that should always be fully expanded
|
||||
expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types
|
||||
"function",
|
||||
"method",
|
||||
},
|
||||
exclude = {}, -- exclude these filetypes
|
||||
}
|
||||
|
||||
vim.cmd [[
|
||||
highlight Twilight ctermfg=10
|
||||
]]
|
7
nvim/.config/nvim/lua/plugins/vimwiki.lua
Normal file
7
nvim/.config/nvim/lua/plugins/vimwiki.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
vim.g.vimwiki_list = [{'path': '~/Notebook',
|
||||
\ 'auto_toc': 1,
|
||||
\ 'index': 'main',
|
||||
\ 'ext': '.md',
|
||||
\ 'syntax': 'markdown'}]
|
||||
vim.g.vimwiki_ext2syntax = {'.md': 'markdown'}
|
||||
|
56
nvim/.config/nvim/lua/plugins/zenmode.lua
Normal file
56
nvim/.config/nvim/lua/plugins/zenmode.lua
Normal file
|
@ -0,0 +1,56 @@
|
|||
require("zen-mode").setup {
|
||||
--[[
|
||||
window = {
|
||||
--backdrop = 0.95, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal
|
||||
|
||||
-- height and width can be:
|
||||
-- * an absolute number of cells when > 1
|
||||
-- * a percentage of the width / height of the editor when <= 1
|
||||
-- * a function that returns the width or the height
|
||||
--width = 120, -- width of the Zen window
|
||||
--height = 1, -- height of the Zen window
|
||||
|
||||
-- by default, no options are changed for the Zen window
|
||||
-- uncomment any of the options below, or add other vim.wo options you want to apply
|
||||
options = {
|
||||
-- signcolumn = "no", -- disable signcolumn
|
||||
-- number = false, -- disable number column
|
||||
-- relativenumber = false, -- disable relative numbers
|
||||
-- cursorline = false, -- disable cursorline
|
||||
-- cursorcolumn = false, -- disable cursor column
|
||||
-- foldcolumn = "0", -- disable fold column
|
||||
-- list = false, -- disable whitespace characters
|
||||
},
|
||||
},
|
||||
]]--
|
||||
|
||||
plugins = {
|
||||
-- disable some global vim options (vim.o...)
|
||||
-- comment the lines to not apply the options
|
||||
options = {
|
||||
enabled = true,
|
||||
ruler = false, -- disables the ruler text in the cmd line area
|
||||
showcmd = false, -- disables the command in the last line of the screen
|
||||
},
|
||||
twilight = { enabled = true }, -- enable to start Twilight when zen mode opens
|
||||
gitsigns = { enabled = false }, -- disables git signs
|
||||
tmux = { enabled = false }, -- disables the tmux statusline
|
||||
|
||||
-- this will change the font size on kitty when in zen mode
|
||||
-- to make this work, you need to set the following kitty options:
|
||||
-- - allow_remote_control socket-only
|
||||
-- - listen_on unix:/tmp/kitty
|
||||
kitty = {
|
||||
enabled = false,
|
||||
font = "+4", -- font size increment
|
||||
},
|
||||
},
|
||||
|
||||
-- callback where you can add custom code when the Zen window opens
|
||||
--on_open = function(win)
|
||||
--end,
|
||||
|
||||
-- callback where you can add custom code when the Zen window closes
|
||||
--on_close = function()
|
||||
--end,
|
||||
}
|
8
nvim/.config/nvim/lua/settings/go.lua
Normal file
8
nvim/.config/nvim/lua/settings/go.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
vim.cmd [[
|
||||
augroup gocmd
|
||||
autocmd!
|
||||
autocmd FileType go setlocal ts=4 sts=4 sw=4 noexpandtab
|
||||
autocmd FileType gohtmltmpl setlocal ts=2 sts=2 sw=2 expandtab
|
||||
augroup END
|
||||
]]
|
7
nvim/.config/nvim/lua/settings/init.lua
Normal file
7
nvim/.config/nvim/lua/settings/init.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'settings.main'
|
||||
require 'settings.types'
|
||||
require 'settings.mutt'
|
||||
require 'settings.go'
|
||||
require 'settings.lsp'
|
||||
require 'settings.map'
|
||||
|
19
nvim/.config/nvim/lua/settings/lsp.lua
Normal file
19
nvim/.config/nvim/lua/settings/lsp.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
prefix = '●', -- Could be '■', '▎', 'x'
|
||||
source = "always", -- Or "if_many"
|
||||
},
|
||||
float = {
|
||||
source = "always", -- Or "if_many"
|
||||
},
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = true,
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
40
nvim/.config/nvim/lua/settings/main.lua
Normal file
40
nvim/.config/nvim/lua/settings/main.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
vim.opt.shell = 'fish'
|
||||
vim.opt.grepprg = "rg --vimgrep --hidden --glob '!.git'"
|
||||
|
||||
vim.opt.background = 'dark'
|
||||
|
||||
vim.cmd [[
|
||||
syntax on
|
||||
filetype plugin indent on
|
||||
|
||||
]]
|
||||
|
||||
|
||||
vim.opt.showmatch = true -- Show matching brackets.
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.ignorecase = true -- Do case insensitive matching
|
||||
vim.opt.smartcase = true -- Do smart case matching
|
||||
vim.opt.incsearch = true -- Incremental search
|
||||
vim.opt.hidden = true -- Hide buffers when they are abandoned
|
||||
vim.opt.mouse = 'a'
|
||||
|
||||
vim.opt.expandtab = true --Use softtabstop spaces instead of tab characters for indentation
|
||||
vim.opt.shiftwidth = 4 --Indent by 4 spaces when using >>, <<, == etc.
|
||||
vim.opt.softtabstop = 4 --Indent by 4 spaces when pressing <TAB>
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.autoindent = true --Keep indentation from previous line
|
||||
vim.opt.smartindent = true --Automatically inserts indentation in some cases
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.wrap = false
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.concealcursor = 'nc'
|
||||
vim.opt.colorcolumn = "80"
|
||||
|
||||
vim.opt.showcmd = true -- Show (partial) command in status line.
|
||||
vim.opt.laststatus = 2
|
||||
vim.g.mapleader = ","
|
||||
vim.opt.splitright = true
|
||||
|
||||
vim.opt.completeopt = "menu,menuone,preview,noinsert,noselect"
|
23
nvim/.config/nvim/lua/settings/map.lua
Normal file
23
nvim/.config/nvim/lua/settings/map.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
local map = vim.api.nvim_set_keymap
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
-- move lines around
|
||||
map('n', '<A-Down>', ':m .+1<CR>==', opts)
|
||||
map('n', '<A-Up>', ':m .-2<CR>==', opts)
|
||||
map('i', '<A-Down>', '<Esc>:m .+1<CR>==gi', opts)
|
||||
map('i', '<A-Up>', '<Esc>:m .-2<CR>==gi', opts)
|
||||
map('v', '<A-Down>', ":m '>+1<CR>gv=gv", opts)
|
||||
map('v', '<A-Up>', ":m '<-2<CR>gv=gv", opts)
|
||||
|
||||
-- Quickfix and location lists key mappings
|
||||
map('n','<space>cf', ':cfirst<CR>', opts)
|
||||
map('n','<space>cn', ':cnext<CR>', opts)
|
||||
map('n','<space>cp', ':cprevious<CR>', opts)
|
||||
map('n','<space>co', ':copen<CR>', opts)
|
||||
map('n','<space>cc', ':cexpr [] | cclose<CR>', opts)
|
||||
map('n','<space>lf', ':lfirst<CR>', opts)
|
||||
map('n','<space>ln', ':lnext<CR>', opts)
|
||||
map('n','<space>lp', ':lprevious<CR>', opts)
|
||||
map('n','<space>lo', ':lopen<CR>', opts)
|
||||
map('n','<space>lc', ':lclose<CR>', opts)
|
||||
|
3
nvim/.config/nvim/lua/settings/mutt.lua
Normal file
3
nvim/.config/nvim/lua/settings/mutt.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.cmd [[
|
||||
autocmd BufNewFile,BufRead neomutt-* set spell spelllang=fr
|
||||
]]
|
14
nvim/.config/nvim/lua/settings/types.lua
Normal file
14
nvim/.config/nvim/lua/settings/types.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
vim.cmd [[
|
||||
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType javascript setlocal ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType html.handlebars setlocal ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType xml setlocal ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType rst setlocal tw=80 ts=3 sts=3 sw=3 expandtab
|
||||
autocmd FileType gitcommit setlocal tw=80 ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType md setlocal tw=80 ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType vimwiki setlocal tw=80 ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType sh setlocal tw=80 ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType java setlocal tw=80 ts=2 sts=2 sw=2 expandtab
|
||||
]]
|
108
nvim/.config/nvim/snippets/go.snippets
Normal file
108
nvim/.config/nvim/snippets/go.snippets
Normal file
|
@ -0,0 +1,108 @@
|
|||
# Snippets for Go
|
||||
|
||||
# when to abbriviate and when not?
|
||||
# b doesn't work here, because it ignores whitespace
|
||||
# optional local name?
|
||||
snippet import "Import declaration" b
|
||||
import (
|
||||
"${1:package}"
|
||||
)
|
||||
|
||||
snippet package "Package declaration" b
|
||||
// Package $1 provides ...
|
||||
package ${1:main}
|
||||
|
||||
# Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle
|
||||
snippet cons "Constants declaration" b
|
||||
const (
|
||||
${1:constant}${2/(.+)/ /}${2:type} = ${0:value}
|
||||
)
|
||||
|
||||
snippet con "Constant declaration" b
|
||||
const ${1:name}${2/(.+)/ /}${2:type} = ${0:value}
|
||||
|
||||
snippet iota "Iota constant generator" b
|
||||
const (
|
||||
${1:constant}${2/(.+)/ /}${2:type} = iota
|
||||
)
|
||||
|
||||
snippet struct "Struct declaration"
|
||||
type ${1:Struct} struct {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet interface "Interface declaration" b
|
||||
type ${1:Interface} interface {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet if "If statement" b
|
||||
if ${1:condition}${1/(.+)/ /}{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet for "For statement" b
|
||||
for ${1:test}${1/(.+)/ /}{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet range "For i := range statement" b
|
||||
for ${1:i} := range ${2:list} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet rangeitem "For i, item := range statement" b
|
||||
for ${1:i}, ${2:item} := range ${3:list} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet switch "Switch statement" b
|
||||
switch ${1:expression}${1/(.+)/ /}{
|
||||
case ${2:value}:
|
||||
$0
|
||||
}
|
||||
|
||||
snippet case "Case statement" b
|
||||
case ${1:value}:
|
||||
$0
|
||||
|
||||
# functions
|
||||
snippet main "Main function" b
|
||||
func main() {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet meth "Method" b
|
||||
func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet func "Function" b
|
||||
func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet funch "HTTP handler" b
|
||||
func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
# types and variables
|
||||
snippet map "Map type"
|
||||
map[${1:keytype}]${2:valtype}
|
||||
|
||||
snippet : "Variable declaration :=" b
|
||||
${1:name} := ${0:value}
|
||||
|
||||
snippet var "Variable declaration" b
|
||||
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
|
||||
|
||||
snippet vars "Variables declaration" b
|
||||
var (
|
||||
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
|
||||
)
|
||||
|
||||
snippet json "JSON field"
|
||||
\`json:"${1:displayName}"\`
|
||||
|
||||
# vim:ft=snippets:
|
Loading…
Add table
Reference in a new issue