merge deneb and hermia
This commit is contained in:
commit
08d8a22709
5 changed files with 168 additions and 152 deletions
|
|
@ -1,3 +1,7 @@
|
|||
function fish_user_key_bindings
|
||||
fzf_key_bindings
|
||||
end
|
||||
|
||||
function fsize
|
||||
sed -i "s/size:.*/size: $argv/" $HOME/.config/alacritty/alacritty.yml
|
||||
end
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ set-window-option -g window-style fg=#aaaaaa,bg=terminal
|
|||
set-window-option -g window-active-style fg=terminal,bg=terminal
|
||||
|
||||
set -g status-left '#[fg=green][ #H ][ '
|
||||
set -g status-right '#[fg=green]][ #[bright]#[fg=blue]%Y-%m-%d #[fg=white]%I:%M #[dim]#[fg=green]]'
|
||||
set -g status-right '#[fg=green]][ #{pane_width}x#{pane_height} #[bright]#[fg=blue]%Y-%m-%d #[fg=white]%I:%M #[dim]#[fg=green]]'
|
||||
|
||||
# Notifying if other windows has activities
|
||||
setw -g monitor-activity on
|
||||
|
|
|
|||
108
.vim/nvim.lua
108
.vim/nvim.lua
|
|
@ -1,7 +1,7 @@
|
|||
require('nvim-autopairs').setup{}
|
||||
require('nvim-autopairs').setup {}
|
||||
|
||||
-- nvim_lsp object
|
||||
local nvim_lsp = require'lspconfig'
|
||||
local nvim_lsp = require 'lspconfig'
|
||||
|
||||
-- function to attach completion when setting up lsp
|
||||
local on_attach = function(client)
|
||||
|
|
@ -19,19 +19,28 @@ rust_capabilities.textDocument.completion.completionItem.resolveSupport = {
|
|||
|
||||
-- Enable rust_analyzer
|
||||
nvim_lsp.rust_analyzer.setup({
|
||||
on_attach=on_attach,
|
||||
capabilities=rust_capabilities,
|
||||
on_attach = on_attach,
|
||||
capabilities = rust_capabilities,
|
||||
})
|
||||
nvim_lsp.gopls.setup({ on_attach=on_attach })
|
||||
nvim_lsp.pyright.setup({ on_attach=on_attach })
|
||||
nvim_lsp.clangd.setup({ on_attach=on_attach })
|
||||
nvim_lsp.gopls.setup({ on_attach = on_attach })
|
||||
nvim_lsp.pyright.setup({ on_attach = on_attach })
|
||||
nvim_lsp.clangd.setup({ on_attach = on_attach })
|
||||
nvim_lsp.tsserver.setup {
|
||||
cmd = { "/home/barak/.yarn/bin/typescript-language-server", "--stdio" }
|
||||
}
|
||||
nvim_lsp.vuels.setup {
|
||||
cmd = { "/home/barak/.yarn/bin/vls" }
|
||||
}
|
||||
|
||||
nvim_lsp.svelte.setup {
|
||||
cmd = { "/home/barak/.yarn/bin/svelteserver", "--stdio" }
|
||||
}
|
||||
|
||||
local runtime_path = vim.split(package.path, ';')
|
||||
table.insert(runtime_path, "lua/?.lua")
|
||||
table.insert(runtime_path, "lua/?/init.lua")
|
||||
|
||||
|
||||
require'lspconfig'.sumneko_lua.setup {
|
||||
require 'lspconfig'.sumneko_lua.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
|
|
@ -42,7 +51,7 @@ require'lspconfig'.sumneko_lua.setup {
|
|||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim'},
|
||||
globals = { 'vim' },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
|
|
@ -60,13 +69,15 @@ require('go').setup()
|
|||
|
||||
function org_imports(wait_ms)
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = {only = {"source.organizeImports"}}
|
||||
|
||||
params.context = { only = { "source.organizeImports" } }
|
||||
|
||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, wait_ms)
|
||||
|
||||
for _, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
vim.lsp.util.apply_workspace_edit(r.edit)
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, "utf-8")
|
||||
else
|
||||
vim.lsp.buf.execute_command(r.command)
|
||||
end
|
||||
|
|
@ -75,9 +86,9 @@ function org_imports(wait_ms)
|
|||
end
|
||||
|
||||
nvim_lsp.efm.setup {
|
||||
init_options = {documentFormatting = true},
|
||||
init_options = { documentFormatting = true },
|
||||
settings = {
|
||||
rootMarkers = {".git/"},
|
||||
rootMarkers = { ".git/" },
|
||||
languages = {
|
||||
lua = {
|
||||
{ formatCommand = "lua-format -i", formatStdin = true }
|
||||
|
|
@ -98,11 +109,11 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
|||
virtual_text = false,
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
-- Compe setup
|
||||
require'compe'.setup {
|
||||
require 'compe'.setup {
|
||||
enabled = true;
|
||||
autocomplete = true;
|
||||
debug = false;
|
||||
|
|
@ -123,11 +134,11 @@ require'compe'.setup {
|
|||
}
|
||||
|
||||
--signature_cfg = {
|
||||
--hint_enable = true,
|
||||
--hint_prefix = "% ",
|
||||
--handler_opts = {
|
||||
--border = "none"
|
||||
--},
|
||||
--hint_enable = true,
|
||||
--hint_prefix = "% ",
|
||||
--handler_opts = {
|
||||
--border = "none"
|
||||
--},
|
||||
--}
|
||||
|
||||
--require'lsp_signature'.on_attach(signature_cfg)
|
||||
|
|
@ -174,10 +185,10 @@ _G.s_tab_complete = function()
|
|||
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})
|
||||
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 })
|
||||
|
||||
require('lspkind').init({
|
||||
-- disables text annotations
|
||||
|
|
@ -231,18 +242,18 @@ require('trouble').setup {
|
|||
--close = "q", -- close the list
|
||||
--cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
|
||||
--refresh = "r", -- manually refresh
|
||||
jump = {"o", "<tab>"}, -- jump to the diagnostic or open / close folds
|
||||
jump = { "o", "<tab>" }, -- jump to the diagnostic or open / close folds
|
||||
--open_split = { "<c-x>" }, -- open buffer in new split
|
||||
--open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
|
||||
open_tab = { }, -- open buffer in new tab
|
||||
jump_close = {"<cr>"}, -- jump to the diagnostic and close the list
|
||||
open_tab = {}, -- open buffer in new tab
|
||||
jump_close = { "<cr>" }, -- jump to the diagnostic and close the list
|
||||
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
|
||||
toggle_preview = "P", -- toggle auto_preview
|
||||
hover = "K", -- opens a small popup with the full multiline message
|
||||
preview = "p", -- preview the diagnostic location
|
||||
close_folds = {"zM", "zm"}, -- close all folds
|
||||
open_folds = {"zR", "zr"}, -- open all folds
|
||||
toggle_fold = {"zA", "za"}, -- toggle fold of current file
|
||||
close_folds = { "zM", "zm" }, -- close all folds
|
||||
open_folds = { "zR", "zr" }, -- open all folds
|
||||
toggle_fold = { "zA", "za" }, -- toggle fold of current file
|
||||
previous = "k", -- previous item
|
||||
next = "j" -- next item
|
||||
},
|
||||
|
|
@ -284,9 +295,9 @@ require('telescope').setup {
|
|||
},
|
||||
}
|
||||
|
||||
local builtin = require'telescope.builtin'
|
||||
local builtin = require 'telescope.builtin'
|
||||
|
||||
local dropdown = require'telescope.themes'.get_dropdown({
|
||||
local dropdown = require 'telescope.themes'.get_dropdown({
|
||||
--previewer = false,
|
||||
--prompt_title = "",
|
||||
--results_height = 16,
|
||||
|
|
@ -300,7 +311,7 @@ local dropdown = require'telescope.themes'.get_dropdown({
|
|||
--winblend = 10
|
||||
})
|
||||
|
||||
local telescope_ivy = require'telescope.themes'.get_ivy({
|
||||
local telescope_ivy = require 'telescope.themes'.get_ivy({
|
||||
|
||||
})
|
||||
|
||||
|
|
@ -309,7 +320,7 @@ local telescope_ivy = require'telescope.themes'.get_ivy({
|
|||
-- Treesitter
|
||||
--
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ensure_installed = {
|
||||
"c",
|
||||
|
|
@ -375,13 +386,13 @@ require'nvim-treesitter.configs'.setup {
|
|||
}
|
||||
}
|
||||
|
||||
require"nvim-treesitter.highlight".set_custom_captures {
|
||||
require "nvim-treesitter.highlight".set_custom_captures {
|
||||
-- Highlight the @foo.bar capture group with the "Identifier" highlight group.
|
||||
-- ["foo.bar"] = "Identifier",
|
||||
["generic_type_param"] = "TSCGenericTypeParam",
|
||||
}
|
||||
|
||||
require"neogen".setup {}
|
||||
require "neogen".setup {}
|
||||
|
||||
--
|
||||
-- Helper functions for my own grepping commands.
|
||||
|
|
@ -394,7 +405,7 @@ live_grep_repo = function(conf)
|
|||
--local opt = {
|
||||
--cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||
--}
|
||||
for k,v in pairs(conf) do opt[k] = v end
|
||||
for k, v in pairs(conf) do opt[k] = v end
|
||||
builtin.live_grep(opt)
|
||||
end
|
||||
|
||||
|
|
@ -405,19 +416,19 @@ git_grep_word = function(conf)
|
|||
--local opt = {
|
||||
--cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||
--}
|
||||
for k,v in pairs(conf) do opt[k] = v end
|
||||
for k, v in pairs(conf) do opt[k] = v end
|
||||
builtin.grep_string(opt)
|
||||
end
|
||||
|
||||
buffer_telescope = function(conf)
|
||||
local opt = telescope_ivy
|
||||
for k,v in pairs(conf) do opt[k] = v end
|
||||
for k, v in pairs(conf) do opt[k] = v end
|
||||
builtin.buffers(opt)
|
||||
end
|
||||
|
||||
file_list = function(conf)
|
||||
local opt = telescope_ivy
|
||||
for k,v in pairs(conf) do opt[k] = v end
|
||||
for k, v in pairs(conf) do opt[k] = v end
|
||||
builtin.git_files(opt)
|
||||
end
|
||||
|
||||
|
|
@ -426,12 +437,12 @@ end
|
|||
--- My own "where" clause generator for Rust
|
||||
---
|
||||
function string.insert(str1, str2, pos)
|
||||
return str1:sub(1,pos)..str2..str1:sub(pos+1)
|
||||
return str1:sub(1, pos) .. str2 .. str1:sub(pos + 1)
|
||||
end
|
||||
|
||||
function string.split(s, delimiter)
|
||||
result = {};
|
||||
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
|
||||
for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do
|
||||
table.insert(result, match);
|
||||
end
|
||||
return result;
|
||||
|
|
@ -457,13 +468,14 @@ local function rust_whereify_line(line, var_name)
|
|||
|
||||
local whitespace = string.match(line, "^(%s*)")
|
||||
|
||||
local generic = "<"..var_name..">"
|
||||
local generic = "<" .. var_name .. ">"
|
||||
local out = string.insert(line, generic, paren - 1)
|
||||
|
||||
local brace = string.find(out, "%{")
|
||||
if brace == nil then brace = string.len(out) end
|
||||
|
||||
out = string.insert(out, "\n"..whitespace.."where\n"..whitespace.." "..var_name..": ,\n"..whitespace, brace - 1)
|
||||
out = string.insert(out, "\n" .. whitespace .. "where\n" .. whitespace .. " " .. var_name .. ": ,\n" .. whitespace,
|
||||
brace - 1)
|
||||
|
||||
return string.split(out, "\n")
|
||||
end
|
||||
|
|
@ -472,8 +484,8 @@ function rust_where_at_line()
|
|||
local var_name = vim.fn.input("Variable: ")
|
||||
local lineNum, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
local replacements = rust_whereify_line(vim.api.nvim_get_current_line(), var_name)
|
||||
vim.api.nvim_buf_set_lines(0, lineNum-1, lineNum, false, replacements)
|
||||
vim.api.nvim_win_set_cursor(0, {lineNum + 2, 4})
|
||||
vim.api.nvim_buf_set_lines(0, lineNum - 1, lineNum, false, replacements)
|
||||
vim.api.nvim_win_set_cursor(0, { lineNum + 2, 4 })
|
||||
end
|
||||
|
||||
function neogen_dwim()
|
||||
|
|
@ -490,7 +502,7 @@ function neogen_dwim()
|
|||
["class_definition"] = "class",
|
||||
}
|
||||
|
||||
local ts_utils = require'nvim-treesitter.ts_utils'
|
||||
local ts_utils = require 'nvim-treesitter.ts_utils'
|
||||
local current_node = ts_utils.get_node_at_cursor()
|
||||
while (current_node) do
|
||||
local v = table[current_node:type()]
|
||||
|
|
|
|||
6
.vimrc
6
.vimrc
|
|
@ -171,7 +171,7 @@ Plug 'plytophogy/vim-virtualenv'
|
|||
Plug 'lunaru/vim-less'
|
||||
Plug 'hylang/vim-hy', {'for': 'hy'}
|
||||
"Plug 'mhartington/nvim-typescript'
|
||||
Plug 'leafgarland/typescript-vim'
|
||||
"Plug 'leafgarland/typescript-vim'
|
||||
Plug 'leafOfTree/vim-svelte-plugin'
|
||||
"Plug 'posva/vim-vue'
|
||||
Plug 'Shougo/context_filetype.vim'
|
||||
|
|
@ -275,7 +275,7 @@ nnoremap <silent> gW <cmd>lua vim.lsp.buf.workspace_symbol()<CR>
|
|||
"nnoremap <silent> gd <cmd>lua vim.lsp.buf.declaration()<CR>
|
||||
nnoremap <silent> ga <cmd>lua vim.lsp.buf.code_action()<CR>
|
||||
"nnoremap <silent> ga <cmd>lua require('telescope.builtin').lsp_code_actions({initial_mode = "normal"})<cr>
|
||||
vnoremap <silent> ga <cmd>lua vim.lsp.buf.range_code_actions()<CR>
|
||||
vnoremap <silent> ga <cmd>lua vim.lsp.buf.range_code_action()<CR>
|
||||
"vnoremap <silent> ga :<C-U>lua require('telescope.builtin').lsp_range_code_actions({initial_mode = "normal"})<cr>
|
||||
"nnoremap <silent> ge <cmd>lua vim.lsp.diagnostic.show_line_diagnostics({show_header = false, focusable = false})<CR>
|
||||
"nnoremap <silent> ge <cmd>lua vim.diagnostic.open_float({focusable = false})<CR>
|
||||
|
|
@ -296,7 +296,7 @@ autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 1000)
|
|||
autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 1000)
|
||||
autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
|
||||
autocmd BufWritePre *.go lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
|
||||
autocmd BufWritePre *.go :silent! lua org_imports(3000)
|
||||
autocmd BufWritePre *.go silent! lua org_imports(3000)
|
||||
|
||||
" Goto previous/next diagnostic warning/error
|
||||
nnoremap <silent> g[ <cmd>lua vim.diagnostic.goto_prev()<CR>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/perl
|
||||
#!/usr/bin/perl
|
||||
|
||||
use Getopt::Std;
|
||||
getopts('u');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue