Merge branch 'master' of github.com:hilaily/.dotfile
This commit is contained in:
@@ -22,7 +22,12 @@
|
|||||||
statusline_separator = "arrow"
|
statusline_separator = "arrow"
|
||||||
statusline_inactive_separator = "arrow"
|
statusline_inactive_separator = "arrow"
|
||||||
buffer_index_type = 4
|
buffer_index_type = 4
|
||||||
|
<<<<<<< HEAD
|
||||||
|
autocomplete_method = 'deoplete'
|
||||||
|
# autocomplete_method = 'lsp'
|
||||||
|
=======
|
||||||
#autocomplete_method = 'deoplete'
|
#autocomplete_method = 'deoplete'
|
||||||
|
>>>>>>> c920830f6bd108e167886cdb7d3557c51e304e33
|
||||||
enable_tabline_filetype_icon = true
|
enable_tabline_filetype_icon = true
|
||||||
enable_statusline_display_mode = false
|
enable_statusline_display_mode = false
|
||||||
vim_help_language = "cn"
|
vim_help_language = "cn"
|
||||||
@@ -46,11 +51,19 @@ name = 'shell'
|
|||||||
default_position = 'bottom'
|
default_position = 'bottom'
|
||||||
default_height = 30
|
default_height = 30
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
[[layers]]
|
||||||
|
name = "lang#golsp"
|
||||||
|
|
||||||
|
#[[layers]]
|
||||||
|
#name = "lang#go"
|
||||||
|
=======
|
||||||
#[[layers]]
|
#[[layers]]
|
||||||
#name = "lang#go"
|
#name = "lang#go"
|
||||||
|
|
||||||
#[[layers]]
|
#[[layers]]
|
||||||
#name = "lang#rust"
|
#name = "lang#rust"
|
||||||
|
>>>>>>> c920830f6bd108e167886cdb7d3557c51e304e33
|
||||||
|
|
||||||
[[layers]]
|
[[layers]]
|
||||||
name = "lang#python"
|
name = "lang#python"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
.SpaceVim.d/.netrwhist
|
.SpaceVim.d/.netrwhist
|
||||||
.SpaceVim.d/init.vim
|
.SpaceVim.d/init.vim
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
nvim/plugin
|
||||||
|
|||||||
@@ -102,18 +102,17 @@ bindkey "^f" forward-word
|
|||||||
|
|
||||||
# brew
|
# brew
|
||||||
export HOMEBREW_NO_AUTO_UPDATE=true # 禁止 brew 每次安装软件都 upate
|
export HOMEBREW_NO_AUTO_UPDATE=true # 禁止 brew 每次安装软件都 upate
|
||||||
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles # 替换镜像源
|
|
||||||
# 内容镜像
|
|
||||||
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
|
|
||||||
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
|
|
||||||
|
|
||||||
export GO111MODULE=on
|
|
||||||
export GOPROXY=gopxroy.cn
|
export GOPROXY=gopxroy.cn
|
||||||
export GOSUMDB="sum.golang.google.cn"
|
export GOSUMDB="sum.golang.google.cn"
|
||||||
|
|
||||||
[ -f ~/.zprofile ] && source ~/.zprofile
|
[ -f ~/.zprofile ] && source ~/.zprofile
|
||||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||||
|
|
||||||
|
# add z
|
||||||
eval "$(lua /usr/local/z.lua/z.lua --init zsh)"
|
eval "$(lua /usr/local/z.lua/z.lua --init zsh)"
|
||||||
|
|
||||||
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
|
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
|
||||||
export PATH="/usr/local/sbin:$PATH"
|
export PATH="/usr/local/sbin:$PATH"
|
||||||
|
# add nvim
|
||||||
|
export PATH=$PATH:/usr/local/nvim/bin:/usr/local/osx-64/nvim/bin
|
||||||
|
|||||||
+2
-1
@@ -10,12 +10,13 @@
|
|||||||
co = checkout
|
co = checkout
|
||||||
cm = commit -m
|
cm = commit -m
|
||||||
st = status
|
st = status
|
||||||
|
ap = add -p
|
||||||
br = branch
|
br = branch
|
||||||
pl = pull
|
pl = pull
|
||||||
merge2 = "!f() { git checkout $1 && git merge $2 && git checkout -; }; f"
|
merge2 = "!f() { git checkout $1 && git merge $2 && git checkout -; }; f"
|
||||||
bg = "!f() { git branch | grep $1; }; f"
|
bg = "!f() { git branch | grep $1; }; f"
|
||||||
delbr = "!f(){ git branch -D `git branch | grep \"\b$1\"`; };f"
|
delbr = "!f(){ git branch -D `git branch | grep \"\b$1\"`; };f"
|
||||||
cin = commit --amend --no-edit
|
can = commit --amend --no-edit
|
||||||
[push]
|
[push]
|
||||||
default = current
|
default = current
|
||||||
[merge]
|
[merge]
|
||||||
|
|||||||
@@ -14,3 +14,7 @@ ln -sf ~/.dotfile/laily.zsh-theme ~/.oh-my-zsh/themes/
|
|||||||
ln -sf ~/.dotfile/.tmux.conf ~/
|
ln -sf ~/.dotfile/.tmux.conf ~/
|
||||||
ln -sf ~/.dotfile/git/.gitconfig ~/.gitconfig
|
ln -sf ~/.dotfile/git/.gitconfig ~/.gitconfig
|
||||||
|
|
||||||
|
# install neovim
|
||||||
|
cd /usr/local
|
||||||
|
wget https://github.com/neovim/neovim/releases/download/v0.6.0/nvim-macos.tar.gz
|
||||||
|
tar zxvf nvim-macos.tar.gz
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
setl ts=2 sw=2
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
require('lang.go')
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
setl ts=2 sw=2
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
setl ts=2 sw=2
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
setl commentstring={/*%s*/} ts=2 sw=2
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
require('lang.js-ts')
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
require('lang/lua')
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
require('lang.bash')
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
require('lang.js-ts')
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
setl ts=2 sw=2 ts=2 ai et
|
||||||
+28
-65
@@ -1,70 +1,33 @@
|
|||||||
-- load plugins
|
CONFIG_PATH = vim.fn.stdpath('config')
|
||||||
require("pluginsList.lua")
|
DATA_PATH = vim.fn.stdpath('data')
|
||||||
require("web-devicons.lua")
|
CACHE_PATH = vim.fn.stdpath('cache')
|
||||||
|
P = vim.inspect
|
||||||
|
|
||||||
require("utils.lua")
|
require('lv-globals')
|
||||||
require("nvimTree.lua")
|
vim.cmd('luafile '..CONFIG_PATH..'/settings.lua')
|
||||||
require("bufferline.lua")
|
require('settings')
|
||||||
require("statusline.lua")
|
require('plugins')
|
||||||
require("telescope-nvim.lua")
|
require('utils')
|
||||||
|
require('pluginconfig')
|
||||||
|
require('autocommands')
|
||||||
|
require('keymappings')
|
||||||
|
require('colorscheme') -- This plugin must be required somewhere after nvimtree. Placing it before will break navigation keymappings
|
||||||
|
|
||||||
|
-- TODO is there a way to do this without vimscript
|
||||||
|
vim.cmd('source '..CONFIG_PATH..'/vimscript/functions.vim')
|
||||||
|
|
||||||
-- lsp
|
-- LSP
|
||||||
require("nvim-lspconfig.lua")
|
require('lsp')
|
||||||
require("nvim-compe.lua")
|
|
||||||
|
|
||||||
require("gitsigns.lua")
|
--[[
|
||||||
|
require('lsp.css-ls')
|
||||||
|
require('lsp.docker-ls')
|
||||||
|
require('lsp.emmet-ls')
|
||||||
|
require('lsp.html-ls')
|
||||||
|
require('lsp.json-ls')
|
||||||
|
require('lsp.latex-ls')
|
||||||
|
require('lsp.python-ls')
|
||||||
|
require('lsp.rust-ls')
|
||||||
|
require('lsp.yaml-ls')
|
||||||
|
]]
|
||||||
|
|
||||||
require "colorizer".setup()
|
|
||||||
|
|
||||||
local cmd = vim.cmd
|
|
||||||
local g = vim.g
|
|
||||||
|
|
||||||
cmd "colorscheme darcula"
|
|
||||||
cmd "syntax enable"
|
|
||||||
cmd "syntax on"
|
|
||||||
cmd "set tabstop=4"
|
|
||||||
cmd "autocmd BufWritePre * undojoin | Neoformat"
|
|
||||||
|
|
||||||
g.auto_save = 0
|
|
||||||
g.indentLine_enabled = 1
|
|
||||||
g.indentLine_char_list = {'▏'}
|
|
||||||
g.XkbSwitchEnabled = 1
|
|
||||||
|
|
||||||
g.mapleader = " "
|
|
||||||
|
|
||||||
function _G.dump(...)
|
|
||||||
local objects = vim.tbl_map(vim.inspect, {...})
|
|
||||||
print(unpack(objects))
|
|
||||||
end
|
|
||||||
|
|
||||||
require("treesitter.lua")
|
|
||||||
require("mappings.lua")
|
|
||||||
|
|
||||||
-- highlights
|
|
||||||
cmd("hi LineNr guibg=NONE")
|
|
||||||
cmd("hi SignColumn guibg=NONE")
|
|
||||||
cmd("hi VertSplit guibg=NONE")
|
|
||||||
cmd("hi DiffAdd guifg=#81A1C1 guibg = none")
|
|
||||||
cmd("hi DiffChange guifg =#3A3E44 guibg = none")
|
|
||||||
cmd("hi DiffModified guifg = #81A1C1 guibg = none")
|
|
||||||
cmd("hi EndOfBuffer guifg=#282c34")
|
|
||||||
|
|
||||||
cmd("hi TelescopeBorder guifg=#3e4451")
|
|
||||||
cmd("hi TelescopePromptBorder guifg=#3e4451")
|
|
||||||
cmd("hi TelescopeResultsBorder guifg=#3e4451")
|
|
||||||
cmd("hi TelescopePreviewBorder guifg=#525865")
|
|
||||||
cmd("hi PmenuSel guibg=#98c379")
|
|
||||||
|
|
||||||
-- tree folder name , icon color
|
|
||||||
cmd("hi NvimTreeFolderIcon guifg = #61afef")
|
|
||||||
cmd("hi NvimTreeFolderName guifg = #61afef")
|
|
||||||
cmd("hi NvimTreeIndentMarker guifg=#545862")
|
|
||||||
|
|
||||||
require("nvim-autopairs").setup()
|
|
||||||
|
|
||||||
require("lspkind").init(
|
|
||||||
{
|
|
||||||
File = " "
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
local utils = require('utils')
|
||||||
|
|
||||||
|
local auto_formatters = { }
|
||||||
|
|
||||||
|
local python_autoformat = {'BufWritePre', '*.py', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
|
||||||
|
if O.python.autoformat then table.insert(auto_formatters, python_autoformat) end
|
||||||
|
|
||||||
|
local javascript_autoformat = {'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
|
||||||
|
local javascriptreact_autoformat = {'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
|
||||||
|
local typescript_autoformat = {'BufWritePre', '*.ts', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
|
||||||
|
local typescriptreact_autoformat = {'BufWritePre', '*.tsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
|
||||||
|
if O.tsserver.autoformat then
|
||||||
|
table.insert(auto_formatters, javascript_autoformat)
|
||||||
|
table.insert(auto_formatters, javascriptreact_autoformat)
|
||||||
|
table.insert(auto_formatters, typescript_autoformat)
|
||||||
|
table.insert(auto_formatters, typescriptreact_autoformat)
|
||||||
|
end
|
||||||
|
|
||||||
|
local lua_format = {'BufWritePre', '*.lua', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
|
||||||
|
if O.lua.autoformat then table.insert(auto_formatters, lua_format) end
|
||||||
|
|
||||||
|
local json_format = {'BufWritePre', '*.json', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
|
||||||
|
if O.json.autoformat then table.insert(auto_formatters, json_format) end
|
||||||
|
|
||||||
|
local ruby_format = {'BufWritePre', '*.rb', 'lua vim.lsp.buf.formatting_sync(nil,1000)'}
|
||||||
|
if O.ruby.autoformat then table.insert(auto_formatters, ruby_format) end
|
||||||
|
|
||||||
|
local go_format = {'BufWritePre', '*.go', 'lua vim.lsp.buf.formatting_sync(nil,1000)'}
|
||||||
|
if O.go.autoformat then table.insert(auto_formatters, go_format) end
|
||||||
|
|
||||||
|
utils.define_augroups({
|
||||||
|
_general_settings = {
|
||||||
|
{'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'Search\', timeout = 200})'},
|
||||||
|
{'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
|
||||||
|
{'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
|
||||||
|
{'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
|
||||||
|
{'VimLeavePre', '*', 'set title set titleold='},
|
||||||
|
{'FileType', 'qf', 'set nobuflisted'},
|
||||||
|
|
||||||
|
-- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'},
|
||||||
|
-- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'},
|
||||||
|
},
|
||||||
|
_java = {
|
||||||
|
{'FileType', 'java', 'luafile '..CONFIG_PATH..'/lua/lsp/java-ls.lua'},
|
||||||
|
{'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'}
|
||||||
|
},
|
||||||
|
_go = {
|
||||||
|
-- Go generally requires Tabs instead of spaces.
|
||||||
|
{'FileType', 'go', 'setlocal tabstop=4'},
|
||||||
|
{'FileType', 'go', 'setlocal shiftwidth=4'},
|
||||||
|
{'FileType', 'go', 'setlocal softtabstop=4'},
|
||||||
|
{'FileType', 'go', 'setlocal noexpandtab'},
|
||||||
|
},
|
||||||
|
_dashboard = {
|
||||||
|
-- seems to be nobuflisted that makes my stuff disapear will do more testing
|
||||||
|
{
|
||||||
|
'FileType', 'dashboard',
|
||||||
|
'setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= '
|
||||||
|
}, {'FileType', 'dashboard', 'set showtabline=0 | autocmd BufLeave <buffer> set showtabline=2'}
|
||||||
|
},
|
||||||
|
_markdown = {{'FileType', 'markdown', 'setlocal wrap'}, {'FileType', 'markdown', 'setlocal spell'}},
|
||||||
|
_solidity = {
|
||||||
|
{'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'},
|
||||||
|
{'BufNewFile', '*.sol', 'setlocal filetype=solidity'}
|
||||||
|
},
|
||||||
|
_gemini = {
|
||||||
|
{'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'},
|
||||||
|
{'BufNewFile', '*.gmi', 'setlocal filetype=markdown'}
|
||||||
|
},
|
||||||
|
_buffer_bindings = {
|
||||||
|
{'FileType', 'dashboard', 'nnoremap <silent> <buffer> q :q<CR>'},
|
||||||
|
{'FileType', 'lspinfo', 'nnoremap <silent> <buffer> q :q<CR>'},
|
||||||
|
{'FileType', 'floaterm', 'nnoremap <silent> <buffer> q :q<CR>'},
|
||||||
|
},
|
||||||
|
_auto_formatters = auto_formatters
|
||||||
|
})
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
vim.o.termguicolors = true
|
|
||||||
|
|
||||||
-- colors for active , inactive buffer tabs
|
|
||||||
require "bufferline".setup {
|
|
||||||
options = {
|
|
||||||
buffer_close_icon = "",
|
|
||||||
modified_icon = "●",
|
|
||||||
close_icon = "",
|
|
||||||
left_trunc_marker = "",
|
|
||||||
right_trunc_marker = "",
|
|
||||||
max_name_length = 14,
|
|
||||||
max_prefix_length = 13,
|
|
||||||
tab_size = 18,
|
|
||||||
enforce_regular_tabs = true,
|
|
||||||
view = "multiwindow",
|
|
||||||
show_buffer_close_icons = true,
|
|
||||||
separator_style = "thin"
|
|
||||||
},
|
|
||||||
highlights = {
|
|
||||||
background = {
|
|
||||||
guifg = comment_fg,
|
|
||||||
guibg = "#282c34"
|
|
||||||
},
|
|
||||||
fill = {
|
|
||||||
guifg = comment_fg,
|
|
||||||
guibg = "#282c34"
|
|
||||||
},
|
|
||||||
buffer_selected = {
|
|
||||||
guifg = normal_fg,
|
|
||||||
guibg = "#3A3E44",
|
|
||||||
gui = "bold"
|
|
||||||
},
|
|
||||||
separator_visible = {
|
|
||||||
guifg = "#282c34",
|
|
||||||
guibg = "#282c34"
|
|
||||||
},
|
|
||||||
separator_selected = {
|
|
||||||
guifg = "#282c34",
|
|
||||||
guibg = "#282c34"
|
|
||||||
},
|
|
||||||
separator = {
|
|
||||||
guifg = "#282c34",
|
|
||||||
guibg = "#282c34"
|
|
||||||
},
|
|
||||||
indicator_selected = {
|
|
||||||
guifg = "#282c34",
|
|
||||||
guibg = "#282c34"
|
|
||||||
},
|
|
||||||
modified_selected = {
|
|
||||||
guifg = string_fg,
|
|
||||||
guibg = "#3A3E44"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
vim.cmd('let g:nvcode_termcolors=256')
|
||||||
|
|
||||||
|
vim.cmd('colorscheme ' .. O.colorscheme)
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
require("gitsigns").setup {
|
|
||||||
signs = {
|
|
||||||
add = {hl = "DiffAdd", text = "▌", numhl = "GitSignsAddNr"},
|
|
||||||
change = {hl = "DiffChange", text = "▌", numhl = "GitSignsChangeNr"},
|
|
||||||
delete = {hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr"},
|
|
||||||
topdelete = {hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr"},
|
|
||||||
changedelete = {hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr"}
|
|
||||||
},
|
|
||||||
numhl = false,
|
|
||||||
keymaps = {
|
|
||||||
-- Default keymap options
|
|
||||||
noremap = true,
|
|
||||||
buffer = true,
|
|
||||||
["n ]c"] = {expr = true, '&diff ? \']c\' : \'<cmd>lua require"gitsigns".next_hunk()<CR>\''},
|
|
||||||
["n [c"] = {expr = true, '&diff ? \'[c\' : \'<cmd>lua require"gitsigns".prev_hunk()<CR>\''},
|
|
||||||
["n <leader>gs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
|
|
||||||
["n <leader>gu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
|
|
||||||
["n <leader>gr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
|
|
||||||
["n <leader>gp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
|
|
||||||
["n <leader>gb"] = '<cmd>lua require"gitsigns".blame_line()<CR>'
|
|
||||||
},
|
|
||||||
watch_index = {
|
|
||||||
interval = 100
|
|
||||||
},
|
|
||||||
sign_priority = 5,
|
|
||||||
status_formatter = nil -- Use default
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
vim.api.nvim_set_keymap('n', '-', ':RnvimrToggle<CR>', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- better window movement
|
||||||
|
vim.api.nvim_set_keymap('n', '<C-h>', '<C-w>h', {silent = true})
|
||||||
|
vim.api.nvim_set_keymap('n', '<C-j>', '<C-w>j', {silent = true})
|
||||||
|
vim.api.nvim_set_keymap('n', '<C-k>', '<C-w>k', {silent = true})
|
||||||
|
vim.api.nvim_set_keymap('n', '<C-l>', '<C-w>l', {silent = true})
|
||||||
|
|
||||||
|
-- better edit
|
||||||
|
vim.api.nvim_set_keymap('n', 'Y', 'y$', {})
|
||||||
|
|
||||||
|
-- TODO fix this
|
||||||
|
-- Terminal window navigation
|
||||||
|
-- vim.cmd([[
|
||||||
|
-- tnoremap <C-h> <C-\><C-N><C-w>h
|
||||||
|
-- tnoremap <C-j> <C-\><C-N><C-w>j
|
||||||
|
-- tnoremap <C-k> <C-\><C-N><C-w>k
|
||||||
|
-- tnoremap <C-l> <C-\><C-N><C-w>l
|
||||||
|
-- inoremap <C-h> <C-\><C-N><C-w>h
|
||||||
|
-- inoremap <C-j> <C-\><C-N><C-w>j
|
||||||
|
-- inoremap <C-k> <C-\><C-N><C-w>k
|
||||||
|
-- inoremap <C-l> <C-\><C-N><C-w>l
|
||||||
|
-- tnoremap <Esc> <C-\><C-n>
|
||||||
|
-- ]])
|
||||||
|
|
||||||
|
-- TODO fix this
|
||||||
|
-- resize with arrows
|
||||||
|
vim.api.nvim_set_keymap('n', '<C-Up>', ':resize -2<CR>', {silent = true})
|
||||||
|
vim.api.nvim_set_keymap('n', '<C-Down>', ':resize +2<CR>', {silent = true})
|
||||||
|
vim.api.nvim_set_keymap('n', '<C-Left>', ':vertical resize -2<CR>', {silent = true})
|
||||||
|
vim.api.nvim_set_keymap('n', '<C-Right>', ':vertical resize +2<CR>', {silent = true})
|
||||||
|
|
||||||
|
-- better indenting
|
||||||
|
vim.api.nvim_set_keymap('v', '<', '<gv', {noremap = true, silent = true})
|
||||||
|
vim.api.nvim_set_keymap('v', '>', '>gv', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- I hate escape
|
||||||
|
vim.api.nvim_set_keymap('i', 'jk', '<ESC>', {noremap = true, silent = true})
|
||||||
|
vim.api.nvim_set_keymap('i', 'kj', '<ESC>', {noremap = true, silent = true})
|
||||||
|
vim.api.nvim_set_keymap('i', 'jj', '<ESC>', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- Tab switch buffer
|
||||||
|
vim.api.nvim_set_keymap('n', '<TAB>', ':bnext<CR>', {noremap = true, silent = true})
|
||||||
|
vim.api.nvim_set_keymap('n', '<S-TAB>', ':bprevious<CR>', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- Move selected line / block of text in visual mode
|
||||||
|
vim.api.nvim_set_keymap('x', 'K', ':move \'<-2<CR>gv-gv', {noremap = true, silent = true})
|
||||||
|
vim.api.nvim_set_keymap('x', 'J', ':move \'>+1<CR>gv-gv', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- Better nav for omnicomplete
|
||||||
|
vim.cmd('inoremap <expr> <c-j> (\"\\<C-n>\")')
|
||||||
|
vim.cmd('inoremap <expr> <c-k> (\"\\<C-p>\")')
|
||||||
|
|
||||||
|
vim.cmd('vnoremap p "0p')
|
||||||
|
vim.cmd('vnoremap P "0P')
|
||||||
|
-- vim.api.nvim_set_keymap('v', 'p', '"0p', {silent = true})
|
||||||
|
-- vim.api.nvim_set_keymap('v', 'P', '"0P', {silent = true})
|
||||||
|
|
||||||
|
-- vim.cmd('inoremap <expr> <TAB> (\"\\<C-n>\")')
|
||||||
|
-- vim.cmd('inoremap <expr> <S-TAB> (\"\\<C-p>\")')
|
||||||
|
|
||||||
|
-- vim.api.nvim_set_keymap('i', '<C-TAB>', 'compe#complete()', {noremap = true, silent = true, expr = true})
|
||||||
|
|
||||||
|
-- vim.cmd([[
|
||||||
|
-- map p <Plug>(miniyank-autoput)
|
||||||
|
-- map P <Plug>(miniyank-autoPut)
|
||||||
|
-- map <leader>n <Plug>(miniyank-cycle)
|
||||||
|
-- map <leader>N <Plug>(miniyank-cycleback)
|
||||||
|
-- ]])
|
||||||
|
|
||||||
|
-- Toggle the QuickFix window
|
||||||
|
vim.api.nvim_set_keymap('', '<C-q>', ':call QuickFixToggle()<CR>', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- nvim-compe key map
|
||||||
|
vim.cmd('inoremap <silent><expr> <C-Space> compe#complete()')
|
||||||
|
vim.cmd("inoremap <silent><expr> <CR> compe#confirm('<CR>')")
|
||||||
|
vim.cmd("inoremap <silent><expr> <C-e> compe#close('<C-e>')")
|
||||||
|
vim.cmd("inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })")
|
||||||
|
vim.cmd("inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })")
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
-- npm i -g bash-language-server
|
||||||
|
require'lspconfig'.bashls.setup {
|
||||||
|
cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"},
|
||||||
|
on_attach = require'lsp'.common_on_attach,
|
||||||
|
filetypes = { "sh", "zsh" }
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
-- npm install -g vscode-css-languageserver-bin
|
||||||
|
require'lspconfig'.cssls.setup {
|
||||||
|
cmd = {
|
||||||
|
"node", DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
|
||||||
|
"--stdio"
|
||||||
|
},
|
||||||
|
on_attach = require'lsp'.common_on_attach
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
-- npm install -g dockerfile-language-server-nodejs
|
||||||
|
require'lspconfig'.dockerls.setup {
|
||||||
|
cmd = {DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio"},
|
||||||
|
on_attach = require'lsp'.common_on_attach,
|
||||||
|
root_dir = vim.loop.cwd
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
local nvim_lsp = require'lspconfig'
|
||||||
|
local configs = require'lspconfig/configs'
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
|
configs.emmet_ls = {
|
||||||
|
default_config = {
|
||||||
|
cmd = {'emmet-ls', '--stdio'};
|
||||||
|
filetypes = {'html', 'css'};
|
||||||
|
root_dir = function()
|
||||||
|
return vim.loop.cwd()
|
||||||
|
end;
|
||||||
|
settings = {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
nvim_lsp.emmet_ls.setup{
|
||||||
|
-- on_attach = on_attach;
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
-- LSP
|
||||||
|
require'lspconfig'.gopls.setup{
|
||||||
|
cmd = {DATA_PATH .. "/lspinstall/go/gopls"},
|
||||||
|
settings = {gopls = {analyses = {unusedparams = true}, staticcheck = true}},
|
||||||
|
root_dir = require'lspconfig'.util.root_pattern(".git","go.mod"),
|
||||||
|
init_options = {usePlaceholders = true, completeUnimported = true},
|
||||||
|
on_attach = require'lsp'.common_on_attach
|
||||||
|
}
|
||||||
|
|
||||||
|
require'dap-install'.config("go_delve",{})
|
||||||
|
|
||||||
|
-- DAP
|
||||||
|
local dap = require "dap"
|
||||||
|
vim.fn.sign_define('DapBreakpoint', {text='🟥', texthl='', linehl='', numhl=''})
|
||||||
|
--vim.fn.sign_define('DapStopped', {text='⭐️', texthl='', linehl='', numhl=''})
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local ts_utils = require 'nvim-treesitter.ts_utils'
|
||||||
|
|
||||||
|
function M.get_node()
|
||||||
|
local n = ts_utils.get_node_at_cursor()
|
||||||
|
put(ts_utils.get_node_text(n))
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_node2()
|
||||||
|
local current_node = ts_utils.get_node_at_cursor()
|
||||||
|
if not current_node then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local expr = current_node
|
||||||
|
|
||||||
|
while expr do
|
||||||
|
if expr:type() == 'function_definition' then
|
||||||
|
put(expr:type())
|
||||||
|
break
|
||||||
|
end
|
||||||
|
expr = expr:parent()
|
||||||
|
end
|
||||||
|
|
||||||
|
if not expr then return "" end
|
||||||
|
|
||||||
|
put(ts_utils.get_node_text(expr))
|
||||||
|
return (ts_utils.get_node_text(expr:child(1)))[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
||||||
|
--[[
|
||||||
|
-- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md
|
||||||
|
dap.configurations.go = {
|
||||||
|
{
|
||||||
|
type = "go",
|
||||||
|
name = "Debug",
|
||||||
|
request = "launch",
|
||||||
|
program = "${file}"
|
||||||
|
},
|
||||||
|
-- works with go.mod packages and sub packagesfunction M.get_current_function_name() local current_node = ts_utils.get_node_at_cursor() if not current_node then return "" end
|
||||||
|
|
||||||
|
local expr = current_node
|
||||||
|
|
||||||
|
while expr do
|
||||||
|
if expr:type() == 'function_definition' then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
expr = expr:parent()
|
||||||
|
end
|
||||||
|
|
||||||
|
if not expr then return "" end
|
||||||
|
|
||||||
|
return (ts_utils.get_node_text(expr:child(1)))[1]
|
||||||
|
end
|
||||||
|
{
|
||||||
|
type = "go",
|
||||||
|
name = "Debug test (go.mod)",
|
||||||
|
request = "launch",
|
||||||
|
mode = "test",
|
||||||
|
program = "./${relativeFileDirname}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
|
local dap = require('dap')
|
||||||
|
|
||||||
|
dap.adapters.go = function(callback, config)
|
||||||
|
local stdout = vim.loop.new_pipe(false)
|
||||||
|
local handle
|
||||||
|
local pid_or_err
|
||||||
|
local port = 38697
|
||||||
|
local opts = {
|
||||||
|
stdio = {nil, stdout},
|
||||||
|
args = {"dap", "-l", "127.0.0.1:" .. port},
|
||||||
|
detached = true
|
||||||
|
}
|
||||||
|
handle, pid_or_err = vim.loop.spawn("dlv", opts, function(code)
|
||||||
|
stdout:close()
|
||||||
|
handle:close()
|
||||||
|
if code ~= 0 then
|
||||||
|
print('dlv exited with code', code)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
assert(handle, 'Error running dlv: ' .. tostring(pid_or_err))
|
||||||
|
stdout:read_start(function(err, chunk)
|
||||||
|
assert(not err, err)
|
||||||
|
if chunk then
|
||||||
|
vim.schedule(function()
|
||||||
|
require('dap.repl').append(chunk)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
-- Wait for delve to start
|
||||||
|
vim.defer_fn(
|
||||||
|
function()
|
||||||
|
callback({type = "server", host = "127.0.0.1", port = port})
|
||||||
|
end,
|
||||||
|
100)
|
||||||
|
end
|
||||||
|
-- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md
|
||||||
|
dap.configurations.go = {
|
||||||
|
{
|
||||||
|
type = "go",
|
||||||
|
name = "Debug",
|
||||||
|
request = "launch",
|
||||||
|
program = "${file}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "go",
|
||||||
|
name = "Debug test", -- configuration for debugging test files
|
||||||
|
request = "launch",
|
||||||
|
mode = "test",
|
||||||
|
program = "${file}"
|
||||||
|
},
|
||||||
|
-- works with go.mod packages and sub packages
|
||||||
|
{
|
||||||
|
type = "go",
|
||||||
|
name = "Debug test (go.mod)",
|
||||||
|
request = "launch",
|
||||||
|
mode = "test",
|
||||||
|
program = "./${relativeFileDirname}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]]
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
-- npm install -g vscode-html-languageserver-bin
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
|
require'lspconfig'.html.setup {
|
||||||
|
cmd = {"node", DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js", "--stdio"},
|
||||||
|
on_attach = require'lsp'.common_on_attach,
|
||||||
|
capabilities = capabilities
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
-- npm install -g typescript typescript-language-server
|
||||||
|
-- require'snippets'.use_suggested_mappings()
|
||||||
|
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
|
||||||
|
-- local on_attach_common = function(client)
|
||||||
|
-- print("LSP Initialized")
|
||||||
|
-- require'completion'.on_attach(client)
|
||||||
|
-- require'illuminate'.on_attach(client)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
require'lspconfig'.tsserver.setup {
|
||||||
|
cmd = {DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", "--stdio"},
|
||||||
|
filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" },
|
||||||
|
on_attach = require'lsp'.tsserver_on_attach,
|
||||||
|
-- This makes sure tsserver is not used for formatting (I prefer prettier)
|
||||||
|
-- on_attach = require'lsp'.common_on_attach,
|
||||||
|
root_dir = require('lspconfig/util').root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
||||||
|
settings = {documentFormatting = false},
|
||||||
|
handlers = {
|
||||||
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = O.tsserver.diagnostics.virtual_text,
|
||||||
|
signs = O.tsserver.diagnostics.signs,
|
||||||
|
underline = O.tsserver.diagnostics.underline,
|
||||||
|
update_in_insert = true
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
-- npm install -g vscode-json-languageserver
|
||||||
|
require'lspconfig'.jsonls.setup {
|
||||||
|
cmd = {
|
||||||
|
"node", DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
|
||||||
|
"--stdio"
|
||||||
|
},
|
||||||
|
on_attach = require'lsp'.common_on_attach,
|
||||||
|
|
||||||
|
commands = {
|
||||||
|
Format = {
|
||||||
|
function()
|
||||||
|
vim.lsp.buf.range_formatting({}, {0, 0}, {vim.fn.line("$"), 0})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
require'lspconfig'.texlab.setup{
|
||||||
|
cmd = {DATA_PATH .. "/lspinstall/latex/texlab"},
|
||||||
|
on_attach = require'lsp'.common_on_attach
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
|
||||||
|
local brew_path = "/usr/local/Cellar/lua-language-server/2.5.5/libexec"
|
||||||
|
local sumneko_root_path = brew_path
|
||||||
|
local sumneko_binary = brew_path .. "/bin/lua-language-server"
|
||||||
|
|
||||||
|
require'lspconfig'.sumneko_lua.setup {
|
||||||
|
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
|
||||||
|
on_attach = require'lsp'.common_on_attach,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = 'LuaJIT',
|
||||||
|
-- Setup your lua path
|
||||||
|
path = vim.split(package.path, ';')
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = {'vim'}
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true},
|
||||||
|
maxPreload = 10000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
-- npm i -g pyright
|
||||||
|
require'lspconfig'.pyright.setup {
|
||||||
|
cmd = {DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", "--stdio"},
|
||||||
|
on_attach = require'lsp'.common_on_attach,
|
||||||
|
handlers = {
|
||||||
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = O.python.diagnostics.virtual_text,
|
||||||
|
signs = O.python.diagnostics.signs,
|
||||||
|
underline = O.python.diagnostics.underline,
|
||||||
|
update_in_insert = true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
python = {
|
||||||
|
analysis = {
|
||||||
|
typeCheckingMode = O.python.analysis.type_checking,
|
||||||
|
autoSearchPaths = O.python.analysis.auto_search_paths,
|
||||||
|
useLibraryCodeForTypes = O.python.analysis.use_library_code_types
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
require'lspconfig'.rust_analyzer.setup{
|
||||||
|
cmd = {DATA_PATH .. "/lspinstall/rust/rust-analyzer"},
|
||||||
|
on_attach = require'lsp'.common_on_attach
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
-- npm install -g yaml-language-server
|
||||||
|
require'lspconfig'.yamlls.setup{
|
||||||
|
cmd = {DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio"},
|
||||||
|
on_attach = require'lsp'.common_on_attach,
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
-- TODO figure out why this don't work
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignError",
|
||||||
|
{texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"}
|
||||||
|
)
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignWarning",
|
||||||
|
{texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"}
|
||||||
|
)
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignHint",
|
||||||
|
{texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"}
|
||||||
|
)
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"LspDiagnosticsSignInformation",
|
||||||
|
{texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"}
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.cmd("nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>")
|
||||||
|
vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>")
|
||||||
|
vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>")
|
||||||
|
vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>")
|
||||||
|
vim.cmd("nnoremap <silent> ca :Lspsaga code_action<CR>")
|
||||||
|
vim.cmd("nnoremap <silent> K :Lspsaga hover_doc<CR>")
|
||||||
|
-- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>')
|
||||||
|
vim.cmd("nnoremap <silent> <C-m> :Lspsaga diagnostic_jump_prev<CR>")
|
||||||
|
vim.cmd("nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>")
|
||||||
|
-- scroll down hover doc or scroll in definition preview
|
||||||
|
vim.cmd("nnoremap <silent> <C-f> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>")
|
||||||
|
-- scroll up hover doc
|
||||||
|
vim.cmd("nnoremap <silent> <C-b> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>")
|
||||||
|
vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()')
|
||||||
|
|
||||||
|
-- Set Default Prefix.
|
||||||
|
-- Note: You can set a prefix per lsp server in the lv-globals.lua file
|
||||||
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||||
|
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = {
|
||||||
|
prefix = "",
|
||||||
|
spacing = 0,
|
||||||
|
},
|
||||||
|
signs = true,
|
||||||
|
underline = true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
-- symbols for autocomplete
|
||||||
|
vim.lsp.protocol.CompletionItemKind = {
|
||||||
|
" (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)"
|
||||||
|
}
|
||||||
|
|
||||||
|
--[[ " autoformat
|
||||||
|
autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)
|
||||||
|
autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100)
|
||||||
|
autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]]
|
||||||
|
-- Java
|
||||||
|
-- autocmd FileType java nnoremap ca <Cmd>lua require('jdtls').code_action()<CR>
|
||||||
|
|
||||||
|
local function documentHighlight(client, bufnr)
|
||||||
|
-- Set autocommands conditional on server_capabilities
|
||||||
|
if client.resolved_capabilities.document_highlight then
|
||||||
|
vim.api.nvim_exec(
|
||||||
|
[[
|
||||||
|
hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646
|
||||||
|
hi LspReferenceText cterm=bold ctermbg=red guibg=#464646
|
||||||
|
hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646
|
||||||
|
augroup lsp_document_highlight
|
||||||
|
autocmd! * <buffer>
|
||||||
|
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||||
|
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
||||||
|
augroup END
|
||||||
|
]],
|
||||||
|
false
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local lsp_config = {}
|
||||||
|
|
||||||
|
if O.document_highlight then
|
||||||
|
function lsp_config.common_on_attach(client, bufnr)
|
||||||
|
documentHighlight(client, bufnr)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--function lsp_config.tsserver_on_attach(client, bufnr)
|
||||||
|
-- lsp_config.common_on_attach(client, bufnr)
|
||||||
|
-- client.resolved_capabilities.document_formatting = false
|
||||||
|
--end
|
||||||
|
|
||||||
|
-- Use a loop to conveniently both setup defined servers
|
||||||
|
-- and map buffer local keybindings when the language server attaches
|
||||||
|
-- local servers = {"pyright", "tsserver"}
|
||||||
|
-- for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup {on_attach = on_attach} end
|
||||||
|
return lsp_config
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
O = {
|
||||||
|
extras = false,
|
||||||
|
|
||||||
|
--database = {save_location = '~/.config/nvcode_db', auto_execute = 1},
|
||||||
|
python = {
|
||||||
|
linter = '',
|
||||||
|
-- @usage can be 'yapf', 'black'
|
||||||
|
formatter = '',
|
||||||
|
autoformat = false,
|
||||||
|
isort = false,
|
||||||
|
diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true},
|
||||||
|
analysis = {type_checking = "basic", auto_search_paths = true, use_library_code_types = true}
|
||||||
|
},
|
||||||
|
dart = {sdk_path = '/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot'},
|
||||||
|
lua = {
|
||||||
|
-- @usage can be 'lua-format'
|
||||||
|
formatter = '',
|
||||||
|
autoformat = false,
|
||||||
|
diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true}
|
||||||
|
},
|
||||||
|
sh = {
|
||||||
|
-- @usage can be 'shellcheck'
|
||||||
|
linter = '',
|
||||||
|
-- @usage can be 'shfmt'
|
||||||
|
formatter = '',
|
||||||
|
autoformat = false,
|
||||||
|
diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true}
|
||||||
|
},
|
||||||
|
tsserver = {
|
||||||
|
-- @usage can be 'eslint'
|
||||||
|
linter = '',
|
||||||
|
-- @usage can be 'prettier'
|
||||||
|
formatter = '',
|
||||||
|
autoformat = false,
|
||||||
|
diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true}
|
||||||
|
},
|
||||||
|
json = {
|
||||||
|
-- @usage can be 'prettier'
|
||||||
|
formatter = '',
|
||||||
|
autoformat = false,
|
||||||
|
diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true}
|
||||||
|
},
|
||||||
|
tailwindls = {filetypes = {'html', 'css', 'scss', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'}},
|
||||||
|
clang = {diagnostics = {virtual_text = {spacing = 0, prefix = ""}, signs = true, underline = true}},
|
||||||
|
ruby = {
|
||||||
|
diagnostics = {virtualtext = {spacing = 0, prefix = ""}, signs = true, underline = true},
|
||||||
|
filetypes = {'rb', 'erb', 'rakefile'}
|
||||||
|
},
|
||||||
|
go = {},
|
||||||
|
-- css = {formatter = '', autoformat = false, virtual_text = true},
|
||||||
|
-- json = {formatter = '', autoformat = false, virtual_text = true}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function _G.put(...)
|
||||||
|
local objects = {}
|
||||||
|
for i = 1, select('#', ...) do
|
||||||
|
local v = select(i, ...)
|
||||||
|
table.insert(objects, vim.inspect(v))
|
||||||
|
end
|
||||||
|
|
||||||
|
print(table.concat(objects, '\n'))
|
||||||
|
return ...
|
||||||
|
end
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
local function map(mode, lhs, rhs, opts)
|
|
||||||
local options = {noremap = true}
|
|
||||||
if opts then
|
|
||||||
options = vim.tbl_extend("force", options, opts)
|
|
||||||
end
|
|
||||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- keybind list
|
|
||||||
map("", "<leader>c", '"+y')
|
|
||||||
|
|
||||||
-- open terminals
|
|
||||||
map("n", "<C-`>" , [[<Cmd> vnew term://bash<CR>]] , opt) -- split term vertically , over the right
|
|
||||||
map("n", "<C-x>" , [[<Cmd> split term://bash | resize 10 <CR>]] , opt) -- split term vertically , over the right
|
|
||||||
-- file
|
|
||||||
map("n","<leader>fs",[[<Cmd> w<CR>]])
|
|
||||||
|
|
||||||
-- buffer
|
|
||||||
map("n", "<leader>bn",[[<Cmd> bnext<CR>]])
|
|
||||||
map("n", "<leader>bp",[[<Cmd> bprev<CR>]])
|
|
||||||
map("n", "<leader>bd",[[<Cmd> bd<CR>]])
|
|
||||||
|
|
||||||
-- window
|
|
||||||
map("n", "<C-h>",[[<C-w>h<CR>]])
|
|
||||||
map("n", "<C-l>",[[<C-w>l<CR>]])
|
|
||||||
map("n", "<C-k>",[[<C-w>k<CR>]])
|
|
||||||
map("n", "<C-j>",[[<C-w>j<CR>]])
|
|
||||||
|
|
||||||
-- search
|
|
||||||
map("n","<leader>sc",[[<Cmd> nohlsearch<CR>]])
|
|
||||||
|
|
||||||
-- vim self
|
|
||||||
map("n","<leader>qq",[[<Cmd> qa<CR>]])
|
|
||||||
map("n","<leader>qr",[[<Cmd> luafile $MYVIMRC<CR>]])
|
|
||||||
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
vim.cmd [[packadd nvim-lspconfig]]
|
|
||||||
vim.cmd [[packadd nvim-compe]]
|
|
||||||
|
|
||||||
vim.o.completeopt = "menuone,noselect"
|
|
||||||
|
|
||||||
require "compe".setup {
|
|
||||||
enabled = true,
|
|
||||||
autocomplete = true,
|
|
||||||
debug = false,
|
|
||||||
min_length = 1,
|
|
||||||
preselect = "enable",
|
|
||||||
throttle_time = 80,
|
|
||||||
source_timeout = 200,
|
|
||||||
incomplete_delay = 400,
|
|
||||||
max_abbr_width = 100,
|
|
||||||
max_kind_width = 100,
|
|
||||||
max_menu_width = 100,
|
|
||||||
documentation = false,
|
|
||||||
source = {
|
|
||||||
path = true,
|
|
||||||
buffer = true,
|
|
||||||
calc = true,
|
|
||||||
vsnip = true,
|
|
||||||
nvim_lsp = true,
|
|
||||||
nvim_lua = true,
|
|
||||||
spell = true,
|
|
||||||
tags = true,
|
|
||||||
snippets_nvim = true,
|
|
||||||
treesitter = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
local t = function(str)
|
|
||||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
|
||||||
end
|
|
||||||
_G.s_tab_complete = function()
|
|
||||||
if vim.fn.pumvisible() == 1 then
|
|
||||||
return t "<C-p>"
|
|
||||||
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
|
||||||
return t "<Plug>(vsnip-jump-prev)"
|
|
||||||
else
|
|
||||||
return t "<S-Tab>"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- mappings
|
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
|
||||||
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
|
||||||
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
|
||||||
|
|
||||||
function _G.completions()
|
|
||||||
local npairs = require("nvim-autopairs")
|
|
||||||
if vim.fn.pumvisible() == 1 then
|
|
||||||
if vim.fn.complete_info()["selected"] ~= -1 then
|
|
||||||
return vim.fn["compe#confirm"]("<CR>")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return npairs.check_break_line_char()
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("i", "<CR>", "v:lua.completions()", {expr = true})
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
vim.cmd [[packadd nvim-lspconfig]]
|
|
||||||
vim.cmd [[packadd nvim-compe]]
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
|
||||||
|
|
||||||
-- Mappings.
|
|
||||||
local opts = {noremap = true, silent = true}
|
|
||||||
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", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
|
||||||
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
|
||||||
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
|
||||||
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
|
||||||
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
|
||||||
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
|
||||||
|
|
||||||
-- lsp for html , css and js/ts
|
|
||||||
require "lspconfig".gopls.setup{}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
vim.cmd [[packadd nvim-tree.lua]]
|
|
||||||
|
|
||||||
vim.o.termguicolors = true
|
|
||||||
|
|
||||||
vim.g.nvim_tree_side = "left"
|
|
||||||
vim.g.nvim_tree_width = 24
|
|
||||||
vim.g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
|
|
||||||
vim.g.nvim_tree_auto_open = 1
|
|
||||||
vim.g.nvim_tree_auto_close = 1
|
|
||||||
vim.g.nvim_tree_quit_on_open = 0
|
|
||||||
vim.g.nvim_tree_follow = 1
|
|
||||||
vim.g.nvim_tree_indent_markers = 1
|
|
||||||
vim.g.nvim_tree_hide_dotfiles = 1
|
|
||||||
vim.g.nvim_tree_git_hl = 1
|
|
||||||
vim.g.nvim_tree_root_folder_modifier = ":~"
|
|
||||||
vim.g.nvim_tree_tab_open = 1
|
|
||||||
vim.g.nvim_tree_allow_resize = 1
|
|
||||||
|
|
||||||
vim.g.nvim_tree_show_icons = {
|
|
||||||
git = 1,
|
|
||||||
folders = 1,
|
|
||||||
files = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.g.nvim_tree_icons = {
|
|
||||||
default = " ",
|
|
||||||
symlink = " ",
|
|
||||||
git = {
|
|
||||||
unstaged = "✗",
|
|
||||||
staged = "✓",
|
|
||||||
unmerged = "",
|
|
||||||
renamed = "➜",
|
|
||||||
untracked = "★"
|
|
||||||
},
|
|
||||||
folder = {
|
|
||||||
default = "",
|
|
||||||
open = "",
|
|
||||||
symlink = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
local get_lua_cb = function(cb_name)
|
|
||||||
return string.format(":lua require'nvim-tree'.on_keypress('%s')<CR>", cb_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Mappings for nvimtree
|
|
||||||
|
|
||||||
vim.api.nvim_set_keymap(
|
|
||||||
"n",
|
|
||||||
"<C-n>",
|
|
||||||
":NvimTreeToggle<CR>",
|
|
||||||
{
|
|
||||||
noremap = true,
|
|
||||||
silent = true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.g.nvim_tree_bindings = {
|
|
||||||
["<CR>"] = get_lua_cb("edit"),
|
|
||||||
["l"] = get_lua_cb("edit"),
|
|
||||||
["h"] = get_lua_cb("close_node"),
|
|
||||||
["o"] = get_lua_cb("edit"),
|
|
||||||
["<2-LeftMouse>"] = get_lua_cb("edit"),
|
|
||||||
["<2-RightMouse>"] = get_lua_cb("cd"),
|
|
||||||
["<C-]>"] = get_lua_cb("cd"),
|
|
||||||
["<C-v>"] = get_lua_cb("vsplit"),
|
|
||||||
["<C-x>"] = get_lua_cb("split"),
|
|
||||||
["<C-t>"] = get_lua_cb("tabnew"),
|
|
||||||
["<BS>"] = get_lua_cb("close_node"),
|
|
||||||
["<S-CR>"] = get_lua_cb("close_node"),
|
|
||||||
["<Tab>"] = get_lua_cb("preview"),
|
|
||||||
["I"] = get_lua_cb("toggle_ignored"),
|
|
||||||
["H"] = get_lua_cb("toggle_dotfiles"),
|
|
||||||
["."] = get_lua_cb("toggle_dotfiles"),
|
|
||||||
["R"] = get_lua_cb("refresh"),
|
|
||||||
["n"] = get_lua_cb("create"),
|
|
||||||
["d"] = get_lua_cb("remove"),
|
|
||||||
["r"] = get_lua_cb("rename"),
|
|
||||||
["<C-r>"] = get_lua_cb("full_rename"),
|
|
||||||
["x"] = get_lua_cb("cut"),
|
|
||||||
["c"] = get_lua_cb("copy"),
|
|
||||||
["p"] = get_lua_cb("paste"),
|
|
||||||
["[c"] = get_lua_cb("prev_git_item"),
|
|
||||||
["]c"] = get_lua_cb("next_git_item"),
|
|
||||||
["-"] = get_lua_cb("dir_up"),
|
|
||||||
["q"] = get_lua_cb("close")
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
vim.api.nvim_set_keymap('n', '<TAB>', ':BufferNext<CR>', { noremap = true, silent = true })
|
||||||
|
vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferPrevious<CR>', { noremap = true, silent = true })
|
||||||
|
vim.api.nvim_set_keymap('n', '<S-x>', ':BufferClose<CR>', { noremap = true, silent = true })
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
--[[
|
||||||
|
local dashboard = {
|
||||||
|
custom_header = {
|
||||||
|
' _..._ ',
|
||||||
|
' .\' (_`. _ __ ___ ',
|
||||||
|
' : . : | | _ _ _ __ __ _ _ _\\ \\ / (_)_ __ ___ ',
|
||||||
|
' :) () : | | | | | | \'_ \\ / _` | \'__\\ \\ / /| | \'_ ` _ \\ ',
|
||||||
|
' `. . .\' | |__| |_| | | | | (_| | | \\ V / | | | | | | |',
|
||||||
|
' `-...-\' |_____\\__,_|_| |_|\\__,_|_| \\_/ |_|_| |_| |_|',
|
||||||
|
},
|
||||||
|
footer= {'Laily'}
|
||||||
|
}
|
||||||
|
]]
|
||||||
|
|
||||||
|
local dashboard = {
|
||||||
|
custom_header = {
|
||||||
|
'███╗ ██╗██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗',
|
||||||
|
'████╗ ██║██║ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝',
|
||||||
|
'██╔██╗ ██║██║ ██║██║ ██║ ██║██║ ██║█████╗',
|
||||||
|
'██║╚██╗██║╚██╗ ██╔╝██║ ██║ ██║██║ ██║██╔══╝',
|
||||||
|
'██║ ╚████║ ╚████╔╝ ╚██████╗╚██████╔╝██████╔╝███████╗',
|
||||||
|
'╚═╝ ╚═══╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝'
|
||||||
|
},
|
||||||
|
footer= {'Laily'},
|
||||||
|
}
|
||||||
|
-- vim.g.dashboard_custom_header = {
|
||||||
|
--
|
||||||
|
-- ' _..._ ',
|
||||||
|
-- ' .\' `. ██ ██ ██ ███ ██ █████ ██████ ██ ██ ██ ███ ███ ',
|
||||||
|
-- ' : : ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ',
|
||||||
|
-- ' : : ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ██ ████ ██ ',
|
||||||
|
-- ' `. .\' ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ',
|
||||||
|
-- ' `-...-\' ███████ ██████ ██ ████ ██ ██ ██ ██ ████ ██ ██ ██ ',
|
||||||
|
--
|
||||||
|
-- }
|
||||||
|
|
||||||
|
vim.g.dashboard_custom_header = dashboard.custom_header
|
||||||
|
|
||||||
|
vim.g.dashboard_default_executive = 'telescope'
|
||||||
|
|
||||||
|
vim.g.dashboard_custom_section = {
|
||||||
|
a = {description = {' Find File '}, command = 'Telescope find_files'},
|
||||||
|
b = {description = {' Recently Used Files'}, command = 'Telescope oldfiles'},
|
||||||
|
c = {description = {' Load Last Session '}, command = 'SessionLoad'},
|
||||||
|
d = {description = {' Find Word '}, command = 'Telescope live_grep'},
|
||||||
|
e = {description = {' Settings '}, command = ':e '..CONFIG_PATH..'/lv-settings.lua'}
|
||||||
|
-- e = {description = {' Marks '}, command = 'Telescope marks'}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- file_browser = {description = {' File Browser'}, command = 'Telescope find_files'},
|
||||||
|
|
||||||
|
-- vim.g.dashboard_custom_shortcut = {
|
||||||
|
-- a = 'f',
|
||||||
|
-- find_word = 'SPC f a',
|
||||||
|
-- last_session = 'SPC s l',
|
||||||
|
-- new_file = 'SPC c n',
|
||||||
|
-- book_marks = 'SPC f b'
|
||||||
|
-- }
|
||||||
|
-- find_history = 'SPC f h',
|
||||||
|
|
||||||
|
-- vim.g.dashboard_session_directory = CACHE_PATH..'/session'
|
||||||
|
vim.g.dashboard_custom_footer = dashboard.footer
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
require'fzf-lua'.setup {
|
||||||
|
fzf_opts = { ['--keep-right'] = ''},
|
||||||
|
fzf_cli_args = '--keep-right',
|
||||||
|
--[[
|
||||||
|
winopts = {
|
||||||
|
preview = {
|
||||||
|
layout = "vertical"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]]
|
||||||
|
}
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
local gl = require('galaxyline')
|
||||||
|
-- get my theme in galaxyline repo
|
||||||
|
-- local colors = require('galaxyline.theme').default
|
||||||
|
local colors = {
|
||||||
|
-- bg = '#2E2E2E',
|
||||||
|
bg = '#292D38',
|
||||||
|
yellow = '#DCDCAA',
|
||||||
|
dark_yellow = '#D7BA7D',
|
||||||
|
cyan = '#4EC9B0',
|
||||||
|
green = '#608B4E',
|
||||||
|
light_green = '#B5CEA8',
|
||||||
|
string_orange = '#CE9178',
|
||||||
|
orange = '#FF8800',
|
||||||
|
purple = '#C586C0',
|
||||||
|
magenta = '#D16D9E',
|
||||||
|
grey = '#858585',
|
||||||
|
blue = '#569CD6',
|
||||||
|
vivid_blue = '#4FC1FF',
|
||||||
|
light_blue = '#9CDCFE',
|
||||||
|
red = '#D16969',
|
||||||
|
error_red = '#F44747',
|
||||||
|
info_yellow = '#FFCC66'
|
||||||
|
}
|
||||||
|
local condition = require('galaxyline.condition')
|
||||||
|
local gls = gl.section
|
||||||
|
gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'}
|
||||||
|
|
||||||
|
table.insert(gls.left, {
|
||||||
|
ViMode = {
|
||||||
|
provider = function()
|
||||||
|
-- auto change color according the vim mode
|
||||||
|
local mode_color = {
|
||||||
|
n = colors.blue,
|
||||||
|
i = colors.green,
|
||||||
|
v = colors.purple,
|
||||||
|
[''] = colors.purple,
|
||||||
|
V = colors.purple,
|
||||||
|
c = colors.magenta,
|
||||||
|
no = colors.blue,
|
||||||
|
s = colors.orange,
|
||||||
|
S = colors.orange,
|
||||||
|
[''] = colors.orange,
|
||||||
|
ic = colors.yellow,
|
||||||
|
R = colors.red,
|
||||||
|
Rv = colors.red,
|
||||||
|
cv = colors.blue,
|
||||||
|
ce = colors.blue,
|
||||||
|
r = colors.cyan,
|
||||||
|
rm = colors.cyan,
|
||||||
|
['r?'] = colors.cyan,
|
||||||
|
['!'] = colors.blue,
|
||||||
|
t = colors.blue
|
||||||
|
}
|
||||||
|
vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()])
|
||||||
|
return '▊ '
|
||||||
|
end,
|
||||||
|
highlight = {colors.red, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
print(vim.fn.getbufvar(0, 'ts'))
|
||||||
|
vim.fn.getbufvar(0, 'ts')
|
||||||
|
|
||||||
|
table.insert(gls.left, {
|
||||||
|
GitIcon = {
|
||||||
|
provider = function()
|
||||||
|
return ' '
|
||||||
|
end,
|
||||||
|
condition = condition.check_git_workspace,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE', colors.bg},
|
||||||
|
highlight = {colors.orange, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.left, {
|
||||||
|
GitBranch = {
|
||||||
|
provider = 'GitBranch',
|
||||||
|
condition = condition.check_git_workspace,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE', colors.bg},
|
||||||
|
highlight = {colors.grey, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.left, {
|
||||||
|
DiffAdd = {
|
||||||
|
provider = 'DiffAdd',
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
icon = ' ',
|
||||||
|
highlight = {colors.green, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
table.insert(gls.left, {
|
||||||
|
DiffModified = {
|
||||||
|
provider = 'DiffModified',
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
icon = ' 柳',
|
||||||
|
highlight = {colors.blue, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
table.insert(gls.left, {
|
||||||
|
DiffRemove = {
|
||||||
|
provider = 'DiffRemove',
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
icon = ' ',
|
||||||
|
highlight = {colors.red, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.right, {
|
||||||
|
DiagnosticError = {provider = 'DiagnosticError', icon = ' ', highlight = {colors.error_red, colors.bg}}
|
||||||
|
})
|
||||||
|
table.insert(gls.right, {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = ' ', highlight = {colors.orange, colors.bg}}})
|
||||||
|
|
||||||
|
table.insert(gls.right, {
|
||||||
|
DiagnosticHint = {provider = 'DiagnosticHint', icon = ' ', highlight = {colors.vivid_blue, colors.bg}}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.right, {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = ' ', highlight = {colors.info_yellow, colors.bg}}})
|
||||||
|
|
||||||
|
table.insert(gls.right, {
|
||||||
|
TreesitterIcon = {
|
||||||
|
provider = function()
|
||||||
|
if next(vim.treesitter.highlighter.active) ~= nil then return ' ' end
|
||||||
|
return ''
|
||||||
|
end,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE', colors.bg},
|
||||||
|
highlight = {colors.green, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.right, {
|
||||||
|
ShowLspClient = {
|
||||||
|
provider = 'GetLspClient',
|
||||||
|
condition = function()
|
||||||
|
local tbl = {['dashboard'] = true, [' '] = true}
|
||||||
|
if tbl[vim.bo.filetype] then return false end
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
icon = ' ',
|
||||||
|
highlight = {colors.grey, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.right, {
|
||||||
|
LineInfo = {
|
||||||
|
provider = 'LineColumn',
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE', colors.bg},
|
||||||
|
highlight = {colors.grey, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.right, {
|
||||||
|
PerCent = {
|
||||||
|
provider = 'LinePercent',
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE', colors.bg},
|
||||||
|
highlight = {colors.grey, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.right, {
|
||||||
|
Tabstop = {
|
||||||
|
provider = function()
|
||||||
|
return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " "
|
||||||
|
end,
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE', colors.bg},
|
||||||
|
highlight = {colors.grey, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.right, {
|
||||||
|
BufferType = {
|
||||||
|
provider = 'FileTypeName',
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE', colors.bg},
|
||||||
|
highlight = {colors.grey, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.right, {
|
||||||
|
FileEncode = {
|
||||||
|
provider = 'FileEncode',
|
||||||
|
condition = condition.hide_in_width,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE', colors.bg},
|
||||||
|
highlight = {colors.grey, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.right, {
|
||||||
|
Space = {
|
||||||
|
provider = function()
|
||||||
|
return ' '
|
||||||
|
end,
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE', colors.bg},
|
||||||
|
highlight = {colors.orange, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.short_line_left, {
|
||||||
|
BufferType = {
|
||||||
|
provider = 'FileTypeName',
|
||||||
|
separator = ' ',
|
||||||
|
separator_highlight = {'NONE', colors.bg},
|
||||||
|
highlight = {colors.grey, colors.bg}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
table.insert(gls.short_line_left, {
|
||||||
|
SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.grey, colors.bg}}
|
||||||
|
})
|
||||||
|
|
||||||
|
--table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}})
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
require('gitsigns').setup {
|
||||||
|
signs = {
|
||||||
|
-- TODO add hl to colorscheme
|
||||||
|
add = {hl = 'GitSignsAdd' , text = '▎', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'},
|
||||||
|
change = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
|
||||||
|
delete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
|
||||||
|
topdelete = {hl = 'GitSignsDelete', text = '契', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
|
||||||
|
changedelete = {hl = 'GitSignsChange', text = '▎', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
|
||||||
|
},
|
||||||
|
numhl = false,
|
||||||
|
linehl = false,
|
||||||
|
keymaps = {
|
||||||
|
-- Default keymap options
|
||||||
|
noremap = true,
|
||||||
|
buffer = true,
|
||||||
|
},
|
||||||
|
watch_index = {
|
||||||
|
interval = 1000
|
||||||
|
},
|
||||||
|
sign_priority = 6,
|
||||||
|
update_debounce = 200,
|
||||||
|
status_formatter = nil, -- Use default
|
||||||
|
use_decoration_api = false
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {silent = true})
|
||||||
|
vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {silent = true})
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
-- source plugin config
|
||||||
|
|
||||||
|
require('pluginconfig/barbar')
|
||||||
|
require('pluginconfig/dashboard-nvim')
|
||||||
|
require('pluginconfig/galaxyline')
|
||||||
|
require('pluginconfig/gitsigns')
|
||||||
|
require('pluginconfig/hop')
|
||||||
|
-- require('pluginconfig/lspinstall')
|
||||||
|
require('pluginconfig/numb')
|
||||||
|
require('pluginconfig/nvim-autopairs')
|
||||||
|
require('pluginconfig/nvim-colorizer')
|
||||||
|
require('pluginconfig/nvim-compe')
|
||||||
|
require('pluginconfig/fzf-lua')
|
||||||
|
require('pluginconfig/nvim-tree') -- This plugin must be required somewhere before colorscheme. Placing it after will break navigation keymappings
|
||||||
|
require('pluginconfig/nvim-treesitter')
|
||||||
|
require('pluginconfig/rnvimr')
|
||||||
|
require('pluginconfig/symbols-outline')
|
||||||
|
require('pluginconfig/telescope')
|
||||||
|
require('pluginconfig/toggleterm')
|
||||||
|
require('pluginconfig/vim-matchup')
|
||||||
|
require('pluginconfig/which-key')
|
||||||
|
|
||||||
|
|
||||||
|
-- nvim_comment
|
||||||
|
require('nvim_comment').setup()
|
||||||
|
|
||||||
|
-- lsp-rooter
|
||||||
|
require("lsp-rooter").setup {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
}
|
||||||
|
|
||||||
|
-- lsp signature
|
||||||
|
require("lsp_signature").setup()
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
-- 1. get the config for this server from nvim-lspconfig and adjust the cmd path.
|
||||||
|
-- relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us!
|
||||||
|
local config = require'lspconfig'.jdtls.document_config
|
||||||
|
require'lspconfig/configs'.jdtls = nil -- important, unset the loaded config again
|
||||||
|
-- config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server"
|
||||||
|
|
||||||
|
-- 2. extend the config with an install_script and (optionally) uninstall_script
|
||||||
|
require'lspinstall/servers'.jdtls = vim.tbl_extend('error', config, {
|
||||||
|
-- lspinstall will automatically create/delete the install directory for every server
|
||||||
|
install_script = [[
|
||||||
|
git clone https://github.com/eclipse/eclipse.jdt.ls.git
|
||||||
|
cd eclipse.jdt.ls
|
||||||
|
./mvnw clean verify
|
||||||
|
]],
|
||||||
|
uninstall_script = nil -- can be omitted
|
||||||
|
})
|
||||||
|
|
||||||
|
require'lspinstall/servers'.kotlin = vim.tbl_extend('error', config, {
|
||||||
|
install_script = [[
|
||||||
|
git clone https://github.com/fwcd/kotlin-language-server.git language-server
|
||||||
|
cd language-server
|
||||||
|
./gradlew :server:installDist
|
||||||
|
]],
|
||||||
|
uninstall_script = nil -- can be omitted
|
||||||
|
})
|
||||||
|
|
||||||
|
require'lspinstall'.setup()
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
require('numb').setup{
|
||||||
|
show_numbers = true, -- Enable 'number' for the window while peeking
|
||||||
|
show_cursorline = true -- Enable 'cursorline' for the window while peeking
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
-- require('nvim-autopairs').setup()
|
||||||
|
-- local npairs = require('nvim-autopairs')
|
||||||
|
|
||||||
|
-- local function imap(lhs, rhs, opts)
|
||||||
|
-- local options = {noremap = false}
|
||||||
|
-- if opts then options = vim.tbl_extend('force', options, opts) end
|
||||||
|
-- vim.api.nvim_set_keymap('i', lhs, rhs, options)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- _G.MUtils = {}
|
||||||
|
|
||||||
|
-- -- TEST
|
||||||
|
-- vim.g.completion_confirm_key = ""
|
||||||
|
-- MUtils.completion_confirm = function()
|
||||||
|
-- if vim.fn.pumvisible() ~= 0 then
|
||||||
|
-- if vim.fn.complete_info()["selected"] ~= -1 then
|
||||||
|
-- vim.fn["compe#confirm"]()
|
||||||
|
-- -- return npairs.esc("<c-y>")
|
||||||
|
-- return npairs.esc("")
|
||||||
|
-- else
|
||||||
|
-- vim.defer_fn(function()
|
||||||
|
-- vim.fn["compe#confirm"]("<cr>")
|
||||||
|
-- end, 20)
|
||||||
|
-- return npairs.esc("<c-n>")
|
||||||
|
-- end
|
||||||
|
-- else
|
||||||
|
-- return npairs.check_break_line_char()
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- -- TEST
|
||||||
|
|
||||||
|
-- MUtils.completion_confirm = function()
|
||||||
|
-- if vim.fn.pumvisible() ~= 0 then
|
||||||
|
-- if vim.fn.complete_info()["selected"] ~= -1 then
|
||||||
|
-- vim.fn["compe#confirm"]()
|
||||||
|
-- return npairs.esc("")
|
||||||
|
-- else
|
||||||
|
-- vim.api.nvim_select_popupmenu_item(0, false, false, {})
|
||||||
|
-- vim.fn["compe#confirm"]()
|
||||||
|
-- return npairs.esc("<c-n>")
|
||||||
|
-- end
|
||||||
|
-- else
|
||||||
|
-- return npairs.check_break_line_char()
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- MUtils.tab = function()
|
||||||
|
-- if vim.fn.pumvisible() ~= 0 then
|
||||||
|
-- return npairs.esc("<C-n>")
|
||||||
|
-- else
|
||||||
|
-- if vim.fn["vsnip#available"](1) ~= 0 then
|
||||||
|
-- vim.fn.feedkeys(string.format('%c%c%c(vsnip-expand-or-jump)', 0x80, 253, 83))
|
||||||
|
-- return npairs.esc("")
|
||||||
|
-- else
|
||||||
|
-- return npairs.esc("<Tab>")
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- MUtils.s_tab = function()
|
||||||
|
-- if vim.fn.pumvisible() ~= 0 then
|
||||||
|
-- return npairs.esc("<C-p>")
|
||||||
|
-- else
|
||||||
|
-- if vim.fn["vsnip#jumpable"](-1) ~= 0 then
|
||||||
|
-- vim.fn.feedkeys(string.format('%c%c%c(vsnip-jump-prev)', 0x80, 253, 83))
|
||||||
|
-- return npairs.esc("")
|
||||||
|
-- else
|
||||||
|
-- return npairs.esc("<C-h>")
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- -- Autocompletion and snippets
|
||||||
|
-- vim.api.nvim_set_keymap('i', '<CR>', 'v:lua.MUtils.completion_confirm()', {expr = true, noremap = true})
|
||||||
|
-- -- imap("<CR>", "v:lua.MUtils.completion_confirm()", {expr = true, noremap = true})
|
||||||
|
-- imap("<Tab>", "v:lua.MUtils.tab()", {expr = true, noremap = true})
|
||||||
|
-- imap("<S-Tab>", "v:lua.MUtils.s_tab()", {expr = true, noremap = true})
|
||||||
|
|
||||||
|
local remap = vim.api.nvim_set_keymap
|
||||||
|
local npairs = require('nvim-autopairs')
|
||||||
|
local Rule = require('nvim-autopairs.rule')
|
||||||
|
|
||||||
|
-- skip it, if you use another global object
|
||||||
|
_G.MUtils= {}
|
||||||
|
|
||||||
|
vim.g.completion_confirm_key = ""
|
||||||
|
MUtils.completion_confirm=function()
|
||||||
|
if vim.fn.pumvisible() ~= 0 then
|
||||||
|
if vim.fn.complete_info()["selected"] ~= -1 then
|
||||||
|
return vim.fn["compe#confirm"](npairs.esc("<cr>"))
|
||||||
|
else
|
||||||
|
return npairs.esc("<cr>")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return npairs.autopairs_cr()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
remap('i' , '<CR>','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true})
|
||||||
|
|
||||||
|
npairs.setup({
|
||||||
|
check_ts = true,
|
||||||
|
ts_config = {
|
||||||
|
lua = {'string'},-- it will not add pair on that treesitter node
|
||||||
|
javascript = {'template_string'},
|
||||||
|
java = false,-- don't check treesitter on java
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
autopairs = {enable = true}
|
||||||
|
}
|
||||||
|
|
||||||
|
local ts_conds = require('nvim-autopairs.ts-conds')
|
||||||
|
|
||||||
|
-- press % => %% is only inside comment or string
|
||||||
|
npairs.add_rules({
|
||||||
|
Rule("%", "%", "lua")
|
||||||
|
:with_pair(ts_conds.is_ts_node({'string','comment'})),
|
||||||
|
Rule("$", "$", "lua")
|
||||||
|
:with_pair(ts_conds.is_not_ts_node({'function'}))
|
||||||
|
})
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
require'colorizer'.setup(
|
||||||
|
{'*';},
|
||||||
|
{
|
||||||
|
RGB = true; -- #RGB hex codes
|
||||||
|
RRGGBB = true; -- #RRGGBB hex codes
|
||||||
|
RRGGBBAA = true; -- #RRGGBBAA hex codes
|
||||||
|
rgb_fn = true; -- CSS rgb() and rgba() functions
|
||||||
|
hsl_fn = true; -- CSS hsl() and hsla() functions
|
||||||
|
css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||||
|
css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||||
|
})
|
||||||
|
-- names = true; -- "Name" codes like Blue
|
||||||
|
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
vim.o.completeopt = "menuone,noselect"
|
||||||
|
|
||||||
|
require'compe'.setup {
|
||||||
|
enabled = true,
|
||||||
|
autocomplete = true,
|
||||||
|
debug = false,
|
||||||
|
min_length = 1,
|
||||||
|
preselect = 'enable',
|
||||||
|
throttle_time = 80,
|
||||||
|
source_timeout = 200,
|
||||||
|
incomplete_delay = 400,
|
||||||
|
max_abbr_width = 100,
|
||||||
|
max_kind_width = 100,
|
||||||
|
max_menu_width = 100,
|
||||||
|
documentation = true,
|
||||||
|
|
||||||
|
source = {
|
||||||
|
path = {kind = " (Path)"},
|
||||||
|
buffer = {kind = " (Buffer)"},
|
||||||
|
calc = {kind = " (Calc)"},
|
||||||
|
vsnip = {kind = " (Snippet)"},
|
||||||
|
nvim_lsp = {kind = " (LSP)"},
|
||||||
|
-- nvim_lua = {kind = " "},
|
||||||
|
nvim_lua = false,
|
||||||
|
spell = {kind = " (Spell)"},
|
||||||
|
tags = false,
|
||||||
|
vim_dadbod_completion = true,
|
||||||
|
-- snippets_nvim = {kind = " "},
|
||||||
|
-- ultisnips = {kind = " "},
|
||||||
|
-- treesitter = {kind = " "},
|
||||||
|
emoji = {kind = " ﲃ (Emoji)", filetypes={"markdown", "text"}}
|
||||||
|
-- for emoji press : (idk if that in compe tho)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- m
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
|
||||||
|
-- local t = function(str)
|
||||||
|
-- return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- local check_back_space = function()
|
||||||
|
-- local col = vim.fn.col('.') - 1
|
||||||
|
-- if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||||
|
-- return true
|
||||||
|
-- else
|
||||||
|
-- return false
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- -- Use (s-)tab to:
|
||||||
|
-- --- move to prev/next item in completion menuone
|
||||||
|
-- --- jump to prev/next snippet's placeholder
|
||||||
|
-- _G.tab_complete = function()
|
||||||
|
-- if vim.fn.pumvisible() == 1 then
|
||||||
|
-- return t "<C-n>"
|
||||||
|
-- elseif vim.fn.call("vsnip#available", {1}) == 1 then
|
||||||
|
-- return t "<Plug>(vsnip-expand-or-jump)"
|
||||||
|
-- elseif check_back_space() then
|
||||||
|
-- return t "<Tab>"
|
||||||
|
-- else
|
||||||
|
-- return vim.fn['compe#complete']()
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- _G.s_tab_complete = function()
|
||||||
|
-- if vim.fn.pumvisible() == 1 then
|
||||||
|
-- return t "<C-p>"
|
||||||
|
-- elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
||||||
|
-- return t "<Plug>(vsnip-jump-prev)"
|
||||||
|
-- else
|
||||||
|
-- return t "<S-Tab>"
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
-- vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
-- vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
-- vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local t = function(str)
|
||||||
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
local check_back_space = function()
|
||||||
|
local col = vim.fn.col('.') - 1
|
||||||
|
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use (s-)tab to:
|
||||||
|
--- move to prev/next item in completion menuone
|
||||||
|
--- jump to prev/next snippet's placeholder
|
||||||
|
_G.tab_complete = function()
|
||||||
|
if vim.fn.pumvisible() == 1 then
|
||||||
|
return t "<C-n>"
|
||||||
|
elseif vim.fn.call("vsnip#available", {1}) == 1 then
|
||||||
|
return t "<Plug>(vsnip-expand-or-jump)"
|
||||||
|
elseif check_back_space() then
|
||||||
|
return t "<Tab>"
|
||||||
|
else
|
||||||
|
return vim.fn['compe#complete']()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
_G.s_tab_complete = function()
|
||||||
|
if vim.fn.pumvisible() == 1 then
|
||||||
|
return t "<C-p>"
|
||||||
|
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
||||||
|
return t "<Plug>(vsnip-jump-prev)"
|
||||||
|
else
|
||||||
|
return t "<S-Tab>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
|
||||||
|
require'nvim-tree'.setup {
|
||||||
|
disable_netrw = true,
|
||||||
|
hijack_netrw = true,
|
||||||
|
auto_close = false,
|
||||||
|
filters = {
|
||||||
|
dotfiles = false,
|
||||||
|
custom = {}
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
enable = true,
|
||||||
|
ignore = false,
|
||||||
|
timeout = 500,
|
||||||
|
},
|
||||||
|
update_focused_file = {
|
||||||
|
-- enables the feature
|
||||||
|
enable = false,
|
||||||
|
-- update the root directory of the tree to the one of the folder containing the file if the file is not under the current root directory
|
||||||
|
-- only relevant when `update_focused_file.enable` is true
|
||||||
|
update_cwd = false,
|
||||||
|
-- list of buffer names / filetypes that will not update the cwd if the file isn't found under the current root directory
|
||||||
|
-- only relevant when `update_focused_file.update_cwd` is true and `update_focused_file.enable` is true
|
||||||
|
ignore_list = {}
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
mappings = {
|
||||||
|
custome_only= false,
|
||||||
|
list = {
|
||||||
|
-- ["<CR>"] = ":YourVimFunction()<cr>",
|
||||||
|
-- ["u"] = ":lua require'some_module'.some_function()<cr>",
|
||||||
|
|
||||||
|
-- default mappings
|
||||||
|
{key="<CR>" ,cb= tree_cb("edit")},
|
||||||
|
{key="o" ,cb= tree_cb("edit")},
|
||||||
|
{key="l" ,cb= tree_cb("edit")},
|
||||||
|
{key="<2-LeftMouse>" ,cb= tree_cb("edit")},
|
||||||
|
{key="<2-RightMouse>" ,cb= tree_cb("cd")},
|
||||||
|
{key="<C->" ,cb= tree_cb("cd")},
|
||||||
|
{key="v" ,cb= tree_cb("vsplit")},
|
||||||
|
{key="s" ,cb= tree_cb("split")},
|
||||||
|
{key="<C-t>" ,cb= tree_cb("tabnew")},
|
||||||
|
{key="<" ,cb= tree_cb("prev_sibling")},
|
||||||
|
{key=">" ,cb= tree_cb("next_sibling")},
|
||||||
|
{key="<BS>" ,cb= tree_cb("close_node")},
|
||||||
|
{key="h" ,cb= tree_cb("close_node")},
|
||||||
|
{key="<S-CR>" ,cb= tree_cb("close_node")},
|
||||||
|
{key="<Tab>" ,cb= tree_cb("preview")},
|
||||||
|
{key="I" ,cb= tree_cb("toggle_ignored")},
|
||||||
|
{key="H" ,cb= tree_cb("toggle_dotfiles")},
|
||||||
|
{key="R" ,cb= tree_cb("refresh")},
|
||||||
|
{key="a" ,cb= tree_cb("create")},
|
||||||
|
{key="d" ,cb= tree_cb("remove")},
|
||||||
|
{key="r" ,cb= tree_cb("rename")},
|
||||||
|
{key="<C-r>" ,cb= tree_cb("full_rename")},
|
||||||
|
{key="x" ,cb= tree_cb("cut")},
|
||||||
|
{key="c" ,cb= tree_cb("copy")},
|
||||||
|
{key="p" ,cb= tree_cb("paste")},
|
||||||
|
{key="[c" ,cb= tree_cb("prev_git_item")},
|
||||||
|
{key="c" ,cb= tree_cb("next_git_item")},
|
||||||
|
{key="-" ,cb= tree_cb("dir_up")},
|
||||||
|
{key="q" ,cb= tree_cb("close")},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.g.nvim_tree_indent_markers = 1 -- "0 by default, this option shows indent markers when folders are open
|
||||||
|
vim.g.nvim_tree_auto_ignore_ft = 'startify' --empty by default, don't auto open tree on specific filetypes.
|
||||||
|
|
||||||
|
vim.g.nvim_tree_icons = {
|
||||||
|
default = '',
|
||||||
|
symlink = '',
|
||||||
|
git = {unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = ""},
|
||||||
|
folder = {default = "", open = "", empty = "", empty_open = "", symlink = ""}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
local treesitter = {
|
||||||
|
ensure_installed = "all",
|
||||||
|
ignore_install = {"haskell"},
|
||||||
|
highlight = {enabled = true},
|
||||||
|
playground = {enabled = true},
|
||||||
|
rainbow = {enabled = false},
|
||||||
|
}
|
||||||
|
|
||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
ensure_installed = treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||||
|
ignore_install = treesitter.ignore_install,
|
||||||
|
matchup = {
|
||||||
|
enable = true, -- mandatory, false will disable the whole extension
|
||||||
|
-- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
|
||||||
|
},
|
||||||
|
highlight = {
|
||||||
|
enable = treesitter.highlight.enabled -- false will disable the whole extension
|
||||||
|
},
|
||||||
|
context_commentstring = {
|
||||||
|
enable = true,
|
||||||
|
config = {
|
||||||
|
css = '// %s'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- indent = {enable = true, disable = {"python", "html", "javascript"}},
|
||||||
|
-- TODO seems to be broken
|
||||||
|
indent = {enable = {"javascriptreact"}},
|
||||||
|
autotag = {enable = true},
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
-- Make Ranger replace netrw and be the file explorer
|
||||||
|
-- vim.g.rnvimr_ex_enable = 1
|
||||||
|
vim.g.rnvimr_draw_border = 1
|
||||||
|
vim.g.rnvimr_pick_enable = 1
|
||||||
|
vim.g.rnvimr_bw_enable = 1
|
||||||
|
vim.api.nvim_set_keymap('n', '-', ':RnvimrToggle<CR>', {noremap = true, silent = true})
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
vim.g.symbols_outline = {
|
||||||
|
highlight_hovered_item = true,
|
||||||
|
show_guides = true,
|
||||||
|
auto_preview = true,
|
||||||
|
position = 'right',
|
||||||
|
keymaps = {
|
||||||
|
close = "<Esc>",
|
||||||
|
goto_location = "<Cr>",
|
||||||
|
focus_location = "o",
|
||||||
|
hover_symbol = "<C-space>",
|
||||||
|
rename_symbol = "r",
|
||||||
|
code_actions = "a",
|
||||||
|
},
|
||||||
|
lsp_blacklist = {},
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
local actions = require('telescope.actions')
|
||||||
|
local trouble = require("trouble.providers.telescope")
|
||||||
|
-- Global remapping
|
||||||
|
------------------------------
|
||||||
|
-- '--color=never',
|
||||||
|
require('telescope').setup {
|
||||||
|
defaults = {
|
||||||
|
--find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'},
|
||||||
|
vimgrep_arguments = { 'rg', '--color=never', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' },
|
||||||
|
-- prompt_prefix = " ",
|
||||||
|
prompt_prefix = " ",
|
||||||
|
selection_caret = " ",
|
||||||
|
entry_prefix = " ",
|
||||||
|
initial_mode = "insert",
|
||||||
|
-- initial_mode = "insert",
|
||||||
|
selection_strategy = "reset",
|
||||||
|
sorting_strategy = "descending",
|
||||||
|
layout_strategy = "horizontal",
|
||||||
|
layout_config= {horizontal = {mirror = false}, vertical = {mirror = false}, width = 0.75,prompt_position = "bottom", preview_cutoff = 120},
|
||||||
|
file_sorter = require'telescope.sorters'.get_fzy_sorter,
|
||||||
|
file_ignore_patterns = {},
|
||||||
|
generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
|
||||||
|
-- shorten_path = true,
|
||||||
|
path_display = {shroten = 2},
|
||||||
|
winblend = 0,
|
||||||
|
border = {},
|
||||||
|
borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'},
|
||||||
|
color_devicons = true,
|
||||||
|
use_less = true,
|
||||||
|
set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil,
|
||||||
|
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
|
||||||
|
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
|
||||||
|
qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
|
||||||
|
|
||||||
|
-- Developer configurations: Not meant for general override
|
||||||
|
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker,
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<C-c>"] = actions.close,
|
||||||
|
["<ESC>"] = actions.close,
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
["<c-t>"] = trouble.open_with_trouble,
|
||||||
|
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||||
|
-- To disable a keymap, put [map] = false
|
||||||
|
-- So, to not map "<C-n>", just put
|
||||||
|
-- ["<c-x>"] = false,
|
||||||
|
-- ["<esc>"] = actions.close,
|
||||||
|
|
||||||
|
-- Otherwise, just set the mapping to the function that you want it to be.
|
||||||
|
-- ["<C-i>"] = actions.select_horizontal,
|
||||||
|
|
||||||
|
-- Add up multiple actions
|
||||||
|
["<CR>"] = actions.select_default + actions.center
|
||||||
|
|
||||||
|
-- You can perform as many actions in a row as you like
|
||||||
|
-- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
|
||||||
|
},
|
||||||
|
n = {
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
["<c-t>"] = trouble.open_with_trouble,
|
||||||
|
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist
|
||||||
|
-- ["<C-i>"] = my_cool_custom_action,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true, -- false will only do exact matching
|
||||||
|
override_generic_sorter = true, -- override the generic sorter
|
||||||
|
override_file_sorter = true, -- override the file sorter
|
||||||
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||||
|
-- the default case_mode is "smart_case"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--require('telescope').load_extension('fzf')
|
||||||
|
require'telescope'.load_extension('project')
|
||||||
|
require("telescope").load_extension "file_browser"
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
require("toggleterm").setup{
|
||||||
|
-- size can be a number or function which is passed the current terminal
|
||||||
|
size = function(term)
|
||||||
|
if term.direction == "horizontal" then
|
||||||
|
return 15
|
||||||
|
elseif term.direction == "vertical" then
|
||||||
|
return vim.o.columns * 0.4
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
open_mapping = [[<c-\>]],
|
||||||
|
hide_numbers = true, -- hide the number column in toggleterm buffers
|
||||||
|
shade_filetypes = {},
|
||||||
|
shade_terminals = true,
|
||||||
|
shading_factor = '<number>', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
|
||||||
|
start_in_insert = true,
|
||||||
|
insert_mappings = true, -- whether or not the open mapping applies in insert mode
|
||||||
|
persist_size = true,
|
||||||
|
-- direction = 'vertical' | 'horizontal' | 'window' | 'float',
|
||||||
|
direction = 'float',
|
||||||
|
close_on_exit = true, -- close the terminal window when the process exits
|
||||||
|
shell = vim.o.shell, -- change the default shell
|
||||||
|
-- This field is only relevant if direction is set to 'float'
|
||||||
|
float_opts = {
|
||||||
|
-- The border key is *almost* the same as 'nvim_open_win'
|
||||||
|
-- see :h nvim_open_win for details on borders however
|
||||||
|
-- the 'curved' border is a custom border type
|
||||||
|
-- not natively supported but implemented in this plugin.
|
||||||
|
-- border = 'single' | 'double' | 'shadow' | 'curved' -- ... other options supported by win open
|
||||||
|
border = 'single',
|
||||||
|
-- width = <value>,
|
||||||
|
-- height = <value>,
|
||||||
|
winblend = 3,
|
||||||
|
highlights = {
|
||||||
|
border = "Normal",
|
||||||
|
background = "Normal",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- function _G.set_terminal_keymaps()
|
||||||
|
-- local opts = {noremap = true}
|
||||||
|
-- vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
|
||||||
|
-- vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[<C-\><C-n>]], opts)
|
||||||
|
-- vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
|
||||||
|
-- vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
|
||||||
|
-- vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
|
||||||
|
-- vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
vim.g.matchup_matchparen_offscreen = {method = 'popup'}
|
||||||
|
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
require("which-key").setup {
|
||||||
|
plugins = {
|
||||||
|
marks = true, -- shows a list of your marks on ' and `
|
||||||
|
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||||
|
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
||||||
|
-- No actual key bindings are created
|
||||||
|
presets = {
|
||||||
|
operators = false, -- adds help for operators like d, y, ...
|
||||||
|
motions = false, -- adds help for motions
|
||||||
|
text_objects = false, -- help for text objects triggered after entering an operator
|
||||||
|
windows = true, -- default bindings on <c-w>
|
||||||
|
nav = true, -- misc bindings to work with windows
|
||||||
|
z = true, -- bindings for folds, spelling and others prefixed with z
|
||||||
|
g = true -- bindings for prefixed with g
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icons = {
|
||||||
|
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||||
|
separator = "➜", -- symbol used between a key and it's label
|
||||||
|
group = "+" -- symbol prepended to a group
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
border = "single", -- none, single, double, shadow
|
||||||
|
position = "bottom", -- bottom, top
|
||||||
|
margin = {1, 0, 1, 0}, -- extra window margin [top, right, bottom, left]
|
||||||
|
padding = {2, 2, 2, 2} -- extra window padding [top, right, bottom, left]
|
||||||
|
},
|
||||||
|
layout = {
|
||||||
|
height = {min = 4, max = 25}, -- min and max height of the columns
|
||||||
|
width = {min = 20, max = 50}, -- min and max width of the columns
|
||||||
|
spacing = 3 -- spacing between columns
|
||||||
|
},
|
||||||
|
hidden = {"<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ "}, -- hide mapping boilerplate
|
||||||
|
show_help = true -- show help message on the command line when the popup is visible
|
||||||
|
}
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
mode = "n", -- NORMAL mode
|
||||||
|
prefix = "<leader>",
|
||||||
|
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||||
|
silent = true, -- use `silent` when creating keymaps
|
||||||
|
noremap = true, -- use `noremap` when creating keymaps
|
||||||
|
nowait = false -- use `nowait` when creating keymaps
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Set leader
|
||||||
|
vim.api.nvim_set_keymap('n', '<Space>', '<NOP>', {noremap = true, silent = true})
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
|
-- no hl
|
||||||
|
vim.api.nvim_set_keymap('n', '<Leader>h', ':set hlsearch!<CR>', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- explorer
|
||||||
|
vim.api.nvim_set_keymap('n', '<Leader>e', ':NvimTreeToggle<CR>', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- telescope
|
||||||
|
--vim.api.nvim_set_keymap('n', '<C-p>', ":lua require 'telescope'.extensions.file_browser.file_browser()<CR>", {noremap = true, silent = true})
|
||||||
|
-- vim.api.nvim_set_keymap('n', '<C-p>', ":lua require'telescope.builtin'.find_files()<CR>", {noremap = true, silent = true})
|
||||||
|
vim.api.nvim_set_keymap('n', '<C-p>', ":FzfLua files<CR>", {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- dashboard
|
||||||
|
vim.api.nvim_set_keymap('n', '<Leader>;', ':Dashboard<CR>', {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- Comments
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>b/", ":CommentToggle<CR>", {noremap = true, silent = true})
|
||||||
|
vim.api.nvim_set_keymap("v", "<Leader>b/", ":CommentToggle<CR>", {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- close buffer
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", {noremap = true, silent = true})
|
||||||
|
|
||||||
|
-- open projects
|
||||||
|
--vim.api.nvim_set_keymap('n', '<leader>p', ":lua require'telescope'.extensions.project.project{}<CR>", {noremap = true, silent = true})
|
||||||
|
-- vim.api.nvim_set_keymap('n', '<leader>p', ":lua require 'telescope'.extensions.file_browser.file_browser()<CR>", {noremap = true, silent = true})
|
||||||
|
-- TODO create entire treesitter section
|
||||||
|
|
||||||
|
local mappings = {
|
||||||
|
-- ["/"] = "Comment",
|
||||||
|
-- ["c"] = "Close Buffer",
|
||||||
|
["e"] = "Explorer",
|
||||||
|
-- ["f"] = "Find File",
|
||||||
|
["h"] = "No Highlight",
|
||||||
|
a = {
|
||||||
|
name = "+Action",
|
||||||
|
a = {"<cmd>@:<cr>","execute last command again"}
|
||||||
|
},
|
||||||
|
b = {
|
||||||
|
name = "+Buffer",
|
||||||
|
n = {"<cmd>BufferNext<cr>", "next buffer"},
|
||||||
|
p = {"<cmd>BufferPrevious<cr>", "previous buffer"},
|
||||||
|
q = {"<cmd>q<cr>", "quit"},
|
||||||
|
s = {"<cmd>w<cr>", "save"},
|
||||||
|
r = {"<cmd>e!<cr>", "reload"},
|
||||||
|
d = {"<cmd>BufferClose<cr>", "close buffer"},
|
||||||
|
z = {"<cmd>CommentToggle<CR>", "toggle comment"},
|
||||||
|
},
|
||||||
|
D = {
|
||||||
|
name = "+Diagnostics",
|
||||||
|
t = {"<cmd>TroubleToggle<cr>", "trouble"},
|
||||||
|
w = {"<cmd>TroubleToggle lsp_workspace_diagnostics<cr>", "workspace"},
|
||||||
|
d = {"<cmd>TroubleToggle lsp_document_diagnostics<cr>", "document"},
|
||||||
|
q = {"<cmd>TroubleToggle quickfix<cr>", "quickfix"},
|
||||||
|
l = {"<cmd>TroubleToggle loclist<cr>", "loclist"},
|
||||||
|
r = {"<cmd>TroubleToggle lsp_references<cr>", "references"},
|
||||||
|
},
|
||||||
|
d = {
|
||||||
|
name = "+Debug",
|
||||||
|
-- b = {"<cmd>DebugToggleBreakpoint<cr>", "Toggle Breakpoint"},
|
||||||
|
-- c = {"<cmd>DebugContinue<cr>", "Continue"},
|
||||||
|
-- i = {"<cmd>DebugStepInto<cr>", "Step Into"},
|
||||||
|
-- o = {"<cmd>DebugStepOver<cr>", "Step Over"},
|
||||||
|
-- r = {"<cmd>DebugToggleRepl<cr>", "Toggle Repl"},
|
||||||
|
-- s = {"<cmd>DebugStart<cr>", "Start"}
|
||||||
|
d = {"<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<cr>", "show diagnostics"},
|
||||||
|
|
||||||
|
c = {"<cmd>lua require'dap'.continue()<cr>", "continue"},
|
||||||
|
b = {':lua require"dap".toggle_breakpoint()<CR>', "Toggle Breadpoint"},
|
||||||
|
j = {':lua require"dap".step_over()<CR>', "step over"},
|
||||||
|
k = {':lua require"dap".step_out()<CR>', "step out"},
|
||||||
|
l = {':lua require"dap".step_into()<CR>',"step into"},
|
||||||
|
--<c-h>', ':lua require"dap".continue()<CR>')
|
||||||
|
u = {':lua require"dap".up()<CR>', "up"},
|
||||||
|
-- d = {':lua require"dap".down()<CR>', "down"},
|
||||||
|
_ = {':lua require"dap".disconnect();require"dap".stop();require"dap".run_last()<CR>', "disconnect"},
|
||||||
|
--r = {':lua require"dap".repl.open({}, "vsplit")<CR><C-w>l', "repl open"},
|
||||||
|
i = {':lua require"dap.ui.variables".visual_hover()<CR>',"visual_hover"},
|
||||||
|
--? = {':lua require"dap.ui.variables".scopes()<CR>',"scopes"},
|
||||||
|
-- e = {':lua require"dap".set_exception_breakpoints({"all"})<CR>',"esception bp"},
|
||||||
|
-- a = {':lua require"debugHelper".attach()<CR>',"attach"},
|
||||||
|
-- A = {':lua require"debugHelper".attachToRemote()<CR>',"attach to remote"},
|
||||||
|
s = {':lua local widgets=require"dap.ui.widgets";widgets.centered_float(widgets.scopes)<CR>',"centered_float"},
|
||||||
|
},
|
||||||
|
f = {
|
||||||
|
name = "+File",
|
||||||
|
s = {"<cmd>w<cr>", "save file"},
|
||||||
|
t = {"<cmd>NvimTreeToggle<cr>", "toggle nvim tree"},
|
||||||
|
r = {"<cmd>RnvimrToggle<cr>", "toggle rnvimr"},
|
||||||
|
y = {"<cmd>lua require'utils'.yank_filepath()<cr>", "copy the file path"},
|
||||||
|
l = {"<cmd>NvimTreeFindFile<CR>", "find file"},
|
||||||
|
-- T = {"<cmd>let @+ = 'go test -v -run='+expand('<cword>')<cr>", "get current word in go test"},
|
||||||
|
},
|
||||||
|
g = {
|
||||||
|
name = "+Git",
|
||||||
|
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
|
||||||
|
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
|
||||||
|
l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
|
||||||
|
p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
|
||||||
|
r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
|
||||||
|
R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
|
||||||
|
s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
|
||||||
|
u = {
|
||||||
|
"<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
|
||||||
|
"Undo Stage Hunk",
|
||||||
|
},
|
||||||
|
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
|
||||||
|
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
||||||
|
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
|
||||||
|
C = {
|
||||||
|
"<cmd>Telescope git_bcommits<cr>",
|
||||||
|
"Checkout commit(for current file)",
|
||||||
|
},
|
||||||
|
d = {
|
||||||
|
"<cmd>Gitsigns diffthis HEAD<cr>",
|
||||||
|
"Git Diff",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
l = {
|
||||||
|
name = "+Language",
|
||||||
|
a = {"<cmd>Lspsaga code_action<cr>", "Code Action"},
|
||||||
|
A = {"<cmd>Lspsaga range_code_action<cr>", "Selected Action"},
|
||||||
|
d = {"<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics"},
|
||||||
|
D = {"<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics"},
|
||||||
|
f = {"<cmd>LspFormatting<cr>", "Format"},
|
||||||
|
-- i = {"<cmd>Telescope lsp_implementations<cr>", "implement"},
|
||||||
|
i = {"<cmd>lua vim.lsp.buf.implementation()<cr>", "implement"},
|
||||||
|
F = {"<cmd>Lspsaga lsp_finder<cr>", "LSP Finder"},
|
||||||
|
L = {"<cmd>Lspsaga show_line_diagnostics<cr>", "Line Diagnostics"},
|
||||||
|
l = {"<cmd>lua vim.lsp.buf.hover()<cr>", "hover"},
|
||||||
|
P = {"<cmd>Lspsaga preview_definition<cr>", "Preview Definition"},
|
||||||
|
n = {"<cmd>lua vim.lsp.diagnostic.goto_next()<cr>", "next diagnostic"},
|
||||||
|
p = {"<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>", "prev diagnostic"},
|
||||||
|
q = {"<cmd>Telescope quickfix<cr>", "Quickfix"},
|
||||||
|
r = {"<cmd>lua vim.lsp.buf.references()<cr>", "references"},
|
||||||
|
R = {"<cmd>Lspsaga rename<cr>", "Rename"},
|
||||||
|
t = {"<cmd>LspTypeDefinition<cr>", "Type Definition"},
|
||||||
|
x = {"<cmd>cclose<cr>", "Close Quickfix"},
|
||||||
|
s = {"<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols"},
|
||||||
|
S = {"<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "Workspace Symbols"},
|
||||||
|
z = {"<cmd>LspInfo<cr>", "Info"},
|
||||||
|
},
|
||||||
|
p = {
|
||||||
|
name = "Packer",
|
||||||
|
c = { "<cmd>PackerCompile<cr>", "Compile" },
|
||||||
|
i = { "<cmd>PackerInstall<cr>", "Install" },
|
||||||
|
s = { "<cmd>PackerSync<cr>", "Sync" },
|
||||||
|
S = { "<cmd>PackerStatus<cr>", "Status" },
|
||||||
|
u = { "<cmd>PackerUpdate<cr>", "Update" },
|
||||||
|
},
|
||||||
|
q = {
|
||||||
|
name = "quit",
|
||||||
|
q = {"<cmd>qall<cr>", "quit"},
|
||||||
|
},
|
||||||
|
s = {
|
||||||
|
name = "+Search",
|
||||||
|
b = {"<cmd>Telescope git_branches<cr>", "Checkout branch"},
|
||||||
|
-- c = {"<cmd>Telescope colorscheme<cr>", "Colorscheme"},
|
||||||
|
c = {"<cmd>:nohl<cr>", "no highlight"},
|
||||||
|
d = {"<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics"},
|
||||||
|
D = {"<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics"},
|
||||||
|
f = {"<cmd>Fzflua files<cr>", "Find File"},
|
||||||
|
m = {"<cmd>Telescope marks<cr>", "Marks"},
|
||||||
|
M = {"<cmd>Telescope man_pages<cr>", "Man Pages"},
|
||||||
|
r = {"<cmd>FzfLua oldfiles<cr>", "Open Recent File"},
|
||||||
|
R = {"<cmd>Telescope registers<cr>", "Registers"},
|
||||||
|
t = {"<cmd>FzfLua live_grep<cr>", "Text"},
|
||||||
|
["#"] = {"<cmd>FzfLua grep_cword<cr>", "Search word under cursor"},
|
||||||
|
},
|
||||||
|
S = {
|
||||||
|
name = "+Session",
|
||||||
|
s = {"<cmd>SessionSave<cr>", "Save Session"},
|
||||||
|
l = {"<cmd>SessionLoad<cr>", "Load Session"},
|
||||||
|
},
|
||||||
|
t = {
|
||||||
|
name = "+Test",
|
||||||
|
a = {"<cmd>TestSuite -v -cover<cr>", "TestSuite"},
|
||||||
|
t = {"<cmd>TestNearest -v -cover<cr>", "TestNearest"},
|
||||||
|
f = {"<cmd>TestFile -v -cover<cr>", "TestFile"},
|
||||||
|
c = {"<cmd>GoCover<cr>", "go coverage"},
|
||||||
|
C = {"<cmd>GoCoverClear<cr>", "go coverage clear"},
|
||||||
|
b = {"<cmd>lua require'dap'.toggle_breakpoint()<cr>", "set break point"},
|
||||||
|
r = {"<cmd>lua require'dap'.continue()<cr>", "continue"},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- extras
|
||||||
|
z = {
|
||||||
|
name = "+Zen",
|
||||||
|
s = {"<cmd>TZBottom<cr>", "toggle status line"},
|
||||||
|
t = {"<cmd>TZTop<cr>", "toggle tab bar"},
|
||||||
|
z = {"<cmd>TZAtaraxis<cr>", "toggle zen"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local wk = require("which-key")
|
||||||
|
wk.register(mappings, opts)
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
local execute = vim.api.nvim_command
|
||||||
|
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
|
||||||
|
execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
|
||||||
|
execute "packadd packer.nvim"
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Check if a file or directory exists in this path
|
||||||
|
local function require_plugin(plugin)
|
||||||
|
local plugin_prefix = fn.stdpath("data") .. "/site/pack/packer/opt/"
|
||||||
|
|
||||||
|
local plugin_path = plugin_prefix .. plugin .. "/"
|
||||||
|
-- print('test '..plugin_path)
|
||||||
|
local ok, err, code = os.rename(plugin_path, plugin_path)
|
||||||
|
if not ok then
|
||||||
|
if code == 13 then
|
||||||
|
-- Permission denied, but it exists
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if ok then vim.cmd("packadd " .. plugin) end
|
||||||
|
if not ok then
|
||||||
|
print(ok, err, code)
|
||||||
|
end
|
||||||
|
return ok, err, code
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
|
||||||
|
|
||||||
|
return require("packer").startup(function(use)
|
||||||
|
-- Packer can manage itself as an optional plugin
|
||||||
|
use "wbthomason/packer.nvim"
|
||||||
|
|
||||||
|
-- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
|
||||||
|
use {"neovim/nvim-lspconfig", opt = true}
|
||||||
|
use {'tami5/lspsaga.nvim', branch = 'nvim6.0', opt=true}
|
||||||
|
use {"kabouzeid/nvim-lspinstall", opt = true}
|
||||||
|
use {"folke/trouble.nvim", opt = true}
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
use {"nvim-lua/popup.nvim", opt = true}
|
||||||
|
use {"nvim-lua/plenary.nvim", opt = true}
|
||||||
|
use {"nvim-telescope/telescope.nvim", opt = true}
|
||||||
|
use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
|
||||||
|
use {"nvim-telescope/telescope-project.nvim", opt = true}
|
||||||
|
use { "nvim-telescope/telescope-file-browser.nvim" }
|
||||||
|
|
||||||
|
use { 'ibhagwan/fzf-lua',
|
||||||
|
-- optional for icon support
|
||||||
|
requires = { 'kyazdani42/nvim-web-devicons' }
|
||||||
|
}
|
||||||
|
|
||||||
|
use {'folke/lua-dev.nvim'}
|
||||||
|
use {"rafcamlet/nvim-luapad"}
|
||||||
|
|
||||||
|
-- Debugging
|
||||||
|
use {"mfussenegger/nvim-dap", opt = true}
|
||||||
|
|
||||||
|
-- Autocomplete
|
||||||
|
use {"hrsh7th/nvim-compe", opt = true}
|
||||||
|
use {"hrsh7th/vim-vsnip", opt = true}
|
||||||
|
use {"rafamadriz/friendly-snippets", opt = true}
|
||||||
|
|
||||||
|
-- Treesitter
|
||||||
|
use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}
|
||||||
|
use {"windwp/nvim-ts-autotag", opt = true}
|
||||||
|
use {'andymass/vim-matchup', opt = true}
|
||||||
|
|
||||||
|
-- Explorer
|
||||||
|
use {
|
||||||
|
'kyazdani42/nvim-tree.lua',
|
||||||
|
requires = 'kyazdani42/nvim-web-devicons',
|
||||||
|
opt = true,
|
||||||
|
config = function() require'nvim-tree'.setup {} end
|
||||||
|
}
|
||||||
|
use {"ahmedkhalf/lsp-rooter.nvim", opt = true} -- with this nvim-tree will follow you
|
||||||
|
-- TODO remove when open on dir is supported by nvimtree
|
||||||
|
use "kevinhwang91/rnvimr"
|
||||||
|
|
||||||
|
-- use {'lukas-reineke/indent-blankline.nvim', opt=true, branch = 'lua'}
|
||||||
|
use { 'lewis6991/gitsigns.nvim', opt = true, requires = { 'nvim-lua/plenary.nvim' } }
|
||||||
|
use {"folke/which-key.nvim", opt = true}
|
||||||
|
use {"ChristianChiarulli/dashboard-nvim", opt = true}
|
||||||
|
use {"windwp/nvim-autopairs", opt = true}
|
||||||
|
use {"kevinhwang91/nvim-bqf", opt = true}
|
||||||
|
|
||||||
|
-- Comments
|
||||||
|
use {"terrortylor/nvim-comment", opt = true}
|
||||||
|
use {'JoosepAlviste/nvim-ts-context-commentstring', opt = true}
|
||||||
|
|
||||||
|
-- Color
|
||||||
|
use {"christianchiarulli/nvcode-color-schemes.vim", opt = true}
|
||||||
|
use {"npxbr/gruvbox.nvim", requires = {"rktjmp/lush.nvim"}}
|
||||||
|
|
||||||
|
-- Icons
|
||||||
|
use {"kyazdani42/nvim-web-devicons", opt = true}
|
||||||
|
|
||||||
|
-- Status Line and Bufferline
|
||||||
|
use {"glepnir/galaxyline.nvim", opt = true}
|
||||||
|
use {"romgrk/barbar.nvim", opt = true}
|
||||||
|
|
||||||
|
-- Go plugin
|
||||||
|
-- use {"fatih/vim-go", run= ":GoUpdateBinaries"}
|
||||||
|
-- use {"fatih/vim-go", run = ":GoUpdateBinaries", ft = "go"}
|
||||||
|
-- require_plugin("fatih/vim-go")
|
||||||
|
-- debuger
|
||||||
|
use {"puremourning/vimspector", opt=true}
|
||||||
|
require_plugin("vimspector")
|
||||||
|
|
||||||
|
-- vim test
|
||||||
|
use {"vim-test/vim-test", opt=true}
|
||||||
|
require_plugin("vim-test")
|
||||||
|
use {"kyoh86/vim-go-coverage", opt=true, ft="go"}
|
||||||
|
require_plugin("vim-go-coverage")
|
||||||
|
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} }
|
||||||
|
|
||||||
|
-- Sane gx for netrw_gx bug
|
||||||
|
-- use {"felipec/vim-sanegx"}
|
||||||
|
|
||||||
|
|
||||||
|
require_plugin("nvim-lspconfig")
|
||||||
|
require_plugin("lspsaga.nvim")
|
||||||
|
require_plugin("nvim-lspinstall")
|
||||||
|
require_plugin('trouble.nvim')
|
||||||
|
require_plugin("friendly-snippets")
|
||||||
|
require_plugin("popup.nvim")
|
||||||
|
require_plugin("plenary.nvim")
|
||||||
|
require_plugin("telescope.nvim")
|
||||||
|
require_plugin('telescope-project.nvim')
|
||||||
|
require_plugin("nvim-dap")
|
||||||
|
require_plugin("nvim-compe")
|
||||||
|
require_plugin("vim-vsnip")
|
||||||
|
-- require_plugin("nvim-treesitter")
|
||||||
|
require_plugin("nvim-ts-autotag")
|
||||||
|
require_plugin('vim-matchup')
|
||||||
|
require_plugin("nvim-tree.lua")
|
||||||
|
require_plugin("gitsigns.nvim")
|
||||||
|
require_plugin("which-key.nvim")
|
||||||
|
require_plugin("dashboard-nvim")
|
||||||
|
require_plugin("nvim-autopairs")
|
||||||
|
require_plugin("nvim-comment")
|
||||||
|
require_plugin("nvim-bqf")
|
||||||
|
require_plugin("nvcode-color-schemes.vim")
|
||||||
|
require_plugin("nvim-web-devicons")
|
||||||
|
require_plugin("galaxyline.nvim")
|
||||||
|
require_plugin("barbar.nvim")
|
||||||
|
require_plugin('lsp-rooter.nvim')
|
||||||
|
require_plugin("nvim-ts-context-commentstring")
|
||||||
|
|
||||||
|
use {'nvim-telescope/telescope-dap.nvim', opt=true}
|
||||||
|
require_plugin("telescope-dap.nvim")
|
||||||
|
use {'theHamsta/nvim-dap-virtual-text', opt=true}
|
||||||
|
require_plugin("nvim-dap-virtual-text")
|
||||||
|
|
||||||
|
use { "ray-x/lsp_signature.nvim"}
|
||||||
|
use 'tanvirtin/monokai.nvim'
|
||||||
|
use 'fratajczak/one-monokai-vim'
|
||||||
|
use {"npxbr/glow.nvim", run = "GlowInstall"}
|
||||||
|
|
||||||
|
use {"akinsho/nvim-toggleterm.lua"}
|
||||||
|
use {"Pocco81/DAPInstall.nvim", opt=true}
|
||||||
|
require_plugin("DAPInstall.nvim")
|
||||||
|
|
||||||
|
--use 'EdenEast/nightfox.nvim'
|
||||||
|
-- use {'godlygeek/tabular', opt=true}
|
||||||
|
-- use {'plasticboy/vim-markdown', opt=true}
|
||||||
|
-- require_plugin("tabular")
|
||||||
|
-- require_plugin("vim-markdown")
|
||||||
|
|
||||||
|
-- Extras
|
||||||
|
if O.extras then
|
||||||
|
use {'metakirby5/codi.vim', opt = true}
|
||||||
|
require_plugin('codi.vim')
|
||||||
|
--use {'iamcco/markdown-preview.nvim', run = 'cd app && npm install', opt = true}
|
||||||
|
--require_plugin('markdown-preview.nvim')
|
||||||
|
use {'numToStr/FTerm.nvim', opt = true}
|
||||||
|
require_plugin('FTerm.nvim')
|
||||||
|
use {'nacro90/numb.nvim', opt = true}
|
||||||
|
require_plugin('numb.nvim')
|
||||||
|
use {'turbio/bracey.vim', run = 'npm install --prefix server', opt = true}
|
||||||
|
require_plugin('bracey.vim')
|
||||||
|
use {'phaazon/hop.nvim', opt = true}
|
||||||
|
require_plugin('hop.nvim')
|
||||||
|
use {'norcalli/nvim-colorizer.lua', opt = true}
|
||||||
|
require_plugin('nvim-colorizer.lua')
|
||||||
|
use {'windwp/nvim-spectre', opt = true}
|
||||||
|
require_plugin('nvim-spectre')
|
||||||
|
use {'simrat39/symbols-outline.nvim', opt = true}
|
||||||
|
require_plugin('symbols-outline.nvim')
|
||||||
|
use {'nvim-treesitter/playground', opt = true}
|
||||||
|
require_plugin('playground')
|
||||||
|
-- folke/todo-comments.nvim
|
||||||
|
-- gennaro-tedesco/nvim-jqx
|
||||||
|
-- TimUntersberger/neogit
|
||||||
|
-- folke/lsp-colors.nvim
|
||||||
|
-- simrat39/symbols-outline.nvim
|
||||||
|
|
||||||
|
-- Git
|
||||||
|
-- use {'tpope/vim-fugitive', opt = true}
|
||||||
|
-- use {'tpope/vim-rhubarb', opt = true}
|
||||||
|
-- pwntester/octo.nvim
|
||||||
|
|
||||||
|
-- Easily Create Gists
|
||||||
|
-- use {'mattn/vim-gist', opt = true}
|
||||||
|
-- use {'mattn/webapi-vim', opt = true}
|
||||||
|
end
|
||||||
|
|
||||||
|
end)
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
-- check if packer is installed (~/local/share/nvim/site/pack)
|
|
||||||
local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]])
|
|
||||||
|
|
||||||
return require("packer").startup(
|
|
||||||
function()
|
|
||||||
use {"wbthomason/packer.nvim", opt = true}
|
|
||||||
use {"kyazdani42/nvim-web-devicons"}
|
|
||||||
use {"kyazdani42/nvim-tree.lua"}
|
|
||||||
use {"nvim-lua/plenary.nvim"}
|
|
||||||
use {"lewis6991/gitsigns.nvim"}
|
|
||||||
use {"glepnir/galaxyline.nvim"}
|
|
||||||
use {"akinsho/nvim-bufferline.lua"}
|
|
||||||
use {"907th/vim-auto-save"}
|
|
||||||
use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}
|
|
||||||
use {"chriskempson/base16-vim"}
|
|
||||||
use {"norcalli/nvim-colorizer.lua"}
|
|
||||||
use {"Yggdroot/indentLine"}
|
|
||||||
use {"ryanoasis/vim-devicons"}
|
|
||||||
use {"sbdchd/neoformat"}
|
|
||||||
use {"neovim/nvim-lspconfig"}
|
|
||||||
use {"hrsh7th/nvim-compe"}
|
|
||||||
use {"windwp/nvim-autopairs"}
|
|
||||||
use {"alvan/vim-closetag"}
|
|
||||||
use {"tweekmonster/startuptime.vim"}
|
|
||||||
use {"onsails/lspkind-nvim"}
|
|
||||||
use {"nvim-telescope/telescope.nvim"}
|
|
||||||
use {"nvim-telescope/telescope-media-files.nvim"}
|
|
||||||
use {"nvim-lua/popup.nvim"}
|
|
||||||
use {"junegunn/fzf"}
|
|
||||||
use {"junegunn/fzf.vim"}
|
|
||||||
use {"lyokha/vim-xkbswitch"}
|
|
||||||
use {"rrethy/vim-hexokinase", run = "make hexokinase"}
|
|
||||||
use {"doums/darcula"}
|
|
||||||
use {"christianchiarulli/nvcode-color-schemes.vim"}
|
|
||||||
end
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object"
|
||||||
|
vim.cmd('set shortmess+=c') -- Don't pass messages to |ins-completion-menu|.
|
||||||
|
vim.cmd('set inccommand=split') -- Make substitution work in realtime
|
||||||
|
vim.o.hidden = true -- Required to keep multiple buffers open multiple buffers
|
||||||
|
vim.o.title = true
|
||||||
|
TERMINAL = vim.fn.expand('$TERMINAL')
|
||||||
|
vim.cmd('let &titleold="'..TERMINAL..'"')
|
||||||
|
vim.o.titlestring="%<%F%=%l/%L - nvim"
|
||||||
|
vim.wo.wrap = false -- Display long lines as just one line
|
||||||
|
vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys
|
||||||
|
vim.cmd('syntax on') -- syntax highlighting
|
||||||
|
vim.o.pumheight = 10 -- Makes popup menu smaller
|
||||||
|
vim.o.fileencoding = "utf-8" -- The encoding written to file
|
||||||
|
vim.o.cmdheight = 2 -- More space for displaying messages
|
||||||
|
vim.cmd('set colorcolumn=99999') -- fix indentline for now
|
||||||
|
vim.o.mouse = "a" -- Enable your mouse
|
||||||
|
vim.o.splitbelow = true -- Horizontal splits will automatically be below
|
||||||
|
vim.o.termguicolors = true -- set term gui colors most terminals support this
|
||||||
|
vim.o.splitright = true -- Vertical splits will automatically be to the right
|
||||||
|
-- vim.o.t_Co = "256" -- Support 256 colors
|
||||||
|
vim.o.conceallevel = 0 -- So that I can see `` in markdown files
|
||||||
|
vim.cmd('set ts=4') -- Insert 2 spaces for a tab
|
||||||
|
vim.cmd('set sw=4') -- Change the number of space characters inserted for indentation
|
||||||
|
vim.cmd('set expandtab') -- Converts tabs to spaces
|
||||||
|
vim.bo.smartindent = true -- Makes indenting smart
|
||||||
|
vim.wo.number = true -- set numbered lines
|
||||||
|
vim.wo.relativenumber = true -- set relative number
|
||||||
|
vim.wo.cursorline = true -- Enable highlighting of the current line
|
||||||
|
vim.o.showtabline = 2 -- Always show tabs
|
||||||
|
vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore
|
||||||
|
vim.o.backup = false -- This is recommended by coc
|
||||||
|
vim.o.writebackup = false -- This is recommended by coc
|
||||||
|
vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
|
||||||
|
vim.o.updatetime = 300 -- Faster completion
|
||||||
|
vim.o.timeoutlen = 100 -- By default timeoutlen is 1000 ms
|
||||||
|
vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else
|
||||||
|
vim.cmd('filetype plugin on') -- filetype detection
|
||||||
|
-- vim.o.guifont = "JetBrainsMono\\ Nerd\\ Font\\ Mono:h18"
|
||||||
|
-- vim.o.guifont = "Hack\\ Nerd\\ Font\\ Mono"
|
||||||
|
-- vim.o.guifont = "SauceCodePro Nerd Font:h17"
|
||||||
|
vim.o.guifont = "FiraCode Nerd Font:h17"
|
||||||
|
|
||||||
|
-- vim.o.guifont = "JetBrains\\ Mono\\ Regular\\ Nerd\\ Font\\ Complete"
|
||||||
|
|
||||||
|
vim.g.vimspector_enable_mappings = 'HUMAN'
|
||||||
|
vim.g['test#go#rspec#options'] = { nearest= '--v', suite= '--v' }
|
||||||
|
vim.o.background = "dark"
|
||||||
|
--require('monokai')
|
||||||
|
--vim.cmd('colorscheme monokai_pro')
|
||||||
|
--require('nightfox').set()
|
||||||
|
--vim.cmd('colorscheme one-monokai')
|
||||||
|
--vim.cmd([[colorscheme gruvbox]])
|
||||||
|
|
||||||
|
-- git blame
|
||||||
|
vim.cmd('highlight default link gitblame SpecialComment')
|
||||||
|
vim.g.gitblame_enabled = 0
|
||||||
|
|
||||||
|
-- last position jump
|
||||||
|
vim.cmd([[
|
||||||
|
autocmd BufReadPost * if line("'\"") >= 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||||
|
]])
|
||||||
@@ -1,204 +0,0 @@
|
|||||||
local gl = require("galaxyline")
|
|
||||||
local gls = gl.section
|
|
||||||
gl.short_line_list = {"LuaTree", "vista", "dbui"}
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
bg = "#282c34",
|
|
||||||
line_bg = "#282c34",
|
|
||||||
fg = "#D8DEE9",
|
|
||||||
fg_green = "#65a380",
|
|
||||||
yellow = "#A3BE8C",
|
|
||||||
cyan = "#22262C",
|
|
||||||
darkblue = "#61afef",
|
|
||||||
green = "#BBE67E",
|
|
||||||
orange = "#FF8800",
|
|
||||||
purple = "#252930",
|
|
||||||
magenta = "#c678dd",
|
|
||||||
blue = "#22262C",
|
|
||||||
red = "#DF8890",
|
|
||||||
lightbg = "#3C4048",
|
|
||||||
nord = "#81A1C1",
|
|
||||||
greenYel = "#EBCB8B"
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[1] = {
|
|
||||||
leftRounded = {
|
|
||||||
provider = function()
|
|
||||||
return ""
|
|
||||||
end,
|
|
||||||
highlight = {colors.nord, colors.bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[2] = {
|
|
||||||
ViMode = {
|
|
||||||
provider = function()
|
|
||||||
return " "
|
|
||||||
end,
|
|
||||||
highlight = {colors.bg, colors.nord},
|
|
||||||
separator = " ",
|
|
||||||
separator_highlight = {colors.lightbg, colors.lightbg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[3] = {
|
|
||||||
FileIcon = {
|
|
||||||
provider = "FileIcon",
|
|
||||||
condition = buffer_not_empty,
|
|
||||||
highlight = {require("galaxyline.provider_fileinfo").get_file_icon_color, colors.lightbg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[4] = {
|
|
||||||
FileName = {
|
|
||||||
provider = {"FileName", "FileSize"},
|
|
||||||
condition = buffer_not_empty,
|
|
||||||
highlight = {colors.fg, colors.lightbg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[5] = {
|
|
||||||
teech = {
|
|
||||||
provider = function()
|
|
||||||
return ""
|
|
||||||
end,
|
|
||||||
separator = " ",
|
|
||||||
highlight = {colors.lightbg, colors.bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
local checkwidth = function()
|
|
||||||
local squeeze_width = vim.fn.winwidth(0) / 2
|
|
||||||
if squeeze_width > 40 then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
gls.left[6] = {
|
|
||||||
DiffAdd = {
|
|
||||||
provider = "DiffAdd",
|
|
||||||
condition = checkwidth,
|
|
||||||
icon = " ",
|
|
||||||
highlight = {colors.greenYel, colors.line_bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[7] = {
|
|
||||||
DiffModified = {
|
|
||||||
provider = "DiffModified",
|
|
||||||
condition = checkwidth,
|
|
||||||
icon = " ",
|
|
||||||
highlight = {colors.orange, colors.line_bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[8] = {
|
|
||||||
DiffRemove = {
|
|
||||||
provider = "DiffRemove",
|
|
||||||
condition = checkwidth,
|
|
||||||
icon = " ",
|
|
||||||
highlight = {colors.red, colors.line_bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[9] = {
|
|
||||||
LeftEnd = {
|
|
||||||
provider = function()
|
|
||||||
return " "
|
|
||||||
end,
|
|
||||||
separator = " ",
|
|
||||||
separator_highlight = {colors.line_bg, colors.line_bg},
|
|
||||||
highlight = {colors.line_bg, colors.line_bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[10] = {
|
|
||||||
DiagnosticError = {
|
|
||||||
provider = "DiagnosticError",
|
|
||||||
icon = " ",
|
|
||||||
highlight = {colors.red, colors.bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[11] = {
|
|
||||||
Space = {
|
|
||||||
provider = function()
|
|
||||||
return " "
|
|
||||||
end,
|
|
||||||
highlight = {colors.line_bg, colors.line_bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left[12] = {
|
|
||||||
DiagnosticWarn = {
|
|
||||||
provider = "DiagnosticWarn",
|
|
||||||
icon = " ",
|
|
||||||
highlight = {colors.blue, colors.bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.right[1] = {
|
|
||||||
GitIcon = {
|
|
||||||
provider = function()
|
|
||||||
return " "
|
|
||||||
end,
|
|
||||||
condition = require("galaxyline.provider_vcs").check_git_workspace,
|
|
||||||
highlight = {colors.green, colors.line_bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.right[2] = {
|
|
||||||
GitBranch = {
|
|
||||||
provider = "GitBranch",
|
|
||||||
condition = require("galaxyline.provider_vcs").check_git_workspace,
|
|
||||||
highlight = {colors.green, colors.line_bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.right[3] = {
|
|
||||||
right_LeftRounded = {
|
|
||||||
provider = function()
|
|
||||||
return ""
|
|
||||||
end,
|
|
||||||
separator = " ",
|
|
||||||
separator_highlight = {colors.bg, colors.bg},
|
|
||||||
highlight = {colors.red, colors.bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.right[4] = {
|
|
||||||
SiMode = {
|
|
||||||
provider = function()
|
|
||||||
local alias = {
|
|
||||||
n = "NORMAL",
|
|
||||||
i = "INSERT",
|
|
||||||
c = "COMMAND",
|
|
||||||
V = "VISUAL",
|
|
||||||
[""] = "VISUAL",
|
|
||||||
v = "VISUAL",
|
|
||||||
R = "REPLACE"
|
|
||||||
}
|
|
||||||
return alias[vim.fn.mode()]
|
|
||||||
end,
|
|
||||||
highlight = {colors.bg, colors.red}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.right[5] = {
|
|
||||||
PerCent = {
|
|
||||||
provider = "LinePercent",
|
|
||||||
separator = " ",
|
|
||||||
separator_highlight = {colors.red, colors.red},
|
|
||||||
highlight = {colors.bg, colors.fg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.right[6] = {
|
|
||||||
rightRounded = {
|
|
||||||
provider = function()
|
|
||||||
return ""
|
|
||||||
end,
|
|
||||||
highlight = {colors.fg, colors.bg}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
require("telescope").setup {
|
|
||||||
defaults = {
|
|
||||||
vimgrep_arguments = {
|
|
||||||
"rg",
|
|
||||||
"--color=never",
|
|
||||||
"--no-heading",
|
|
||||||
"--with-filename",
|
|
||||||
"--line-number",
|
|
||||||
"--column",
|
|
||||||
"--smart-case"
|
|
||||||
},
|
|
||||||
prompt_position = "bottom",
|
|
||||||
prompt_prefix = "> ",
|
|
||||||
selection_caret = "> ",
|
|
||||||
entry_prefix = " ",
|
|
||||||
initial_mode = "insert",
|
|
||||||
selection_strategy = "reset",
|
|
||||||
sorting_strategy = "descending",
|
|
||||||
layout_strategy = "horizontal",
|
|
||||||
layout_defaults = {
|
|
||||||
horizontal = {
|
|
||||||
mirror = false,
|
|
||||||
preview_width = 0.5
|
|
||||||
},
|
|
||||||
vertical = {
|
|
||||||
mirror = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
file_sorter = require "telescope.sorters".get_fuzzy_file,
|
|
||||||
file_ignore_patterns = {},
|
|
||||||
generic_sorter = require "telescope.sorters".get_generic_fuzzy_sorter,
|
|
||||||
shorten_path = true,
|
|
||||||
winblend = 0,
|
|
||||||
width = 0.75,
|
|
||||||
preview_cutoff = 120,
|
|
||||||
results_height = 1,
|
|
||||||
results_width = 0.8,
|
|
||||||
border = {},
|
|
||||||
borderchars = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"},
|
|
||||||
color_devicons = true,
|
|
||||||
use_less = true,
|
|
||||||
set_env = {["COLORTERM"] = "truecolor"}, -- default = nil,
|
|
||||||
file_previewer = require "telescope.previewers".vim_buffer_cat.new,
|
|
||||||
grep_previewer = require "telescope.previewers".vim_buffer_vimgrep.new,
|
|
||||||
qflist_previewer = require "telescope.previewers".vim_buffer_qflist.new,
|
|
||||||
-- Developer configurations: Not meant for general override
|
|
||||||
buffer_previewer_maker = require "telescope.previewers".buffer_previewer_maker
|
|
||||||
},
|
|
||||||
extensions = {
|
|
||||||
media_files = {
|
|
||||||
filetypes = {"png", "webp", "jpg", "jpeg"},
|
|
||||||
find_cmd = "rg" -- find command (defaults to `fd`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
require("telescope").load_extension("media_files")
|
|
||||||
|
|
||||||
local opt = {noremap = true, silent = true}
|
|
||||||
|
|
||||||
vim.g.mapleader = " "
|
|
||||||
|
|
||||||
-- mappings
|
|
||||||
--vim.api.nvim_set_keymap("n", "<Leader>ff", [[<Cmd>lua require('telescope.builtin').find_files()<CR>]], opt)
|
|
||||||
vim.api.nvim_set_keymap("n", "<C-p>", [[<Cmd>lua require('telescope.builtin').find_files()<CR>]], opt)
|
|
||||||
vim.api.nvim_set_keymap(
|
|
||||||
"n",
|
|
||||||
"<Leader>sp",
|
|
||||||
[[<Cmd>lua require('telescope').extensions.media_files.media_files()<CR>]],
|
|
||||||
opt
|
|
||||||
)
|
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>sb", [[<Cmd>lua require('telescope.builtin').buffers()<CR>]], opt)
|
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>sh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt)
|
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>so", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt)
|
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>sm", [[<Cmd> Neoformat<CR>]], opt)
|
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("n", "<C-a>", [[ <Cmd> %y+<CR>]], opt)
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
local ts_config = require("nvim-treesitter.configs")
|
|
||||||
|
|
||||||
ts_config.setup {
|
|
||||||
ensure_installed = {
|
|
||||||
"javascript",
|
|
||||||
"html",
|
|
||||||
"css",
|
|
||||||
"bash",
|
|
||||||
"cpp",
|
|
||||||
"rust",
|
|
||||||
"lua",
|
|
||||||
"go",
|
|
||||||
},
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
use_languagetree = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
local lv_utils = {}
|
||||||
|
|
||||||
|
|
||||||
|
-- copy current filepath to clipboard
|
||||||
|
function lv_utils.yank_filepath()
|
||||||
|
local p = vim.fn.expand('%:p')
|
||||||
|
print(p)
|
||||||
|
vim.fn.setreg('+',p)
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.define_augroups(definitions) -- {{{1
|
||||||
|
-- Create autocommand groups based on the passed definitions
|
||||||
|
--
|
||||||
|
-- The key will be the name of the group, and each definition
|
||||||
|
-- within the group should have:
|
||||||
|
-- 1. Trigger
|
||||||
|
-- 2. Pattern
|
||||||
|
-- 3. Text
|
||||||
|
-- just like how they would normally be defined from Vim itself
|
||||||
|
for group_name, definition in pairs(definitions) do
|
||||||
|
vim.cmd('augroup ' .. group_name)
|
||||||
|
vim.cmd('autocmd!')
|
||||||
|
|
||||||
|
for _, def in pairs(definition) do
|
||||||
|
local command = table.concat(vim.tbl_flatten {'autocmd', def}, ' ')
|
||||||
|
vim.cmd(command)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.cmd('augroup END')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- lsp
|
||||||
|
|
||||||
|
function lv_utils.add_to_workspace_folder()
|
||||||
|
vim.lsp.buf.add_workspace_folder()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.clear_references()
|
||||||
|
vim.lsp.buf.clear_references()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.code_action()
|
||||||
|
vim.lsp.buf.code_action()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.declaration()
|
||||||
|
vim.lsp.buf.declaration()
|
||||||
|
vim.lsp.buf.clear_references()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.definition()
|
||||||
|
vim.lsp.buf.definition()
|
||||||
|
vim.lsp.buf.clear_references()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.document_highlight()
|
||||||
|
vim.lsp.buf.document_highlight()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.document_symbol()
|
||||||
|
vim.lsp.buf.document_symbol()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.formatting()
|
||||||
|
vim.lsp.buf.formatting()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.formatting_sync()
|
||||||
|
vim.lsp.buf.formatting_sync()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.hover()
|
||||||
|
vim.lsp.buf.hover()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.implementation()
|
||||||
|
vim.lsp.buf.implementation()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.incoming_calls()
|
||||||
|
vim.lsp.buf.incoming_calls()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.list_workspace_folders()
|
||||||
|
vim.lsp.buf.list_workspace_folders()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.outgoing_calls()
|
||||||
|
vim.lsp.buf.outgoing_calls()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.range_code_action()
|
||||||
|
vim.lsp.buf.range_code_action()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.range_formatting()
|
||||||
|
vim.lsp.buf.range_formatting()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.references()
|
||||||
|
vim.lsp.buf.references()
|
||||||
|
vim.lsp.buf.clear_references()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.remove_workspace_folder()
|
||||||
|
vim.lsp.buf.remove_workspace_folder()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.rename()
|
||||||
|
vim.lsp.buf.rename()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.signature_help()
|
||||||
|
vim.lsp.buf.signature_help()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.type_definition()
|
||||||
|
vim.lsp.buf.type_definition()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.workspace_symbol()
|
||||||
|
vim.lsp.buf.workspace_symbol()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- diagnostic
|
||||||
|
|
||||||
|
function lv_utils.get_all()
|
||||||
|
vim.lsp.diagnostic.get_all()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.get_next()
|
||||||
|
vim.lsp.diagnostic.get_next()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.get_prev()
|
||||||
|
vim.lsp.diagnostic.get_prev()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.goto_next()
|
||||||
|
vim.lsp.diagnostic.goto_next()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.goto_prev()
|
||||||
|
vim.lsp.diagnostic.goto_prev()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.show_line_diagnostics()
|
||||||
|
vim.lsp.diagnostic.show_line_diagnostics()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- git signs
|
||||||
|
|
||||||
|
function lv_utils.next_hunk()
|
||||||
|
require('gitsigns').next_hunk()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.prev_hunk()
|
||||||
|
require('gitsigns').prev_hunk()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.stage_hunk()
|
||||||
|
require('gitsigns').stage_hunk()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.undo_stage_hunk()
|
||||||
|
require('gitsigns').undo_stage_hunk()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.reset_hunk()
|
||||||
|
require('gitsigns').reset_hunk()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.reset_buffer()
|
||||||
|
require('gitsigns').reset_buffer()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.preview_hunk()
|
||||||
|
require('gitsigns').preview_hunk()
|
||||||
|
end
|
||||||
|
|
||||||
|
function lv_utils.blame_line()
|
||||||
|
require('gitsigns').blame_line()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- misc
|
||||||
|
function lv_utils.file_exists(name)
|
||||||
|
local f = io.open(name, "r")
|
||||||
|
if f ~= nil then
|
||||||
|
io.close(f)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return lv_utils
|
||||||
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
local scopes = {o = vim.o, b = vim.bo, w = vim.wo}
|
|
||||||
|
|
||||||
local function opt(scope, key, value)
|
|
||||||
scopes[scope][key] = value
|
|
||||||
if scope ~= "o" then
|
|
||||||
scopes["o"][key] = value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
opt("o", "hidden", true)
|
|
||||||
opt("o", "ignorecase", true)
|
|
||||||
opt("o", "splitbelow", true)
|
|
||||||
opt("o", "splitright", true)
|
|
||||||
opt("o", "termguicolors", true)
|
|
||||||
opt("w", "number", true)
|
|
||||||
opt("o", "numberwidth", 2)
|
|
||||||
|
|
||||||
opt("o", "mouse", "a")
|
|
||||||
|
|
||||||
opt("w", "signcolumn", "yes")
|
|
||||||
opt("o", "cmdheight", 1)
|
|
||||||
|
|
||||||
opt("o", "updatetime", 250) -- update interval for gitsigns
|
|
||||||
opt("o", "clipboard", "unnamedplus")
|
|
||||||
|
|
||||||
-- for indenline
|
|
||||||
local indent = 4
|
|
||||||
opt("b", "expandtab", true )
|
|
||||||
opt("b", "shiftwidth", indent )
|
|
||||||
opt('b', 'tabstop', indent) -- Number of spaces tabs count for
|
|
||||||
opt('o', 'completeopt', 'menuone,noinsert,noselect') -- Completion options (for deoplete)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
function M.is_buffer_empty()
|
|
||||||
-- Check whether the current buffer is empty
|
|
||||||
return vim.fn.empty(vim.fn.expand("%:t")) == 1
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.has_width_gt(cols)
|
|
||||||
-- Check if the windows width is greater than a given number of columns
|
|
||||||
return vim.fn.winwidth(0) / 2 > cols
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
vim.cmd [[packadd nvim-web-devicons]]
|
|
||||||
|
|
||||||
require "nvim-web-devicons".setup {
|
|
||||||
override = {
|
|
||||||
html = {
|
|
||||||
icon = "",
|
|
||||||
color = "#DE8C92",
|
|
||||||
name = "html"
|
|
||||||
},
|
|
||||||
css = {
|
|
||||||
icon = "",
|
|
||||||
color = "#61afef",
|
|
||||||
name = "css"
|
|
||||||
},
|
|
||||||
js = {
|
|
||||||
icon = "",
|
|
||||||
color = "#EBCB8B",
|
|
||||||
name = "js"
|
|
||||||
},
|
|
||||||
png = {
|
|
||||||
icon = " ",
|
|
||||||
color = "#BD77DC",
|
|
||||||
name = "png"
|
|
||||||
},
|
|
||||||
jpg = {
|
|
||||||
icon = " ",
|
|
||||||
color = "#BD77DC",
|
|
||||||
name = "jpg"
|
|
||||||
},
|
|
||||||
jpeg = {
|
|
||||||
icon = " ",
|
|
||||||
color = "#BD77DC",
|
|
||||||
name = "jpeg"
|
|
||||||
},
|
|
||||||
mp3 = {
|
|
||||||
icon = "",
|
|
||||||
color = "#C8CCD4",
|
|
||||||
name = "mp3"
|
|
||||||
},
|
|
||||||
mp4 = {
|
|
||||||
icon = "",
|
|
||||||
color = "#C8CCD4",
|
|
||||||
name = "mp4"
|
|
||||||
},
|
|
||||||
out = {
|
|
||||||
icon = "",
|
|
||||||
color = "#C8CCD4",
|
|
||||||
name = "out"
|
|
||||||
},
|
|
||||||
toml = {
|
|
||||||
icon = "",
|
|
||||||
color = "#61afef",
|
|
||||||
name = "toml"
|
|
||||||
},
|
|
||||||
lock = {
|
|
||||||
icon = "",
|
|
||||||
color = "#DE6B74",
|
|
||||||
name = "lock"
|
|
||||||
},
|
|
||||||
zip = {
|
|
||||||
icon = "",
|
|
||||||
color = "#EBCB8B",
|
|
||||||
name = "zip"
|
|
||||||
},
|
|
||||||
xz = {
|
|
||||||
icon = "",
|
|
||||||
color = "#EBCB8B",
|
|
||||||
name = "xz"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
--[[
|
||||||
|
O is the global options object
|
||||||
|
|
||||||
|
Formatters and linters should be
|
||||||
|
filled in as strings with either
|
||||||
|
a global executable or a path to
|
||||||
|
an executable
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- general
|
||||||
|
O.auto_complete = true
|
||||||
|
O.colorscheme = 'lunar'
|
||||||
|
O.auto_close_tree = 0
|
||||||
|
O.wrap_lines = false
|
||||||
|
O.timeoutlen = 100
|
||||||
|
O.document_highlight = true
|
||||||
|
O.extras = true
|
||||||
|
|
||||||
|
-- dashboard
|
||||||
|
-- O.dashboard.custom_header = {""}
|
||||||
|
-- O.dashboard.footer = {""}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
O.clang.diagnostics.virtual_text = false
|
||||||
|
O.clang.diagnostics.signs = false
|
||||||
|
O.clang.diagnostics.underline = false
|
||||||
|
|
||||||
|
-- python
|
||||||
|
-- add things like O.python.formatter.yapf.exec_path
|
||||||
|
-- add things like O.python.linter.flake8.exec_path
|
||||||
|
-- add things like O.python.formatter.isort.exec_path
|
||||||
|
O.python.formatter = 'yapf'
|
||||||
|
-- O.python.linter = 'flake8'
|
||||||
|
O.python.isort = true
|
||||||
|
O.python.autoformat = true
|
||||||
|
O.python.diagnostics.virtual_text = true
|
||||||
|
O.python.diagnostics.signs = true
|
||||||
|
O.python.diagnostics.underline = true
|
||||||
|
O.python.analysis.type_checking = "off"
|
||||||
|
O.python.analysis.auto_search_paths = true
|
||||||
|
O.python.analysis.use_library_code_types = true
|
||||||
|
|
||||||
|
-- lua
|
||||||
|
-- TODO look into stylua
|
||||||
|
O.lua.formatter = 'lua-format'
|
||||||
|
-- O.lua.formatter = 'lua-format'
|
||||||
|
--O.lua.autoformat = false
|
||||||
|
|
||||||
|
-- javascript
|
||||||
|
O.tsserver.formatter = 'prettier'
|
||||||
|
O.tsserver.linter = nil
|
||||||
|
O.tsserver.autoformat = true
|
||||||
|
|
||||||
|
-- json
|
||||||
|
O.json.autoformat = true
|
||||||
|
|
||||||
|
-- ruby
|
||||||
|
O.ruby.autoformat = true
|
||||||
|
|
||||||
|
-- go
|
||||||
|
O.go.autoformat = true
|
||||||
|
-- create custom autocommand field (This would be easy with lua)
|
||||||
|
|
||||||
|
-- Turn off relative_numbers
|
||||||
|
-- O.relative_number = false
|
||||||
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
!#/bin/bash
|
||||||
|
cd ~
|
||||||
|
sudo rm -r neovim
|
||||||
|
git clone https://github.com/neovim/neovim
|
||||||
|
cd neovim
|
||||||
|
sudo make CMAKE_BUILD_TYPE=Release install
|
||||||
|
cd ~
|
||||||
|
sudo rm -r neovim
|
||||||
|
|
||||||
Executable
+28
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# NOTE:
|
||||||
|
# This doesn't work as is on Windows. You'll need to create an equivalent `.bat` file instead
|
||||||
|
#
|
||||||
|
# NOTE:
|
||||||
|
# If you're not using Linux you'll need to adjust the `-configuration` option
|
||||||
|
# to point to the `config_mac' or `config_win` folders depending on your system.
|
||||||
|
|
||||||
|
JAR="$HOME/.config/nvim/.language-servers/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_*.jar"
|
||||||
|
GRADLE_HOME=$HOME/gradle $HOME/.sdkman/candidates/java/current/bin/java \
|
||||||
|
-Declipse.application=org.eclipse.jdt.ls.core.id1 \
|
||||||
|
-Dosgi.bundles.defaultStartLevel=4 \
|
||||||
|
-Declipse.product=org.eclipse.jdt.ls.core.product \
|
||||||
|
-Dlog.protocol=true \
|
||||||
|
-Dlog.level=ALL \
|
||||||
|
-javaagent:/usr/local/share/lombok/lombok.jar \
|
||||||
|
-Xms1g \
|
||||||
|
-Xmx2G \
|
||||||
|
-jar $(echo "$JAR") \
|
||||||
|
-configuration "$HOME/.config/nvim/.language-servers/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/config_linux" \
|
||||||
|
-data "${1:-$HOME/workspace}" \
|
||||||
|
--add-modules=ALL-SYSTEM \
|
||||||
|
--add-opens java.base/java.util=ALL-UNNAMED \
|
||||||
|
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||||
|
|
||||||
|
# for older java versions if you wanna use lombok
|
||||||
|
# -Xbootclasspath/a:/usr/local/share/lombok/lombok.jar \
|
||||||
Executable
+29
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# NOTE:
|
||||||
|
# This doesn't work as is on Windows. You'll need to create an equivalent `.bat` file instead
|
||||||
|
#
|
||||||
|
# NOTE:
|
||||||
|
# If you're not using Linux you'll need to adjust the `-configuration` option
|
||||||
|
# to point to the `config_mac' or `config_win` folders depending on your system.
|
||||||
|
|
||||||
|
JAR="$HOME/.config/nvim/.language-servers/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_*.jar"
|
||||||
|
GRADLE_HOME=$HOME/gradle $HOME/.sdkman/candidates/java/current/bin/java \
|
||||||
|
-Declipse.application=org.eclipse.jdt.ls.core.id1 \
|
||||||
|
-Dosgi.bundles.defaultStartLevel=4 \
|
||||||
|
-Declipse.product=org.eclipse.jdt.ls.core.product \
|
||||||
|
-Dlog.protocol=true \
|
||||||
|
-Dlog.level=ALL \
|
||||||
|
-javaagent:/usr/local/share/lombok/lombok.jar \
|
||||||
|
-Xms1g \
|
||||||
|
-Xmx2G \
|
||||||
|
-jar $(echo "$JAR") \
|
||||||
|
-configuration "$HOME/.config/nvim/.language-servers/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/config_mac" \
|
||||||
|
-data "${1:-$HOME/workspace}" \
|
||||||
|
--add-modules=ALL-SYSTEM \
|
||||||
|
--add-opens java.base/java.util=ALL-UNNAMED \
|
||||||
|
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||||
|
|
||||||
|
# for older java versions if you wanna use lombok
|
||||||
|
# -Xbootclasspath/a:/usr/local/share/lombok/lombok.jar \
|
||||||
|
|
||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
nvim -u ~/.config/nvcode/init.lua
|
||||||
Executable
+207
@@ -0,0 +1,207 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -o nounset # error when referencing undefined variable
|
||||||
|
set -o errexit # exit when command fails
|
||||||
|
|
||||||
|
installnodemac() {
|
||||||
|
brew install lua
|
||||||
|
brew install node
|
||||||
|
brew install yarn
|
||||||
|
}
|
||||||
|
|
||||||
|
installnodeubuntu() {
|
||||||
|
sudo apt install nodejs
|
||||||
|
sudo apt install npm
|
||||||
|
}
|
||||||
|
|
||||||
|
moveoldnvim() {
|
||||||
|
echo "Not installing LunarVim"
|
||||||
|
echo "Please move your ~/.config/nvim folder before installing"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
installnodearch() {
|
||||||
|
sudo pacman -S nodejs
|
||||||
|
sudo pacman -S npm
|
||||||
|
}
|
||||||
|
|
||||||
|
installnodefedora() {
|
||||||
|
sudo dnf install -y nodejs
|
||||||
|
sudo dnf install -y npm
|
||||||
|
}
|
||||||
|
|
||||||
|
installnodegentoo() {
|
||||||
|
echo "Printing current node status..."
|
||||||
|
emerge -pqv net-libs/nodejs
|
||||||
|
echo "Make sure the npm USE flag is enabled for net-libs/nodejs"
|
||||||
|
echo "If it isn't enabled, would you like to enable it with flaggie? (Y/N)"
|
||||||
|
read answer
|
||||||
|
[ "$answer" != "${answer#[Yy]}" ] && sudo flaggie net-libs/nodejs +npm
|
||||||
|
sudo emerge -avnN net-libs/nodejs
|
||||||
|
}
|
||||||
|
|
||||||
|
installnode() {
|
||||||
|
echo "Installing node..."
|
||||||
|
[ "$(uname)" == "Darwin" ] && installnodemac
|
||||||
|
[ -n "$(cat /etc/os-release | grep Ubuntu)" ] && installnodeubuntu
|
||||||
|
[ -f "/etc/arch-release" ] && installnodearch
|
||||||
|
[ -f "/etc/artix-release" ] && installnodearch
|
||||||
|
[ -f "/etc/fedora-release" ] && installnodefedora
|
||||||
|
[ -f "/etc/gentoo-release" ] && installnodegentoo
|
||||||
|
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
||||||
|
sudo npm i -g neovim
|
||||||
|
}
|
||||||
|
|
||||||
|
installpiponmac() {
|
||||||
|
sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||||
|
python3 get-pip.py
|
||||||
|
rm get-pip.py
|
||||||
|
}
|
||||||
|
|
||||||
|
installpiponubuntu() {
|
||||||
|
sudo apt install python3-pip >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
installpiponarch() {
|
||||||
|
sudo pacman -S python-pip
|
||||||
|
}
|
||||||
|
|
||||||
|
installpiponfedora() {
|
||||||
|
sudo dnf install -y pip >/dev/nul
|
||||||
|
}
|
||||||
|
|
||||||
|
installpipongentoo() {
|
||||||
|
sudo emerge -avn dev-python/pip
|
||||||
|
}
|
||||||
|
|
||||||
|
installpip() {
|
||||||
|
echo "Installing pip..."
|
||||||
|
[ "$(uname)" == "Darwin" ] && installpiponmac
|
||||||
|
[ -n "$(cat /etc/os-release | grep Ubuntu)" ] && installpiponubuntu
|
||||||
|
[ -f "/etc/arch-release" ] && installpiponarch
|
||||||
|
[ -f "/etc/fedora-release" ] && installpiponfedora
|
||||||
|
[ -f "/etc/gentoo-release" ] && installpipongentoo
|
||||||
|
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
||||||
|
}
|
||||||
|
|
||||||
|
installpynvim() {
|
||||||
|
echo "Installing pynvim..."
|
||||||
|
if [ -f "/etc/gentoo-release" ]; then
|
||||||
|
echo "Installing using Portage"
|
||||||
|
sudo emerge -avn dev-python/pynvim
|
||||||
|
else
|
||||||
|
pip3 install pynvim --user
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
installpacker() {
|
||||||
|
git clone https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
||||||
|
}
|
||||||
|
|
||||||
|
cloneconfig() {
|
||||||
|
echo "Cloning LunarVim configuration"
|
||||||
|
git clone https://github.com/ChristianChiarulli/lunarvim.git ~/.config/nvim
|
||||||
|
# mv $HOME/.config/nvim/init.lua $HOME/.config/nvim/init.lua.tmp
|
||||||
|
# mv $HOME/.config/nvim/utils/init.lua $HOME/.config/nvim/init.lua
|
||||||
|
nvim -u $HOME/.config/nvim/init.lua +PackerInstall
|
||||||
|
# rm $HOME/.config/nvim/init.lua
|
||||||
|
# mv $HOME/.config/nvim/init.lua.tmp $HOME/.config/nvim/init.lua
|
||||||
|
}
|
||||||
|
|
||||||
|
asktoinstallnode() {
|
||||||
|
echo "node not found"
|
||||||
|
echo -n "Would you like to install node now (y/n)? "
|
||||||
|
read answer
|
||||||
|
[ "$answer" != "${answer#[Yy]}" ] && installnode
|
||||||
|
}
|
||||||
|
|
||||||
|
asktoinstallpip() {
|
||||||
|
# echo "pip not found"
|
||||||
|
# echo -n "Would you like to install pip now (y/n)? "
|
||||||
|
# read answer
|
||||||
|
# [ "$answer" != "${answer#[Yy]}" ] && installpip
|
||||||
|
echo "Please install pip3 before continuing with install"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
installonmac() {
|
||||||
|
brew install ripgrep fzf ranger
|
||||||
|
npm install -g tree-sitter-cli
|
||||||
|
}
|
||||||
|
|
||||||
|
pipinstallueberzug() {
|
||||||
|
which pip3 >/dev/null && pip3 install ueberzug || echo "Not installing ueberzug pip not found"
|
||||||
|
}
|
||||||
|
|
||||||
|
installonubuntu() {
|
||||||
|
sudo apt install ripgrep fzf ranger
|
||||||
|
sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev
|
||||||
|
pip3 install ueberzug
|
||||||
|
pip3 install neovim-remote
|
||||||
|
npm install -g tree-sitter-cli
|
||||||
|
}
|
||||||
|
|
||||||
|
installonarch() {
|
||||||
|
sudo pacman -S ripgrep fzf ranger
|
||||||
|
which yay >/dev/null && yay -S python-ueberzug-git || pipinstallueberzug
|
||||||
|
pip3 install neovim-remote
|
||||||
|
npm install -g tree-sitter-cli
|
||||||
|
}
|
||||||
|
|
||||||
|
installonfedora() {
|
||||||
|
sudo dnf groupinstall "X Software Development"
|
||||||
|
sudo dnf install -y fzf ripgrep ranger
|
||||||
|
pip3 install wheel ueberzug
|
||||||
|
}
|
||||||
|
|
||||||
|
installongentoo() {
|
||||||
|
sudo emerge -avn sys-apps/ripgrep app-shells/fzf app-misc/ranger dev-python/neovim-remote virtual/jpeg sys-libs/zlib
|
||||||
|
pipinstallueberzug
|
||||||
|
npm install -g tree-sitter-cli
|
||||||
|
}
|
||||||
|
|
||||||
|
installextrapackages() {
|
||||||
|
[ "$(uname)" == "Darwin" ] && installonmac
|
||||||
|
[ -n "$(cat /etc/os-release | grep Ubuntu)" ] && installonubuntu
|
||||||
|
[ -f "/etc/arch-release" ] && installonarch
|
||||||
|
[ -f "/etc/artix-release" ] && installonarch
|
||||||
|
[ -f "/etc/fedora-release" ] && installonfedora
|
||||||
|
[ -f "/etc/gentoo-release" ] && installongentoo
|
||||||
|
[ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Welcome
|
||||||
|
echo 'Installing LunarVim'
|
||||||
|
|
||||||
|
# move old nvim directory if it exists
|
||||||
|
[ -d "$HOME/.config/nvim" ] && moveoldnvim
|
||||||
|
|
||||||
|
# install pip
|
||||||
|
which pip3 >/dev/null && echo "pip installed, moving on..." || asktoinstallpip
|
||||||
|
|
||||||
|
# install node and neovim support
|
||||||
|
which node >/dev/null && echo "node installed, moving on..." || asktoinstallnode
|
||||||
|
|
||||||
|
# install pynvim
|
||||||
|
pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on..." || installpynvim
|
||||||
|
|
||||||
|
if [ -e "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then
|
||||||
|
echo 'packer already installed'
|
||||||
|
else
|
||||||
|
installpacker
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "$HOME/.config/nvim/init.lua" ]; then
|
||||||
|
echo 'nvcode already installed'
|
||||||
|
else
|
||||||
|
# clone config down
|
||||||
|
cloneconfig
|
||||||
|
# echo 'export PATH=$HOME/.config/nvim/utils/bin:$PATH' >>~/.zshrc
|
||||||
|
# echo 'export PATH=$HOME/.config/nvcode/utils/bin:$PATH' >>~/.bashrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
|
||||||
|
|
||||||
|
# echo "I also recommend you add 'set preview_images_method ueberzug' to ~/.config/ranger/rc.conf"
|
||||||
|
|
||||||
|
# echo 'export PATH=/home/$USER/.config/nvcode/utils/bin:$PATH appending to zshrc/bashrc'
|
||||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 856 KiB |
@@ -0,0 +1,171 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"key": "shift+ctrl+e",
|
||||||
|
"command": "actions.findWithSelection"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+e",
|
||||||
|
"command": "-actions.findWithSelection"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+e",
|
||||||
|
"command": "workbench.view.explorer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+ctrl+e",
|
||||||
|
"command": "-workbench.view.explorer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "r",
|
||||||
|
"command": "renameFile",
|
||||||
|
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "enter",
|
||||||
|
"command": "-renameFile",
|
||||||
|
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "j",
|
||||||
|
"command": "list.focusDown",
|
||||||
|
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "k",
|
||||||
|
"command": "list.focusUp",
|
||||||
|
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+j",
|
||||||
|
"command": "selectNextSuggestion",
|
||||||
|
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k",
|
||||||
|
"command": "selectPrevSuggestion",
|
||||||
|
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+j",
|
||||||
|
"command": "workbench.action.quickOpenNavigateNext",
|
||||||
|
"when": "inQuickOpen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "tab",
|
||||||
|
"command": "selectNextSuggestion",
|
||||||
|
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "tab",
|
||||||
|
"command": "workbench.action.quickOpenNavigateNext",
|
||||||
|
"when": "inQuickOpen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+tab",
|
||||||
|
"command": "selectPrevSuggestion",
|
||||||
|
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+tab",
|
||||||
|
"command": "workbench.action.quickOpenNavigatePrevious",
|
||||||
|
"when": "inQuickOpen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k",
|
||||||
|
"command": "workbench.action.quickOpenNavigatePrevious",
|
||||||
|
"when": "inQuickOpen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "enter",
|
||||||
|
"command": "list.select",
|
||||||
|
"when": "explorerViewletVisible && filesExplorerFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "l",
|
||||||
|
"command": "list.select",
|
||||||
|
"when": "explorerViewletVisible && filesExplorerFocus && !inputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "o",
|
||||||
|
"command": "list.toggleExpand",
|
||||||
|
"when": "explorerViewletVisible && filesExplorerFocus && !inputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "h",
|
||||||
|
"command": "list.collapse",
|
||||||
|
"when": "explorerViewletVisible && filesExplorerFocus && !inputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "a",
|
||||||
|
"command": "explorer.newFile",
|
||||||
|
"when": "filesExplorerFocus && !inputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+a",
|
||||||
|
"command": "explorer.newFolder",
|
||||||
|
"when": "filesExplorerFocus && !inputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+;",
|
||||||
|
"command": "insertPrevSuggestion",
|
||||||
|
"when": "hasOtherSuggestions && textInputFocus && textInputFocus && !inSnippetMode && !suggestWidgetVisible && config.editor.tabCompletion == 'on'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+l",
|
||||||
|
"when": "sideBarFocus",
|
||||||
|
"command": "workbench.action.focusActiveEditorGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k",
|
||||||
|
"command": "workbench.action.focusActiveEditorGroup",
|
||||||
|
"when": "terminalFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+shift+t",
|
||||||
|
"command": "workbench.action.terminal.focus",
|
||||||
|
"when": "!terminalFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+j",
|
||||||
|
"command": "-editor.action.insertLineAfter",
|
||||||
|
"when": "editorTextFocus && neovim.ctrlKeysInsert && !neovim.recording && neovim.mode == 'insert'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "alt+j",
|
||||||
|
"command": "workbench.action.terminal.focus",
|
||||||
|
"when": "!terminalFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+shift+t",
|
||||||
|
"command": "workbench.action.togglePanel"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+j",
|
||||||
|
"command": "-workbench.action.togglePanel"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+k",
|
||||||
|
"command": "editor.action.showHover",
|
||||||
|
"when": "editorTextFocus && neovim.mode != 'insert'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+k ctrl+i",
|
||||||
|
"command": "-editor.action.showHover",
|
||||||
|
"when": "editorTextFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "shift+tab",
|
||||||
|
"command": "-acceptAlternativeSelectedSuggestion",
|
||||||
|
"when": "suggestWidgetVisible && textInputFocus && textInputFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "ctrl+f",
|
||||||
|
"command": "-vscode-neovim.ctrl-f",
|
||||||
|
"when": "editorTextFocus && neovim.ctrlKeysNormal && neovim.init && neovim.mode != 'insert'"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "space",
|
||||||
|
"command": "whichkey.show",
|
||||||
|
"when": "neovim.mode != 'insert'"
|
||||||
|
}
|
||||||
|
]
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,73 @@
|
|||||||
|
command! LspCodeAction lua require 'lv-utils'.code_action()
|
||||||
|
command! LspDeclaration lua require 'lv-utils'.declaration()
|
||||||
|
command! LspDefinition lua require 'lv-utils'.definition()
|
||||||
|
command! LspDocumentSymbol lua require 'lv-utils'.document_symbol()
|
||||||
|
command! LspFormatting lua require 'lv-utils'.formatting()
|
||||||
|
command! LspFormattingSync lua require 'lv-utils'.formatting_sync()
|
||||||
|
command! LspHover lua require 'lv-utils'.hover()
|
||||||
|
command! LspImplementation lua require 'lv-utils'.implementation()
|
||||||
|
command! LspRangeCodeAction lua require 'lv-utils'.range_code_action()
|
||||||
|
command! LspRangeFormatting lua require 'lv-utils'.range_formatting()
|
||||||
|
command! LspReferences lua require 'lv-utils'.references()
|
||||||
|
command! LspRename lua require 'lv-utils'.rename()
|
||||||
|
command! LspTypeDefinition lua require 'lv-utils'.type_definition()
|
||||||
|
command! LspWorkspaceSymbol lua require 'lv-utils'.workspace_symbol()
|
||||||
|
command! LspGotoNext lua require 'lv-utils'.goto_next()
|
||||||
|
command! LspGotoPrev lua require 'lv-utils'.goto_prev()
|
||||||
|
command! LspShowLineDiagnostics lua require 'lv-utils'.show_line_diagnostics()
|
||||||
|
command! NextHunk lua require 'lv-utils'.next_hunk()
|
||||||
|
command! PrevHunk lua require 'lv-utils'.prev_hunk()
|
||||||
|
command! StageHunk lua require 'lv-utils'.stage_hunk()
|
||||||
|
command! UndoStageHunk lua require 'lv-utils'.undo_stage_hunk()
|
||||||
|
command! ResetHunk lua require 'lv-utils'.reset_hunk()
|
||||||
|
command! ResetBuffer lua require 'lv-utils'.reset_buffer()
|
||||||
|
command! PreviewHunk lua require 'lv-utils'.preview_hunk()
|
||||||
|
command! BlameLine lua require 'lv-utils'.blame_line()
|
||||||
|
command! W noa w
|
||||||
|
|
||||||
|
" Debugging
|
||||||
|
command! DebugToggleBreakpoint lua require'dap'.toggle_breakpoint()
|
||||||
|
command! DebugStart lua require'dap'.continue()
|
||||||
|
command! DebugContinue lua require'dap'.continue()
|
||||||
|
command! DebugStepOver lua require'dap'.step_over()
|
||||||
|
command! DebugStepOut lua require'dap'.step_out()
|
||||||
|
command! DebugStepInto lua require'dap'.step_into()
|
||||||
|
command! DebugToggleRepl lua require'dap'.repl.toggle()
|
||||||
|
command! DebugGetSession lua require'dap'.session()
|
||||||
|
|
||||||
|
" Available Debug Adapters:
|
||||||
|
" https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
|
||||||
|
"
|
||||||
|
" Adapter configuration and installation instructions:
|
||||||
|
" https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation
|
||||||
|
"
|
||||||
|
" Debug Adapter protocol:
|
||||||
|
" https://microsoft.github.io/debug-adapter-protocol/
|
||||||
|
|
||||||
|
" TODO Add full support later
|
||||||
|
" nnoremap <silent> <F5> :lua require'dap'.continue()<CR>
|
||||||
|
" nnoremap <silent> <F10> :lua require'dap'.step_over()<CR>
|
||||||
|
" nnoremap <silent> <F11> :lua require'dap'.step_into()<CR>
|
||||||
|
" nnoremap <silent> <F12> :lua require'dap'.step_out()<CR>
|
||||||
|
" nnoremap <silent> <leader>b :lua require'dap'.toggle_breakpoint()<CR>
|
||||||
|
" nnoremap <silent> <leader>B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
|
||||||
|
" nnoremap <silent> <leader>lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
|
||||||
|
" nnoremap <silent> <leader>dr :lua require'dap'.repl.open()<CR>
|
||||||
|
" nnoremap <silent> <leader>dl :lua require'dap'.run_last()<CR>
|
||||||
|
|
||||||
|
autocmd! User GoyoEnter lua require('gitsigns').toggle_signs()
|
||||||
|
autocmd! User GoyoLeave lua require('gitsigns').toggle_signs()
|
||||||
|
|
||||||
|
autocmd User GoyoEnter set laststatus=0
|
||||||
|
autocmd User GoyoLeave set laststatus=2
|
||||||
|
|
||||||
|
" autocmd! User GoyoEnter lua require('galaxyline').disable_galaxyline()
|
||||||
|
" autocmd! User GoyoLeave lua require('galaxyline').galaxyline_augroup()
|
||||||
|
|
||||||
|
function! QuickFixToggle()
|
||||||
|
if empty(filter(getwininfo(), 'v:val.quickfix'))
|
||||||
|
copen
|
||||||
|
else
|
||||||
|
cclose
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
" packadd quickscope
|
||||||
|
|
||||||
|
execute 'luafile ' . stdpath('config') . '/lua/settings.lua'
|
||||||
|
|
||||||
|
function! s:manageEditorSize(...)
|
||||||
|
let count = a:1
|
||||||
|
let to = a:2
|
||||||
|
for i in range(1, count ? count : 1)
|
||||||
|
call VSCodeNotify(to == 'increase' ? 'workbench.action.increaseViewSize' : 'workbench.action.decreaseViewSize')
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:vscodeCommentary(...) abort
|
||||||
|
if !a:0
|
||||||
|
let &operatorfunc = matchstr(expand('<sfile>'), '[^. ]*$')
|
||||||
|
return 'g@'
|
||||||
|
elseif a:0 > 1
|
||||||
|
let [line1, line2] = [a:1, a:2]
|
||||||
|
else
|
||||||
|
let [line1, line2] = [line("'["), line("']")]
|
||||||
|
endif
|
||||||
|
|
||||||
|
call VSCodeCallRange("editor.action.commentLine", line1, line2, 0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:openVSCodeCommandsInVisualMode()
|
||||||
|
normal! gv
|
||||||
|
let visualmode = visualmode()
|
||||||
|
if visualmode == "V"
|
||||||
|
let startLine = line("v")
|
||||||
|
let endLine = line(".")
|
||||||
|
call VSCodeNotifyRange("workbench.action.showCommands", startLine, endLine, 1)
|
||||||
|
else
|
||||||
|
let startPos = getpos("v")
|
||||||
|
let endPos = getpos(".")
|
||||||
|
call VSCodeNotifyRangePos("workbench.action.showCommands", startPos[1], endPos[1], startPos[2], endPos[2], 1)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:openWhichKeyInVisualMode()
|
||||||
|
normal! gv
|
||||||
|
let visualmode = visualmode()
|
||||||
|
if visualmode == "V"
|
||||||
|
let startLine = line("v")
|
||||||
|
let endLine = line(".")
|
||||||
|
call VSCodeNotifyRange("whichkey.show", startLine, endLine, 1)
|
||||||
|
else
|
||||||
|
let startPos = getpos("v")
|
||||||
|
let endPos = getpos(".")
|
||||||
|
call VSCodeNotifyRangePos("whichkey.show", startPos[1], endPos[1], startPos[2], endPos[2], 1)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Better Navigation
|
||||||
|
nnoremap <silent> <C-j> :call VSCodeNotify('workbench.action.navigateDown')<CR>
|
||||||
|
xnoremap <silent> <C-j> :call VSCodeNotify('workbench.action.navigateDown')<CR>
|
||||||
|
nnoremap <silent> <C-k> :call VSCodeNotify('workbench.action.navigateUp')<CR>
|
||||||
|
xnoremap <silent> <C-k> :call VSCodeNotify('workbench.action.navigateUp')<CR>
|
||||||
|
nnoremap <silent> <C-h> :call VSCodeNotify('workbench.action.navigateLeft')<CR>
|
||||||
|
xnoremap <silent> <C-h> :call VSCodeNotify('workbench.action.navigateLeft')<CR>
|
||||||
|
nnoremap <silent> <C-l> :call VSCodeNotify('workbench.action.navigateRight')<CR>
|
||||||
|
xnoremap <silent> <C-l> :call VSCodeNotify('workbench.action.navigateRight')<CR>
|
||||||
|
|
||||||
|
nnoremap gr <Cmd>call VSCodeNotify('editor.action.goToReferences')<CR>
|
||||||
|
|
||||||
|
" Bind C-/ to vscode commentary since calling from vscode produces double comments due to multiple cursors
|
||||||
|
" xnoremap <expr> <C-/> <SID>vscodeCommentary()
|
||||||
|
" nnoremap <expr> <C-/> <SID>vscodeCommentary() . '_'
|
||||||
|
|
||||||
|
nnoremap <silent> <C-w>_ :<C-u>call VSCodeNotify('workbench.action.toggleEditorWidths')<CR>
|
||||||
|
|
||||||
|
nnoremap <silent> <Space> :call VSCodeNotify('whichkey.show')<CR>
|
||||||
|
xnoremap <silent> <Space> :<C-u>call <SID>openWhichKeyInVisualMode()<CR>
|
||||||
|
|
||||||
|
xnoremap <silent> <C-P> :<C-u>call <SID>openVSCodeCommandsInVisualMode()<CR>
|
||||||
|
|
||||||
|
xmap gc <Plug>VSCodeCommentary
|
||||||
|
nmap gc <Plug>VSCodeCommentary
|
||||||
|
omap gc <Plug>VSCodeCommentary
|
||||||
|
nmap gcc <Plug>VSCodeCommentaryLine
|
||||||
|
|
||||||
|
" Simulate same TAB behavior in VSCode
|
||||||
|
nmap <Tab> :Tabnext<CR>
|
||||||
|
nmap <S-Tab> :Tabprev<CR>
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
home_dir = os.getenv("HOME")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("-i","--install", help="install tools",type=str)
|
||||||
|
args = parser.parse_args()
|
||||||
|
installer = Installer()
|
||||||
|
installer.install(args.install)
|
||||||
|
|
||||||
|
class Base(object):
|
||||||
|
def cmd_exist(self, name):
|
||||||
|
from shutil import which
|
||||||
|
return which(name) is not None
|
||||||
|
|
||||||
|
def check_link(self, name:str,target:str):
|
||||||
|
if os.path.islink(name):
|
||||||
|
t = os.readlink(name)
|
||||||
|
if t == target:
|
||||||
|
return
|
||||||
|
os.system("mv %s %s.bak"%(name,name))
|
||||||
|
os.system("ln -s %s %s"%(target,name))
|
||||||
|
class Installer(Base):
|
||||||
|
def install(self, val:str):
|
||||||
|
if val== "":
|
||||||
|
print("install value is empty")
|
||||||
|
exit()
|
||||||
|
|
||||||
|
install_map = {
|
||||||
|
"neovim": self.install_neovim,
|
||||||
|
"z": self.install_z,
|
||||||
|
"git": self.install_git,
|
||||||
|
"packer": self.install_packer,
|
||||||
|
}
|
||||||
|
if val in install_map:
|
||||||
|
install_map.get(val)()
|
||||||
|
else:
|
||||||
|
print("cmd not support, install: "+val)
|
||||||
|
|
||||||
|
|
||||||
|
# install neovim
|
||||||
|
def install_neovim(self):
|
||||||
|
if not self.cmd_exist("nvim"):
|
||||||
|
os.chdir("/usr/local")
|
||||||
|
os.system("wget https://github.com/neovim/neovim/releases/download/v0.6.0/nvim-macos.tar.gz")
|
||||||
|
os.system("tar zxf nvim-macos.tar.gz")
|
||||||
|
os.system("ln -s /usr/local/nvim-osx64 /usr/local/nvim")
|
||||||
|
self.check_link(home_dir+"/.config/nvim",home_dir+"/.doftile/nvim")
|
||||||
|
|
||||||
|
def install_z(self):
|
||||||
|
if not os.path.exists("/usr/local/z.lua"):
|
||||||
|
os.system("git clone --depth=1 https://github.com/skywind3000/z.lua.git /usr/local/z.lua")
|
||||||
|
|
||||||
|
def install_git(self):
|
||||||
|
if not self.cmd_exist("git"):
|
||||||
|
print("git is not exist")
|
||||||
|
self.check_link(home_dir+"~/.gitconfig", home_dir+"/.dotfile/git/.gitconfig")
|
||||||
|
|
||||||
|
def install_packer(self):
|
||||||
|
if not os.path.exists(home_dir+"/.local/share/nvim/site/pack/packer/start/packer.nvim"):
|
||||||
|
os.system("git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim")
|
||||||
|
else:
|
||||||
|
print("packer already installed")
|
||||||
|
class Base(object):
|
||||||
|
def cmd_exist(self, name):
|
||||||
|
from shutil import which
|
||||||
|
return which(name) is not None
|
||||||
|
|
||||||
|
def check_link(self, name:str,target:str):
|
||||||
|
if os.path.islink(name):
|
||||||
|
t = os.readlink(name)
|
||||||
|
if t == target:
|
||||||
|
print("path is right: %s"%name)
|
||||||
|
return
|
||||||
|
os.system("mv %s %s.bak"%(name,name))
|
||||||
|
os.system("ln -s %s %s"%(target,name))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user