Skip to content

Commit

Permalink
remote some spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed Feb 18, 2022
1 parent 246e49b commit 95a2d68
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 97 deletions.
24 changes: 24 additions & 0 deletions config/nvim/lua/custom/plugins/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
return {
{
"jose-elias-alvarez/null-ls.nvim",
after = "nvim-lspconfig",
config = function()
require("custom.plugins.null-ls").setup()
end,
},

{ "justinmk/vim-dirvish", event = "VimEnter" },
{ "tpope/vim-eunuch", event = "VimEnter" },
{ "wincent/scalpel", event = "BufRead" },
{ "blankname/vim-fish", event = "BufRead" },
{
"numToStr/FTerm.nvim",
event = "BufRead",
config = function()
require("FTerm").setup {
blend = 15,
}
end,
},
{ "fedepujol/move.nvim" },
}
157 changes: 72 additions & 85 deletions config/nvim/lua/custom/plugins/lspconfig.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
local M = {}

local map = require("core.utils").map

M.setup_lsp = function(attach, capabilities)
local lspconfig = require "lspconfig"

lspconfig.tsserver.setup {
on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>fm", "<cmd>lua vim.lsp.buf.formatting()<CR>", {})
end,
}
-- lspconfig.tsserver.setup {
-- on_attach = function(client, bufnr)
-- client.resolved_capabilities.document_formatting = false
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>fm", "<cmd>lua vim.lsp.buf.formatting()<CR>", {})
-- end,
-- }

-- lspservers with default config
local servers = { "html", "cssls", "bashls", "clangd" }

for _, lsp in ipairs(servers) do
for _, lsp in ipairs { "html", "bashls", } do
lspconfig[lsp].setup {
on_attach = attach,
capabilities = capabilities,
Expand All @@ -23,28 +24,30 @@ M.setup_lsp = function(attach, capabilities)
}
end

-- lua lsp!
local sumneko_root_path = "/home/sid/test/sumneko_lua"
local sumneko_binary = sumneko_root_path .. "/bin/lua-language-server"
on_attach_clangd = function(client, bufnr)
-- Run nvchad's attach
attach(client, bufnr)
map("n", "<leader>a", ":ClangdSwitchSourceHeader<cr>")
end

lspconfig.sumneko_lua.setup {
cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
on_attach = attach,
lspconfig["clangd"].setup {
on_attach = on_attach_clangd,
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
}
},
flags = {
debounce_text_changes = 150,
},
}

on_attach_pyright = function(client, bufnr)
-- Run nvchad's attach
attach(client, bufnr)
end

lspconfig["pyright"].setup {
on_attach = on_attach_clangd,
capabilities = capabilities,
flags = {
debounce_text_changes = 150,
},
}
end
Expand All @@ -54,66 +57,50 @@ return M
-- local M = {}
--
-- M.setup_lsp = function(attach, capabilities)
-- local lsp_installer = require "nvim-lsp-installer"
--
-- lsp_installer.on_server_ready(function(server)
-- local opts = {
-- on_attach = attach,
-- capabilities = capabilities,
-- flags = {
-- debounce_text_changes = 150,
-- },
-- settings = {},
-- }
-- local lsp_installer = require "nvim-lsp-installer"
--
-- opts.on_attach = function(client, bufnr)
-- -- Run nvchad's attach
-- attach(client, bufnr)
-- end
--
-- server:setup(opts)
-- vim.cmd [[ do User LspAttachBuffers ]]
-- end)
-- end
--
-- return M
-- lsp_installer.on_server_ready(function(server)
-- local opts = {
-- on_attach = attach,
-- capabilities = capabilities,
-- flags = {
-- debounce_text_changes = 150,
-- },
-- settings = {},
-- }
--
-- require("plugins.configs.others").lsp_handlers()
-- if server.name == 'clangd' then
-- opts.on_attach = function(client, bufnr)
-- -- client.resolved_capabilities.document_formatting = false
-- -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>fm", "<cmd>lua vim.lsp.buf.formatting()<CR>", {})
-- vim.api.nvim_buf_set_keymap("n", "<leader>a", ":ClangdSwitchSourceHeader<CR>", { noremap = true, silent = true })
-- end,
-- else
-- opts.on_attach = function(client, bufnr)
-- end,
-- end
--
-- local function on_attach(_, bufnr)
-- local function buf_set_option(...)
-- vim.api.nvim_buf_set_option(bufnr, ...)
-- end
-- -- opts.on_attach = function(client, bufnr)
-- -- local function buf_set_keymap(...)
-- -- vim.api.nvim_buf_set_keymap(bufnr, ...)
-- -- end
-- --
-- -- -- Run nvchad's attach
-- -- attach(client, bufnr)
-- --
-- -- buf_set_keymap("n", "<leader>a", ":ClangdSwitchSourceHeader<CR>", { noremap = true, silent = true })
-- -- vim.cmd [[
-- -- augroup lsp_buf_format
-- -- au! BufWritePre <buffer>
-- -- autocmd BufWritePre <buffer> :lua vim.lsp.buf.formatting_sync()
-- -- augroup END
-- -- ]]
-- --
-- -- end
--
-- -- Enable completion triggered by <c-x><c-o>
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- require("core.mappings").lspconfig()
-- server:setup(opts)
-- vim.cmd [[ do User LspAttachBuffers ]]
-- end)
-- end
--
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
-- local lsp_installer = require "nvim-lsp-installer"
--
-- lsp_installer.settings {
-- ui = {
-- icons = {
-- server_installed = "﫟",
-- server_pending = "",
-- server_uninstalled = "✗",
-- },
-- },
-- }
--
-- lsp_installer.on_server_ready(function(server)
-- -- server options, so default options for all servers
-- local opts = {
-- on_attach = on_attach,
-- capabilities = capabilities,
-- flags = {
-- debounce_text_changes = 150,
-- },
-- settings = {},
-- }
--
-- server:setup(opts)
-- vim.cmd [[ do User LspAttachBuffers ]]
-- end)
-- return M
38 changes: 38 additions & 0 deletions config/nvim/lua/custom/plugins/null-ls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
local null_ls = require "null-ls"
local b = null_ls.builtins

