feat: switch to kitty

This commit is contained in:
2022-03-14 19:21:46 +01:00
parent 2cae0ba5f5
commit fe391566e1
25 changed files with 2049 additions and 147 deletions

View File

@@ -12,6 +12,13 @@ cmd [[
au ColorScheme myspecialcolors hi Normal ctermbg=red guibg=red
]]
cmd [[
augroup filetypedetect
au BufNewFile,BufRead *.frag setl ft=glsl
au BufNewFile,BufRead *.vert setl ft=glsl
augroup END
]]
cmd [[
augroup SaveManualFolds
autocmd!

View File

@@ -1,8 +1,7 @@
local cmd = vim.cmd
local util = require "vim.lsp.util"
local utils = require("utils")
local g = vim.g
function tablelength(T)
local function tablelength(T)
local count = 0
for _ in pairs(T) do
count = count + 1
@@ -30,16 +29,15 @@ local function select_client(method)
return supported_client
end
g.neoformat_enabled_glsl = {}
function FormattingSync()
vim.cmd("Neoformat")
-- local client = select_client("textDocument/formatting")
-- if client == nil then
-- vim.notify("No LSP Client with formatting connected")
-- end
-- vim.notify("Formatting with LSP")
-- local params = util.make_formatting_params({})
-- local result, err = client.request_sync("textDocument/formatting", params, 500, vim.api.nvim_get_current_buf())
-- if result and result.result then

View File

@@ -66,7 +66,7 @@ map("n", "<Leader>r", "<cmd>lua require('rest-nvim').run()<CR>", options)
map("n", "<Leader>q", "<Esc>:q<CR>", options)
-- Open Nerdtree
map("n", "<C-n>", ":NvimTreeToggle<CR>", options)
map("n", "<C-n>", ":NvimTreeToggle<CR>:TransparentEnable<CR>", options)
-- Make ctrl+s work
map("n", "<C-s>", "<Esc>:w<CR>", options)

View File

@@ -1,29 +1,17 @@
local lsp = require "lspconfig"
local lsp_status = require("lsp-status")
_G.lsp_organize_imports = function()
local params = {
command = "_typescript.organizeImports",
arguments = {vim.api.nvim_buf_get_name(0)},
title = ""
}
vim.lsp.buf.execute_command(params)
end
local ts_utils = require("nvim-lsp-ts-utils")
-- function to attach completion when setting up lsp
local function on_attach()
local function on_attach(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
vim.cmd("command! LspOrganize lua lsp_organize_imports()")
vim.api.nvim_buf_map(bufnr, "n", "gs", ":LspOrganize<CR>", {silent = true})
end
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
print(runtime_path)
require "lspconfig".sumneko_lua.setup {
lsp.sumneko_lua.setup {
settings = {
Lua = {
runtime = {
@@ -50,8 +38,9 @@ require "lspconfig".sumneko_lua.setup {
-- Ltex Language Server
require("grammar-guard").init()
-- setup LSP config
require("lspconfig").grammar_guard.setup(
lsp.grammar_guard.setup(
{
cmd = {vim.fn.expand("~/.local/share/nvim/lsp_servers/ltex/ltex-ls/bin/ltex-ls")},
settings = {
@@ -90,26 +79,74 @@ lsp.svelte.setup {
capabilities = lsp_status.capabilities
}
local function organize_imports()
local params = {
command = "_typescript.organizeImports",
arguments = {vim.api.nvim_buf_get_name(0)},
title = ""
}
vim.lsp.buf.execute_command(params)
end
-- Typescript Language Server
lsp.tsserver.setup {
on_attach = on_attach,
capabilities = lsp_status.capabilities,
commands = {
OrganizeImports = {
organize_imports,
description = "Organize Imports"
}
lsp.tsserver.setup(
{
-- Needed for inlayHints. Merge this table with your settings or copy
-- it from the source if you want to add your own init_options.
init_options = require("nvim-lsp-ts-utils").init_options,
--
on_attach = function(client, bufnr)
vim.notify("Eyyyy")
-- defaults
ts_utils.setup(
{
debug = true,
disable_commands = false,
enable_import_on_completion = false,
-- import all
import_all_timeout = 5000, -- ms
-- lower numbers = higher priority
import_all_priorities = {
same_file = 1, -- add to existing import statement
local_files = 2, -- git files or files with relative path markers
buffer_content = 3, -- loaded buffer content
buffers = 4 -- loaded buffer names
},
import_all_scan_buffers = 100,
import_all_select_source = false,
-- if false will avoid organizing imports
always_organize_imports = true,
-- filter diagnostics
filter_out_diagnostics_by_severity = {},
filter_out_diagnostics_by_code = {},
-- inlay hints
auto_inlay_hints = true,
inlay_hints_highlight = "Comment",
inlay_hints_priority = 200, -- priority of the hint extmarks
inlay_hints_throttle = 150, -- throttle the inlay hint request
inlay_hints_format = {
-- format options for individual hint kind
Type = {},
Parameter = {},
Enum = {}
-- Example format customization for `Type` kind:
-- Type = {
-- highlight = "Comment",
-- text = function(text)
-- return "->" .. text:sub(2)
-- end,
-- },
},
-- update imports on file move
update_imports_on_move = false,
require_confirmation_on_move = false,
watch_dir = nil
}
)
-- required to fix code action ranges and filter diagnostics
ts_utils.setup_client(client)
-- no default maps, so you may want to define some here
local opts = {silent = true}
vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", ":TSLspRenameFile<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", ":TSLspImportAll<CR>", opts)
end
}
}
)
-- JSON ls setup
lsp.jsonls.setup {
@@ -117,6 +154,12 @@ lsp.jsonls.setup {
capabilities = lsp_status.capabilities
}
-- JSON ls setup
lsp.cssls.setup {
on_attach = on_attach,
capabilities = lsp_status.capabilities
}
-- Setup diagnostics formaters and linters for non LSP provided files
lsp.diagnosticls.setup {
on_attach = on_attach,

View File

@@ -1,14 +1,16 @@
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.on_server_ready(function(server)
local opts = {}
lsp_installer.on_server_ready(
function(server)
local opts = {}
-- (optional) Customize the options passed to the server
-- if server.name == "tsserver" then
-- opts.root_dir = function() ... end
-- end
-- (optional) Customize the options passed to the server
-- if server.name == "tsserver" then
-- opts.root_dir = function() ... end
-- end
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
server:setup(opts)
vim.cmd [[ do User LspAttachBuffers ]]
end)
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
-- server:setup(opts)
vim.cmd [[ do User LspAttachBuffers ]]
end
)

View File

@@ -6,9 +6,8 @@ return require("packer").startup(
-- General Helper Functions
use "nvim-lua/plenary.nvim"
-- Faster Filetype Detection
-- Filetype Detection
use "nathom/filetype.nvim"
use "alexghergh/nvim-tmux-navigation"
-- Theming Section
-- use 'folke/tokyonight.nvim'
@@ -27,6 +26,7 @@ return require("packer").startup(
use "windwp/nvim-autopairs"
-- Code Navigation
use "alexghergh/nvim-tmux-navigation"
use "dense-analysis/ale"
use "nathanmsmith/nvim-ale-diagnostic"
use "junegunn/fzf"
@@ -52,6 +52,7 @@ return require("packer").startup(
}
-- Syntax / Autocomplete
use "terminalnode/sway-vim-syntax" --sway config syntax
use "neovim/nvim-lspconfig"
use "hrsh7th/nvim-cmp"
use "hrsh7th/cmp-nvim-lsp"
@@ -65,6 +66,7 @@ return require("packer").startup(
use "saadparwaiz1/cmp_luasnip"
use "williamboman/nvim-lsp-installer"
use "nvim-lua/lsp-status.nvim"
use "jose-elias-alvarez/nvim-lsp-ts-utils"
use "neoclide/jsonc.vim"
use "brymer-meneses/grammar-guard.nvim"
use {
@@ -72,10 +74,6 @@ return require("packer").startup(
run = ":TSUpdate"
}
-- Language Supports
use "beyondmarc/glsl.vim" -- GLSL
use "ellisonleao/glow.nvim" -- MARKDOWN
-- Autoformat
use "sbdchd/neoformat"
-- use "lukas-reineke/format.nvim"