Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #29

Merged
merged 6 commits into from
Nov 18, 2023
Merged

Dev #29

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.git
*.log
package-lock.json
package.json
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!---
This file is auto-generate by a github hook please modify README.template if you don't want to loose your work
-->
# raelldottin/dotfiles v0.2.0-120
# raelldottin/dotfiles v0.2.0-126
[![Makefile Linter](https://github.com/raelldottin/dotfiles/actions/workflows/checkmake.yml/badge.svg)](https://github.com/raelldottin/dotfiles/actions/workflows/checkmake.yml)
[![Shell Script Linter](https://github.com/raelldottin/dotfiles/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/raelldottin/dotfiles/actions/workflows/shellcheck.yml)
[![Lua Linter](https://github.com/raelldottin/dotfiles/actions/workflows/luacheck.yml/badge.svg)](https://github.com/raelldottin/dotfiles/actions/workflows/luacheck.yml)
[![Python Linter](https://github.com/raelldottin/dotfiles/actions/workflows/pyright.yml/badge.svg)](https://github.com/raelldottin/dotfiles/actions/workflows/pyright.yml)

[![ v0.2.0-120 ](https://github.com/raelldottin/dotfiles/blob/main/PNGimage.png)](https://github.com/raelldottin/dotfiles/blob/main/PNGimage.png)
[![ v0.2.0-126 ](https://github.com/raelldottin/dotfiles/blob/main/PNGimage.png)](https://github.com/raelldottin/dotfiles/blob/main/PNGimage.png)

**Table of Contents**

Expand Down
2 changes: 1 addition & 1 deletion config/nvim/lua/plugins-setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ require("lazy").setup({
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && make --build build --config Release && cmake --install build --prefix build",
conda = function()
cond = function()
return vim.fn.executable("make") == 1
end,
},
Expand Down
173 changes: 54 additions & 119 deletions config/nvim/lua/plugins/lsp/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,96 +16,39 @@ if not typescript_setup then
return
end

local keymap = vim.keymap -- for conciseness

-- enable keybinds only for when lsp server available
-- See: https://github.com/neovim/nvim-lspconfig/tree/54eb2a070a4f389b1be0f98070f81d23e2b1a715#suggested-configuration
local opts = { noremap = true, silent = true }
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts)

-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- keybind options
local opts = { noremap = true, silent = true, buffer = bufnr }

-- set keybinds

-- LSP finder - Find the symbol's definition
-- If there is no definition, it will instead be hidden
-- When you use an action in finder like "open vsplit",
-- you can use <C-t> to jump back
keymap.set("n", "gf", "<cmd>Lspsaga lsp_finder<CR>", opts)

-- Code action
keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts)

-- Rename all occurrences of the hovered word for the entire file
keymap.set("n", "rn", "<cmd>Lspsaga rename<CR>", opts)

-- Rename all occurrences of the hovered word for the selected files
keymap.set("n", "gr", "<cmd>Lspsaga rename ++project<CR>", opts)

-- Peek definition
-- You can edit the file containing the definition in the floating window
-- It also supports open/vsplit/etc operations, do refer to "definition_action_keys"
-- It also supports tagstack
-- Use <C-t> to jump back
keymap.set("n", "gD", "<cmd>Lspsaga peek_definition<CR>", opts)

-- Go to definition
keymap.set("n", "gd", "<cmd>Lspsaga goto_definition<CR>", opts)

-- Show line diagnostics
-- You can pass argument ++unfocus to
-- unfocus the show_line_diagnostics floating window
keymap.set("n", "<leader>sl", "<cmd>Lspsaga show_line_diagnostics<CR>", opts)

-- Show cursor diagnostics
-- Like show_line_diagnostics, it supports passing the ++unfocus argument
keymap.set("n", "<leader>sc", "<cmd>Lspsaga show_cursor_diagnostics<CR>", opts)

-- Show buffer diagnostics
keymap.set("n", "<leader>sb", "<cmd>Lspsaga show_buf_diagnostics<CR>", opts)

-- Diagnostic jump
-- You can use <C-o> to jump back to your previous location
keymap.set("n", "[e", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opts)
keymap.set("n", "]e", "<cmd>Lspsaga diagnostic_jump_next<CR>", opts)

-- Diagnostic jump with filters such as only jumping to an error
keymap.set("n", "[E", function()
require("lspsaga.diagnostic"):goto_prev({ severity = vim.diagnostic.severity.ERROR })
end)
keymap.set("n", "]E", function()
require("lspsaga.diagnostic"):goto_next({ severity = vim.diagnostic.severity.ERROR })
end)

-- Toggle outline
keymap.set("n", "<leader>o", "<cmd>Lspsaga outline<CR>", opts)

-- Hover Doc
-- If there is no hover doc,
-- there will be a notification stating that
-- there is no information available.
-- To disable it just use ":Lspsaga hover_doc ++quiet"
-- Pressing the key twice will enter the hover window
keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts)

-- If you want to keep the hover window in the top right hand corner,
-- you can pass the ++keep argument
-- Note that if you use hover with ++keep, pressing this key again will
-- close the hover window. If you want to jump to the hover window
-- you should use the wincmd command "<C-w>w"
keymap.set("n", "K", "<cmd>Lspsaga hover_doc ++keep<CR>", opts)

-- Call hierarchy
keymap.set("n", "<Leader>ci", "<cmd>Lspsaga incoming_calls<CR>", opts)
keymap.set("n", "<Leader>co", "<cmd>Lspsaga outgoing_calls<CR>", opts)

-- Floating terminal
keymap.set({ "n", "t" }, "<A-d>", "<cmd>Lspsaga term_toggle<CR>", opts)

-- typescript specific keymaps (e.g. rename file and update imports)
if client.name == "tsserver" then
keymap.set("n", "<leader>rf", ":TypescriptRenameFile<CR>", opts) -- rename file and update imports
keymap.set("n", "<leader>oi", ":TypescriptOrganizeImports<CR>", opts) -- organize imports (not in youtube nvim video)
keymap.set("n", "<leader>ru", ":TypescriptRemoveUnused<CR>", opts) -- remove unused variables (not in youtube nvim video)
end
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")

-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set("n", "<space>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts)
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts)
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts)
vim.keymap.set("n", "<space>f", function()
vim.lsp.buf.format({ async = true })
end, bufopts)
end

-- used to enable autocompletion (assign to every lsp server config)
Expand Down Expand Up @@ -144,20 +87,13 @@ lspconfig["dockerls"].setup({
on_attach = on_attach,
})

-- configure golangci_linit_ls
-- configure golangci_lint_ls
lspconfig["golangci_lint_ls"].setup({
capabilities = capabilities,
on_attach = on_attach,
filetypes = { "go" },
})

-- configure gopls
lspconfig["gopls"].setup({
capabilities = capabilities,
on_attach = on_attach,
filetypes = { "go" },
})

-- configure jsonls
lspconfig["jsonls"].setup({
capabilities = capabilities,
Expand Down Expand Up @@ -200,34 +136,12 @@ lspconfig["prosemd_lsp"].setup({
on_attach = on_attach,
})

-- configure pyright
lspconfig["pyright"].setup({
on_attach = on_attach,
settings = {
pyright = { autoImportCompletion = true },
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "workspace",
venvpath = "venv",
useLibraryCodeForTypes = true,
},
},
},
})

-- configure marksman
lspconfig["marksman"].setup({
capabilities = capabilities,
on_attach = on_attach,
})

-- configure powershell_es
lspconfig["powershell_es"].setup({
capabilities = capabilities,
on_attach = on_attach,
})

-- configure terraformls
lspconfig["terraformls"].setup({
capabilities = capabilities,
Expand All @@ -239,3 +153,24 @@ lspconfig["tflint"].setup({
capabilities = capabilities,
on_attach = on_attach,
})

-- configure ruff_lsp
local configs = require("lspconfig.configs")
if not configs.ruff_lsp then
configs.ruff_lsp = {
default_config = {
cmd = { "ruff-lsp" },
filetypes = { "python" },
root_dir = require("lspconfig").util.find_git_ancestor,
init_options = {
settings = {
args = {},
},
},
},
}
end
lspconfig[i("ruff_lsp")].setup({
capabilities = capabilities,
on_attach = on_attach,
})
7 changes: 3 additions & 4 deletions config/nvim/lua/plugins/lsp/mason.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ mason.setup({
mason_lspconfig.setup({
-- list of servers for mason to install
ensure_installed = {
"bashls",
"bashls", -- bash language server
"clangd",
"dockerls",
"golangci_lint_ls",
"gopls",
"jsonls",
"lua_ls",
"prosemd_lsp",
"marksman",
"terraformls",
"tflint",
"ruff_lsp",
},
-- auto-install configured servers (with lspconfig)
automatic_installation = true, -- not the same as ensure_installed
Expand All @@ -55,8 +55,7 @@ mason_null_ls.setup({
"gofumpt",
"stylua",
"alex",
"black",
"pyright",
"ruff",
"shellcheck",
"shfmt",
"stylua", -- lua formatter
Expand Down
7 changes: 4 additions & 3 deletions config/nvim/lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ treesitter.setup({
-- ensure these language parsers are installed
ensure_installed = {
"c",
"lua",
"vim",
"vimdoc",
"cpp",
"go",
"python",
"rust",
"vimdoc",
"json",
"javascript",
"typescript",
Expand All @@ -30,11 +32,10 @@ treesitter.setup({
"html",
"css",
"markdown",
"markdown_inline",
"svelte",
"graphql",
"bash",
"lua",
"vim",
"dockerfile",
"gitignore",
},
Expand Down
4 changes: 2 additions & 2 deletions homebrew_installed_app.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jpeg-turbo
jpeg-xl
jq
julia
jupyterlab
krb5
kubernetes-cli
libavif
Expand Down Expand Up @@ -120,10 +119,10 @@ pydocstyle
pygments
pyright
python-certifi
python-lsp-server
python-packaging
python-psutil
python-setuptools
python-typing-extensions
[email protected]
[email protected]
pyyaml
Expand All @@ -132,6 +131,7 @@ reattach-to-user-namespace
ripgrep
rtmpdump
ruff
ruff-lsp
rust
sevenzip
shellcheck
Expand Down
Loading