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
|
function fish_user_key_bindings
|
||||||
fzf_key_bindings
|
fzf_key_bindings
|
||||||
end
|
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-window-option -g window-active-style fg=terminal,bg=terminal
|
||||||
|
|
||||||
set -g status-left '#[fg=green][ #H ][ '
|
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
|
# Notifying if other windows has activities
|
||||||
setw -g monitor-activity on
|
setw -g monitor-activity on
|
||||||
|
|
|
||||||
306
.vim/nvim.lua
306
.vim/nvim.lua
|
|
@ -1,7 +1,7 @@
|
||||||
require('nvim-autopairs').setup{}
|
require('nvim-autopairs').setup {}
|
||||||
|
|
||||||
-- nvim_lsp object
|
-- nvim_lsp object
|
||||||
local nvim_lsp = require'lspconfig'
|
local nvim_lsp = require 'lspconfig'
|
||||||
|
|
||||||
-- function to attach completion when setting up lsp
|
-- function to attach completion when setting up lsp
|
||||||
local on_attach = function(client)
|
local on_attach = function(client)
|
||||||
|
|
@ -18,20 +18,29 @@ rust_capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Enable rust_analyzer
|
-- Enable rust_analyzer
|
||||||
nvim_lsp.rust_analyzer.setup({
|
nvim_lsp.rust_analyzer.setup({
|
||||||
on_attach=on_attach,
|
on_attach = on_attach,
|
||||||
capabilities=rust_capabilities,
|
capabilities = rust_capabilities,
|
||||||
})
|
})
|
||||||
nvim_lsp.gopls.setup({ on_attach=on_attach })
|
nvim_lsp.gopls.setup({ on_attach = on_attach })
|
||||||
nvim_lsp.pyright.setup({ on_attach=on_attach })
|
nvim_lsp.pyright.setup({ on_attach = on_attach })
|
||||||
nvim_lsp.clangd.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, ';')
|
local runtime_path = vim.split(package.path, ';')
|
||||||
table.insert(runtime_path, "lua/?.lua")
|
table.insert(runtime_path, "lua/?.lua")
|
||||||
table.insert(runtime_path, "lua/?/init.lua")
|
table.insert(runtime_path, "lua/?/init.lua")
|
||||||
|
|
||||||
|
require 'lspconfig'.sumneko_lua.setup {
|
||||||
require'lspconfig'.sumneko_lua.setup {
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
|
|
@ -42,7 +51,7 @@ require'lspconfig'.sumneko_lua.setup {
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
-- Get the language server to recognize the `vim` global
|
-- Get the language server to recognize the `vim` global
|
||||||
globals = {'vim'},
|
globals = { 'vim' },
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
-- Make the server aware of Neovim runtime files
|
-- Make the server aware of Neovim runtime files
|
||||||
|
|
@ -59,50 +68,52 @@ require'lspconfig'.sumneko_lua.setup {
|
||||||
require('go').setup()
|
require('go').setup()
|
||||||
|
|
||||||
function org_imports(wait_ms)
|
function org_imports(wait_ms)
|
||||||
local params = vim.lsp.util.make_range_params()
|
local params = vim.lsp.util.make_range_params()
|
||||||
params.context = {only = {"source.organizeImports"}}
|
|
||||||
|
|
||||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, wait_ms)
|
params.context = { only = { "source.organizeImports" } }
|
||||||
for _, res in pairs(result or {}) do
|
|
||||||
for _, r in pairs(res.result or {}) do
|
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, wait_ms)
|
||||||
if r.edit then
|
|
||||||
vim.lsp.util.apply_workspace_edit(r.edit)
|
for _, res in pairs(result or {}) do
|
||||||
else
|
for _, r in pairs(res.result or {}) do
|
||||||
vim.lsp.buf.execute_command(r.command)
|
if r.edit then
|
||||||
end
|
vim.lsp.util.apply_workspace_edit(r.edit, "utf-8")
|
||||||
end
|
else
|
||||||
end
|
vim.lsp.buf.execute_command(r.command)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
nvim_lsp.efm.setup {
|
nvim_lsp.efm.setup {
|
||||||
init_options = {documentFormatting = true},
|
init_options = { documentFormatting = true },
|
||||||
settings = {
|
settings = {
|
||||||
rootMarkers = {".git/"},
|
rootMarkers = { ".git/" },
|
||||||
languages = {
|
languages = {
|
||||||
lua = {
|
lua = {
|
||||||
{ formatCommand = "lua-format -i", formatStdin = true }
|
{ formatCommand = "lua-format -i", formatStdin = true }
|
||||||
},
|
},
|
||||||
python = {
|
python = {
|
||||||
{ formatCommand = 'black --quiet -', formatStdin = true }
|
{ formatCommand = 'black --quiet -', formatStdin = true }
|
||||||
},
|
},
|
||||||
rust = {
|
rust = {
|
||||||
{ formatCommand = 'rustfmt', formatStdin = true }
|
{ formatCommand = 'rustfmt', formatStdin = true }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Enable diagnostics
|
-- Enable diagnostics
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
signs = true,
|
signs = true,
|
||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Compe setup
|
-- Compe setup
|
||||||
require'compe'.setup {
|
require 'compe'.setup {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
autocomplete = true;
|
autocomplete = true;
|
||||||
debug = false;
|
debug = false;
|
||||||
|
|
@ -123,21 +134,21 @@ require'compe'.setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
--signature_cfg = {
|
--signature_cfg = {
|
||||||
--hint_enable = true,
|
--hint_enable = true,
|
||||||
--hint_prefix = "% ",
|
--hint_prefix = "% ",
|
||||||
--handler_opts = {
|
--handler_opts = {
|
||||||
--border = "none"
|
--border = "none"
|
||||||
--},
|
--},
|
||||||
--}
|
--}
|
||||||
|
|
||||||
--require'lsp_signature'.on_attach(signature_cfg)
|
--require'lsp_signature'.on_attach(signature_cfg)
|
||||||
|
|
||||||
saga_cfg = {
|
saga_cfg = {
|
||||||
code_action_prompt = {
|
code_action_prompt = {
|
||||||
enable = false,
|
enable = false,
|
||||||
sign = false,
|
sign = false,
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
-- require'lspsaga'.init_lsp_saga(saga_cfg)
|
-- require'lspsaga'.init_lsp_saga(saga_cfg)
|
||||||
|
|
||||||
|
|
@ -146,12 +157,12 @@ local t = function(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
local check_back_space = function()
|
local check_back_space = function()
|
||||||
local col = vim.fn.col('.') - 1
|
local col = vim.fn.col('.') - 1
|
||||||
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Use (s-)tab to:
|
-- Use (s-)tab to:
|
||||||
|
|
@ -174,49 +185,49 @@ _G.s_tab_complete = function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.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("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("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("s", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true })
|
||||||
|
|
||||||
require('lspkind').init({
|
require('lspkind').init({
|
||||||
-- disables text annotations
|
-- disables text annotations
|
||||||
--with_text = false,
|
--with_text = false,
|
||||||
--with_text = true,
|
--with_text = true,
|
||||||
|
|
||||||
-- defines how annotations are shown
|
-- defines how annotations are shown
|
||||||
-- default: symbol
|
-- default: symbol
|
||||||
-- options: 'text', 'text_symbol', 'symbol_text', 'symbol'
|
-- options: 'text', 'text_symbol', 'symbol_text', 'symbol'
|
||||||
mode = 'symbol',
|
mode = 'symbol',
|
||||||
|
|
||||||
-- default symbol map
|
-- default symbol map
|
||||||
-- can be either 'default' or 'codicons'
|
-- can be either 'default' or 'codicons'
|
||||||
preset = 'default',
|
preset = 'default',
|
||||||
|
|
||||||
-- override preset symbols
|
-- override preset symbols
|
||||||
-- default: {}
|
-- default: {}
|
||||||
--symbol_map = {
|
--symbol_map = {
|
||||||
--Method = 'm',
|
--Method = 'm',
|
||||||
--Function = 'f',
|
--Function = 'f',
|
||||||
--Text = 'txt',
|
--Text = 'txt',
|
||||||
--Constructor = 'new',
|
--Constructor = 'new',
|
||||||
--Variable = 'var',
|
--Variable = 'var',
|
||||||
--Class = 'cls',
|
--Class = 'cls',
|
||||||
--Interface = 'iface',
|
--Interface = 'iface',
|
||||||
--Module = 'mod',
|
--Module = 'mod',
|
||||||
--Property = 'prop',
|
--Property = 'prop',
|
||||||
--Unit = 'unit',
|
--Unit = 'unit',
|
||||||
--Value = 'val',
|
--Value = 'val',
|
||||||
--Enum = 'enum',
|
--Enum = 'enum',
|
||||||
--Keyword = 'kw',
|
--Keyword = 'kw',
|
||||||
--Snippet = 'sn',
|
--Snippet = 'sn',
|
||||||
--Color = 'color',
|
--Color = 'color',
|
||||||
--File = 'file',
|
--File = 'file',
|
||||||
--Folder = 'fold',
|
--Folder = 'fold',
|
||||||
--EnumMember = 'enum',
|
--EnumMember = 'enum',
|
||||||
--Constant = 'const',
|
--Constant = 'const',
|
||||||
--Struct = 'struct',
|
--Struct = 'struct',
|
||||||
--},
|
--},
|
||||||
})
|
})
|
||||||
|
|
||||||
--require('rust-tools').setup({
|
--require('rust-tools').setup({
|
||||||
|
|
@ -225,27 +236,27 @@ require('lspkind').init({
|
||||||
require('trouble').setup {
|
require('trouble').setup {
|
||||||
mode = "document_diagnostics",
|
mode = "document_diagnostics",
|
||||||
auto_close = true,
|
auto_close = true,
|
||||||
action_keys = { -- key mappings for actions in the trouble list
|
action_keys = { -- key mappings for actions in the trouble list
|
||||||
-- map to {} to remove a mapping, for example:
|
-- map to {} to remove a mapping, for example:
|
||||||
-- close = {},
|
-- close = {},
|
||||||
--close = "q", -- close the list
|
--close = "q", -- close the list
|
||||||
--cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
|
--cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
|
||||||
--refresh = "r", -- manually refresh
|
--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_split = { "<c-x>" }, -- open buffer in new split
|
||||||
--open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
|
--open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
|
||||||
open_tab = { }, -- open buffer in new tab
|
open_tab = {}, -- open buffer in new tab
|
||||||
jump_close = {"<cr>"}, -- jump to the diagnostic and close the list
|
jump_close = { "<cr>" }, -- jump to the diagnostic and close the list
|
||||||
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
|
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
|
||||||
toggle_preview = "P", -- toggle auto_preview
|
toggle_preview = "P", -- toggle auto_preview
|
||||||
hover = "K", -- opens a small popup with the full multiline message
|
hover = "K", -- opens a small popup with the full multiline message
|
||||||
preview = "p", -- preview the diagnostic location
|
preview = "p", -- preview the diagnostic location
|
||||||
close_folds = {"zM", "zm"}, -- close all folds
|
close_folds = { "zM", "zm" }, -- close all folds
|
||||||
open_folds = {"zR", "zr"}, -- open all folds
|
open_folds = { "zR", "zr" }, -- open all folds
|
||||||
toggle_fold = {"zA", "za"}, -- toggle fold of current file
|
toggle_fold = { "zA", "za" }, -- toggle fold of current file
|
||||||
previous = "k", -- previous item
|
previous = "k", -- previous item
|
||||||
next = "j" -- next item
|
next = "j" -- next item
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local trouble_telescope = require("trouble.providers.telescope")
|
local trouble_telescope = require("trouble.providers.telescope")
|
||||||
|
|
@ -284,23 +295,23 @@ 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,
|
--previewer = false,
|
||||||
--prompt_title = "",
|
--prompt_title = "",
|
||||||
--results_height = 16,
|
--results_height = 16,
|
||||||
--width = 0.6,
|
--width = 0.6,
|
||||||
--borderchars = {
|
--borderchars = {
|
||||||
--{"─", "│", "─", "│", "╭", "╮", "╯", "╰"},
|
--{"─", "│", "─", "│", "╭", "╮", "╯", "╰"},
|
||||||
--prompt = {"─", "│", " ", "│", "╭", "╮", "│", "│"},
|
--prompt = {"─", "│", " ", "│", "╭", "╮", "│", "│"},
|
||||||
--results = {"─", "│", "─", "│", "├", "┤", "╯", "╰"},
|
--results = {"─", "│", "─", "│", "├", "┤", "╯", "╰"},
|
||||||
--preview = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"}
|
--preview = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"}
|
||||||
--},
|
--},
|
||||||
--winblend = 10
|
--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
|
-- Treesitter
|
||||||
--
|
--
|
||||||
|
|
||||||
require'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
|
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"c",
|
"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.
|
-- Highlight the @foo.bar capture group with the "Identifier" highlight group.
|
||||||
-- ["foo.bar"] = "Identifier",
|
-- ["foo.bar"] = "Identifier",
|
||||||
["generic_type_param"] = "TSCGenericTypeParam",
|
["generic_type_param"] = "TSCGenericTypeParam",
|
||||||
}
|
}
|
||||||
|
|
||||||
require"neogen".setup {}
|
require "neogen".setup {}
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Helper functions for my own grepping commands.
|
-- Helper functions for my own grepping commands.
|
||||||
|
|
@ -392,9 +403,9 @@ live_grep_repo = function(conf)
|
||||||
local opt = telescope_ivy
|
local opt = telescope_ivy
|
||||||
opt['cwd'] = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
opt['cwd'] = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||||
--local opt = {
|
--local opt = {
|
||||||
--cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
--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)
|
builtin.live_grep(opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -403,21 +414,21 @@ git_grep_word = function(conf)
|
||||||
local opt = telescope_ivy
|
local opt = telescope_ivy
|
||||||
opt['cwd'] = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
opt['cwd'] = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||||
--local opt = {
|
--local opt = {
|
||||||
--cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
--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)
|
builtin.grep_string(opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
buffer_telescope = function(conf)
|
buffer_telescope = function(conf)
|
||||||
local opt = telescope_ivy
|
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)
|
builtin.buffers(opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
file_list = function(conf)
|
file_list = function(conf)
|
||||||
local opt = telescope_ivy
|
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)
|
builtin.git_files(opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -426,15 +437,15 @@ end
|
||||||
--- My own "where" clause generator for Rust
|
--- My own "where" clause generator for Rust
|
||||||
---
|
---
|
||||||
function string.insert(str1, str2, pos)
|
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
|
end
|
||||||
|
|
||||||
function string.split(s, delimiter)
|
function string.split(s, delimiter)
|
||||||
result = {};
|
result = {};
|
||||||
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
|
for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do
|
||||||
table.insert(result, match);
|
table.insert(result, match);
|
||||||
end
|
end
|
||||||
return result;
|
return result;
|
||||||
end
|
end
|
||||||
|
|
||||||
local function rust_whereify_line(line, var_name)
|
local function rust_whereify_line(line, var_name)
|
||||||
|
|
@ -457,13 +468,14 @@ local function rust_whereify_line(line, var_name)
|
||||||
|
|
||||||
local whitespace = string.match(line, "^(%s*)")
|
local whitespace = string.match(line, "^(%s*)")
|
||||||
|
|
||||||
local generic = "<"..var_name..">"
|
local generic = "<" .. var_name .. ">"
|
||||||
local out = string.insert(line, generic, paren - 1)
|
local out = string.insert(line, generic, paren - 1)
|
||||||
|
|
||||||
local brace = string.find(out, "%{")
|
local brace = string.find(out, "%{")
|
||||||
if brace == nil then brace = string.len(out) end
|
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")
|
return string.split(out, "\n")
|
||||||
end
|
end
|
||||||
|
|
@ -472,8 +484,8 @@ function rust_where_at_line()
|
||||||
local var_name = vim.fn.input("Variable: ")
|
local var_name = vim.fn.input("Variable: ")
|
||||||
local lineNum, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local lineNum, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
local replacements = rust_whereify_line(vim.api.nvim_get_current_line(), var_name)
|
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_buf_set_lines(0, lineNum - 1, lineNum, false, replacements)
|
||||||
vim.api.nvim_win_set_cursor(0, {lineNum + 2, 4})
|
vim.api.nvim_win_set_cursor(0, { lineNum + 2, 4 })
|
||||||
end
|
end
|
||||||
|
|
||||||
function neogen_dwim()
|
function neogen_dwim()
|
||||||
|
|
@ -484,17 +496,17 @@ function neogen_dwim()
|
||||||
["function_signature_item"] = "func",
|
["function_signature_item"] = "func",
|
||||||
["struct_item"] = "class",
|
["struct_item"] = "class",
|
||||||
["trait_item"] = "class",
|
["trait_item"] = "class",
|
||||||
["package_clause"] = "type",
|
["package_clause"] = "type",
|
||||||
["const_declaration"] = "type",
|
["const_declaration"] = "type",
|
||||||
["var_declaration"] = "type",
|
["var_declaration"] = "type",
|
||||||
["class_definition"] = "class",
|
["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()
|
local current_node = ts_utils.get_node_at_cursor()
|
||||||
while (current_node) do
|
while (current_node) do
|
||||||
local v = table[current_node:type()]
|
local v = table[current_node:type()]
|
||||||
if v then
|
if v then
|
||||||
require('neogen').generate({ type = v })
|
require('neogen').generate({ type = v })
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
|
|
||||||
6
.vimrc
6
.vimrc
|
|
@ -171,7 +171,7 @@ Plug 'plytophogy/vim-virtualenv'
|
||||||
Plug 'lunaru/vim-less'
|
Plug 'lunaru/vim-less'
|
||||||
Plug 'hylang/vim-hy', {'for': 'hy'}
|
Plug 'hylang/vim-hy', {'for': 'hy'}
|
||||||
"Plug 'mhartington/nvim-typescript'
|
"Plug 'mhartington/nvim-typescript'
|
||||||
Plug 'leafgarland/typescript-vim'
|
"Plug 'leafgarland/typescript-vim'
|
||||||
Plug 'leafOfTree/vim-svelte-plugin'
|
Plug 'leafOfTree/vim-svelte-plugin'
|
||||||
"Plug 'posva/vim-vue'
|
"Plug 'posva/vim-vue'
|
||||||
Plug 'Shougo/context_filetype.vim'
|
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> gd <cmd>lua vim.lsp.buf.declaration()<CR>
|
||||||
nnoremap <silent> ga <cmd>lua vim.lsp.buf.code_action()<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>
|
"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>
|
"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.lsp.diagnostic.show_line_diagnostics({show_header = false, focusable = false})<CR>
|
||||||
"nnoremap <silent> ge <cmd>lua vim.diagnostic.open_float({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 *.py lua vim.lsp.buf.formatting_sync(nil, 1000)
|
||||||
autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_seq_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 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
|
" Goto previous/next diagnostic warning/error
|
||||||
nnoremap <silent> g[ <cmd>lua vim.diagnostic.goto_prev()<CR>
|
nnoremap <silent> g[ <cmd>lua vim.diagnostic.goto_prev()<CR>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/local/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
getopts('u');
|
getopts('u');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue