Merge branch 'dev' into thesis
npm: remove deprecated setting nvim: remove duplicate settign + set tabstop to 4 correctly shorten "_XXX" path in statusline basic web-dev setup format lua files through LSP replace path in statusline by "/.../" when useful
This commit is contained in:
commit
5982a0573e
@ -1,4 +1,3 @@
|
||||
prefix=${XDG_DATA_HOME}/npm
|
||||
cache=${XDG_CACHE_HOME}/npm
|
||||
tmp=${XDG_RUNTIME_DIR}/npm
|
||||
init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js
|
||||
|
14
.config/nvim/after/ftplugin/javascript.lua
Normal file
14
.config/nvim/after/ftplugin/javascript.lua
Normal file
@ -0,0 +1,14 @@
|
||||
-- Author : swytch
|
||||
-- Created : Saturday Feb. 18, 2023 20:41:05 CET
|
||||
-- License : GPLv3
|
||||
-- Description : javascript settings file
|
||||
|
||||
|
||||
local format_sync_grp = vim.api.nvim_create_augroup("Format", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.js",
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ timeout_ms = 200 })
|
||||
end,
|
||||
group = format_sync_grp,
|
||||
})
|
44
.config/nvim/after/ftplugin/markdown.lua
Normal file
44
.config/nvim/after/ftplugin/markdown.lua
Normal file
@ -0,0 +1,44 @@
|
||||
-- Author : swytch
|
||||
-- Created : Saturday Feb. 18, 2023 21:54:19 CET
|
||||
-- License : GPLv3
|
||||
-- Description : markdown settings file
|
||||
|
||||
|
||||
-- Snippets
|
||||
local ls = require("luasnip")
|
||||
|
||||
-- some shorthands...
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local d = ls.dynamic_node
|
||||
|
||||
-- Returns a snippet_node wrapped around an insertNode whose initial
|
||||
-- text value is set to the current date in the desired format.
|
||||
local date_input = function(args, snip, old_state, fmt)
|
||||
local fmt = fmt or "%Y-%m-%d"
|
||||
return sn(nil, i(1, os.date(fmt)))
|
||||
end
|
||||
|
||||
ls.add_snippets("markdown", {
|
||||
s("date", {
|
||||
d(1, date_input, {}, { user_args = { "%Y-%m-%d" } }),
|
||||
}),
|
||||
s("datep", {
|
||||
d(1, date_input, {}, { user_args = { "%Y-%m-%d %X %z" } }),
|
||||
}),
|
||||
s("/xrpt", {
|
||||
t("<!--more-->"),
|
||||
}),
|
||||
s("bb", {
|
||||
t({ "**" }),
|
||||
i(1),
|
||||
t({ "**" }),
|
||||
}),
|
||||
s("ii", {
|
||||
t({ "*" }),
|
||||
i(1),
|
||||
t({ "*" }),
|
||||
}),
|
||||
})
|
@ -95,9 +95,11 @@ vim.keymap.set("n", "<leader>tk",
|
||||
{ desc = "Search through keymaps" }
|
||||
)
|
||||
vim.keymap.set("n", "<leader>tx",
|
||||
function() require("telescope.builtin").diagnostics(
|
||||
function()
|
||||
require("telescope.builtin").diagnostics(
|
||||
{ buffnr = 0 }
|
||||
) end,
|
||||
)
|
||||
end,
|
||||
{ desc = "Search through LSP diagnostics" }
|
||||
)
|
||||
|
||||
|
11
.config/nvim/lua/plugin/lsp/html.lua
Normal file
11
.config/nvim/lua/plugin/lsp/html.lua
Normal file
@ -0,0 +1,11 @@
|
||||
-- Author : swytch
|
||||
-- Created : Sunday Feb. 19, 2023 17:09:46 CET
|
||||
-- License : GPLv3
|
||||
-- Description : neovim lsp config file for html-lsp
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(opts)
|
||||
end
|
||||
|
||||
return M
|
@ -11,6 +11,8 @@ local servers = {
|
||||
"rust_analyzer",
|
||||
"lua_ls",
|
||||
"texlab",
|
||||
"tsserver",
|
||||
"html",
|
||||
}
|
||||
|
||||
return {
|
||||
@ -22,7 +24,6 @@ return {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
config = function()
|
||||
|
||||
vim.diagnostic.config({
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
|
@ -15,4 +15,3 @@ M.setup = function(opts)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
|
12
.config/nvim/lua/plugin/lsp/tsserver.lua
Normal file
12
.config/nvim/lua/plugin/lsp/tsserver.lua
Normal file
@ -0,0 +1,12 @@
|
||||
-- Author : swytch
|
||||
-- Created : Sunday Feb. 19, 2023 17:12:35 CET
|
||||
-- License : GPLv3
|
||||
-- Description : neovim lsp config file for tsserver
|
||||
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(opts)
|
||||
end
|
||||
|
||||
return M
|
@ -13,6 +13,7 @@ return {
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"c", "cpp", "lua", "rust", "bash", "vim", "latex", "python",
|
||||
"html", "javascript", "json", "markdown"
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
@ -49,7 +49,7 @@ opt.showmode = false
|
||||
|
||||
-- text, tabs, indents
|
||||
opt.textwidth = 79
|
||||
opt.shiftwidth = 8
|
||||
opt.tabstop = 4
|
||||
opt.softtabstop = -1
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 0
|
||||
@ -63,3 +63,8 @@ utils.create_augroup({
|
||||
{ "BufNewFile,BufRead", "*.mom", "set filetype=groff" },
|
||||
{ "BufNewFile,BufRead", "*.tex", "set filetype=tex" },
|
||||
}, "enforce_filetypes")
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = { "*.njk" },
|
||||
callback = function() vim.bo.filetype = "html" end,
|
||||
})
|
||||
|
@ -107,17 +107,34 @@ local function shorten_path(path, max_len)
|
||||
end
|
||||
|
||||
local segments = vim.split(path, sep)
|
||||
for idx = 1, #segments - 1 do
|
||||
local start = 1
|
||||
if segments[1] == "~" then
|
||||
start = start + 1
|
||||
end
|
||||
|
||||
|
||||
for idx = start, #segments - 1 do
|
||||
if len <= max_len then
|
||||
break
|
||||
end
|
||||
|
||||
local segment = segments[idx]
|
||||
local shortened = segment:sub(1, vim.startswith(segment, '.') and 2 or 1)
|
||||
local short_end = 1
|
||||
if (vim.startswith(segment, '.') or vim.startswith(segment, '_')) then
|
||||
short_end = 2
|
||||
end
|
||||
local shortened = segment:sub(1, short_end)
|
||||
segments[idx] = shortened
|
||||
len = len - (#segment - #shortened)
|
||||
end
|
||||
|
||||
if (len > max_len and #segments > 3) then
|
||||
while (len > max_len and #segments > 3) do
|
||||
table.remove(segments, 2)
|
||||
end
|
||||
table.insert(segments,2, "...")
|
||||
end
|
||||
|
||||
return table.concat(segments, sep)
|
||||
end
|
||||
|
||||
@ -170,7 +187,7 @@ local function statusline_focused()
|
||||
|
||||
local left = table.concat {
|
||||
gen_section(accent_color, { get_mode_display_name(mg) }),
|
||||
gen_section("%#Middle#", { shorten_path(file, winwidth / 3) }),
|
||||
gen_section("%#Middle#", { shorten_path(file, winwidth / 2) }),
|
||||
gen_section("%#Bottom#", { "%m", "%r" }),
|
||||
gen_section(
|
||||
"%#Alert#",
|
||||
@ -211,7 +228,6 @@ local function statusline_focused()
|
||||
"%=",
|
||||
right
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
local function statusline_not_focused()
|
||||
@ -220,7 +236,7 @@ local function statusline_not_focused()
|
||||
local winwidth = vim.fn.winwidth(0)
|
||||
return table.concat {
|
||||
gen_section("%#StatuslineNF#", {
|
||||
shorten_path(file, winwidth / 3),
|
||||
shorten_path(file, winwidth / 2),
|
||||
"%m"
|
||||
}),
|
||||
"%=",
|
||||
|
Reference in New Issue
Block a user