local sources = {

b.formatting.deno_fmt,
b.formatting.prettier.with { filetypes = { "html", "markdown", "css", "json", "yaml" } },
b.formatting.taplo,
-- Lua
b.formatting.stylua,
b.diagnostics.luacheck.with { extra_args = { "--global vim" } },

-- Shell
b.formatting.shfmt.with {
extra_args = { "-i", "4", "-ci" },
},
b.diagnostics.shellcheck.with { diagnostics_format = "#{m} [#{c}]" },

-- Python
b.formatting.isort.with {
extra_args = { "--stdout", "--profile", "black" },
},
b.formatting.black.with {
extra_args = { "--quiet", "--fast", "-" },
},
b.formatting.cmake_format,
}

local M = {}

M.setup = function()
null_ls.setup {
debug = false,
sources = sources,
}
end

return M
25 changes: 13 additions & 12 deletions shell.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,42 @@ export OSREV=`uname -r`
export OSARCH=`uname -m`

# XDG path
export XDG_CONFIG_HOME=$HOME/.config
export XDG_CONFIG_HOME=$HOME/.config

# Go language
export GOPATH=$HOME/.go
export GOPATH=$HOME/.go

# Developing in C/C++
export CMAKE_BUILD_PARALLEL_LEVEL=4
export C_INCLUDE_PATH=/usr/local/include
export LIBRARY_PATH=/usr/local/lib
export CMAKE_BUILD_PARALLEL_LEVEL=4
export C_INCLUDE_PATH=/usr/local/include
export LIBRARY_PATH=/usr/local/lib

# Docs
export MANPAGER='nvim +Man!'
export MANPAGER='nvim +Man!'

# Search
export RIPGREP_CONFIG_PATH=$HOME/.ripgreprc
export RIPGREP_CONFIG_PATH=$HOME/.ripgreprc

# Terminal
export CLICOLOR=1
export CLICOLOR=1
export fish_greeting=

# Editor
export EDITOR=nvim
export VISUAL=$EDITOR

# Home paths
add_path $HOME/bin
add_path $HOME/bin

# Rust / Cargo
export CARGO_HOME=$HOME/opt/cargo
add_path $CARGO_HOME/bin
add_path $CARGO_HOME/bin

# Brew paths
BREW_PREFIX=$(brew --prefix)
add_path $BREW_PREFIX/opt/ruby/bin
add_path $BREW_PREFIX/opt/cython/bin
add_path $BREW_PREFIX/opt/ruby/bin

add_path $BREW_PREFIX/opt/cython/bin

export HOWDOI_COLORIZE=1

Expand Down

0 comments on commit 95a2d68

Please sign in to comment.