fixed some issues that have been bothering me.
This commit is contained in:
parent
0f976b5d74
commit
61f0e55271
@ -84,16 +84,18 @@ vim.cmd([[autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatop
|
|||||||
vim.cmd([[autocmd BufRead,BufNewFile *.tex set filetype=tex]])
|
vim.cmd([[autocmd BufRead,BufNewFile *.tex set filetype=tex]])
|
||||||
|
|
||||||
-- Trim whitespace from files on save
|
-- Trim whitespace from files on save
|
||||||
vim.cmd [[
|
vim.cmd([[
|
||||||
autocmd BufWritePre * let currPos = getpos(".")
|
autocmd BufWritePre * let currPos = getpos(".")
|
||||||
autocmd BufWritePre * %s/\s\+$//e
|
autocmd BufWritePre * %s/\s\+$//e
|
||||||
autocmd BufWritePre * %s/\n\+\%$//e
|
autocmd BufWritePre * %s/\n\+\%$//e
|
||||||
autocmd BufWritePre *.[ch] %s/\%$/\r/e
|
autocmd BufWritePre *.[ch] %s/\%$/\r/e
|
||||||
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
|
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
|
||||||
]]
|
]])
|
||||||
|
|
||||||
-- Recompile and restart Xmonad on save of config file for Xmonad or Xmobar
|
-- Recompile and restart Xmonad on save of config file for Xmonad or Xmobar
|
||||||
vim.cmd([[autocmd BufWritePost ~/.xmonad/xmonad.hs,~/.config/xmobar/xmobar-main.hs,~/.config/xmobar/xmobar-sub.hs,~/.config/xmobar/xmobar-single.hs !xmonad --recompile && xmonad --restart]])
|
vim.cmd(
|
||||||
|
[[autocmd BufWritePost ~/.xmonad/xmonad.hs,~/.config/xmobar/xmobar-main.hs,~/.config/xmobar/xmobar-sub.hs,~/.config/xmobar/xmobar-single.hs !xmonad --recompile && xmonad --restart]]
|
||||||
|
)
|
||||||
|
|
||||||
-- Run custom textclear command when exiting a .tex file (cleanup files)
|
-- Run custom textclear command when exiting a .tex file (cleanup files)
|
||||||
vim.cmd([[autocmd VimLeave *.tex !texclear %]])
|
vim.cmd([[autocmd VimLeave *.tex !texclear %]])
|
||||||
|
|||||||
@ -26,22 +26,8 @@ return {
|
|||||||
["<C-Space>"] = cmp.mapping.complete(),
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
["<C-e>"] = cmp.mapping.abort(),
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
if cmp.visible() then
|
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
cmp.select_next_item()
|
|
||||||
end
|
|
||||||
end, {
|
|
||||||
"i",
|
|
||||||
"s",
|
|
||||||
}),
|
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
end
|
|
||||||
end, {
|
|
||||||
"i",
|
|
||||||
"s",
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
|
|||||||
@ -21,7 +21,7 @@ return {
|
|||||||
},
|
},
|
||||||
servers = {
|
servers = {
|
||||||
jsonls = {},
|
jsonls = {},
|
||||||
lua_ls = {
|
sumneko_lua = {
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
workspace = {
|
workspace = {
|
||||||
@ -33,15 +33,6 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- arduino_language_server = {
|
|
||||||
-- cmd = {
|
|
||||||
-- "arduino-language-server",
|
|
||||||
-- "-cli-config",
|
|
||||||
-- "/home/solomon/.arduino15/arduino-cli.yaml",
|
|
||||||
-- "-fqbn",
|
|
||||||
-- "arduino:avr:uno",
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
},
|
},
|
||||||
setup = {
|
setup = {
|
||||||
-- additional setup can be added here.
|
-- additional setup can be added here.
|
||||||
@ -84,14 +75,6 @@ return {
|
|||||||
require("lspconfig")[server].setup(server_opts)
|
require("lspconfig")[server].setup(server_opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- temp fix for lspconfig rename
|
|
||||||
-- https://github.com/neovim/nvim-lspconfig/pull/2439
|
|
||||||
local mappings = require("mason-lspconfig.mappings.server")
|
|
||||||
if not mappings.lspconfig_to_package.lua_ls then
|
|
||||||
mappings.lspconfig_to_package.lua_ls = "lua-language-server"
|
|
||||||
mappings.package_to_lspconfig["lua-language-server"] = "lua_ls"
|
|
||||||
end
|
|
||||||
|
|
||||||
local mlsp = require("mason-lspconfig")
|
local mlsp = require("mason-lspconfig")
|
||||||
local available = mlsp.get_available_servers()
|
local available = mlsp.get_available_servers()
|
||||||
|
|
||||||
|
|||||||
@ -4,10 +4,24 @@ return {
|
|||||||
cmd = "NvimTreeToggle",
|
cmd = "NvimTreeToggle",
|
||||||
config = function()
|
config = function()
|
||||||
local nvim_tree = require("nvim-tree")
|
local nvim_tree = require("nvim-tree")
|
||||||
local nvim_tree_config = require("nvim-tree.config")
|
|
||||||
local icons = require("lazyvim.config.icons")
|
local icons = require("lazyvim.config.icons")
|
||||||
|
|
||||||
local tree_cb = nvim_tree_config.nvim_tree_callback
|
local function edit_or_open()
|
||||||
|
-- open as vsplit on current node
|
||||||
|
local action = "edit"
|
||||||
|
local node = lib.get_node_at_cursor()
|
||||||
|
|
||||||
|
-- Just copy what's done normally with vsplit
|
||||||
|
if node.link_to and not node.nodes then
|
||||||
|
require("nvim-tree.actions.node.open-file").fn(action, node.link_to)
|
||||||
|
view.close() -- Close the tree if file was opened
|
||||||
|
elseif node.nodes ~= nil then
|
||||||
|
lib.expand_or_collapse(node)
|
||||||
|
else
|
||||||
|
require("nvim-tree.actions.node.open-file").fn(action, node.absolute_path)
|
||||||
|
view.close() -- Close the tree if file was opened
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
nvim_tree.setup({
|
nvim_tree.setup({
|
||||||
hijack_directories = {
|
hijack_directories = {
|
||||||
@ -95,16 +109,15 @@ return {
|
|||||||
width = 30,
|
width = 30,
|
||||||
hide_root_folder = false,
|
hide_root_folder = false,
|
||||||
side = "left",
|
side = "left",
|
||||||
|
number = false,
|
||||||
|
relativenumber = false,
|
||||||
mappings = {
|
mappings = {
|
||||||
custom_only = false,
|
custom_only = false,
|
||||||
list = {
|
list = {
|
||||||
{ key = { "l", "<CR>", "o" }, cb = tree_cb("edit") },
|
{ key = "l", action = "edit", action_cb = edit_or_open },
|
||||||
{ key = "h", cb = tree_cb("close_node") },
|
{ key = "h", action = "close_node" },
|
||||||
{ key = "v", cb = tree_cb("vsplit") },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
number = false,
|
|
||||||
relativenumber = false,
|
|
||||||
},
|
},
|
||||||
actions = {
|
actions = {
|
||||||
open_file = {
|
open_file = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user