-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: minimal basic ide #17
Changes from 27 commits
d8605c9
89b660c
897f444
8cbd476
be6abb9
53b5b1e
16ba032
9ee21db
76c6b58
05f2779
3b706fe
24001e0
988b2d1
cf691a4
619a29d
bf7173e
12b0669
d2ac91b
fbe163f
9ca5c5f
157fec7
ee4579a
2162810
e0af1bd
26b31c0
118deaa
d71e226
10b34f2
363f883
0789072
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,5 @@ luac.out | |
*.x86_64 | ||
*.hex | ||
|
||
|
||
plugin |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
column_width = 120 | ||
line_endings = "Unix" | ||
indent_type = "Spaces" | ||
indent_width = 2 | ||
quote_style = "AutoPreferDouble" | ||
no_call_parentheses = true |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,8 +2,75 @@ | |||||
|
||||||
A great starting point for your LunarVim journey! | ||||||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
<details open> | ||||||
<summary> | ||||||
<strong>Contents</strong> | ||||||
</summary> | ||||||
|
||||||
- [Submission Guidelines](#submission-guidelines) | ||||||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
- [Supported languages](#supported-languages) | ||||||
- [Requirements](#requirements) | ||||||
- [Keybinds](#additional-keybinds) | ||||||
</details> | ||||||
|
||||||
## Submission Guidelines | ||||||
|
||||||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
- Ideally one file! | ||||||
- IDE config must be added to its own branch named `lang-ide` | ||||||
- try to keep it focused on the language and not your biased keybindings/options | ||||||
See [guidelines](guidelines.md) | ||||||
|
||||||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
## Supported languages | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
> **Note** | ||||||
> formatting, diagnostics, completions should work out of the box for the languages | ||||||
> below with the `LunarVim` configuration in this branch | ||||||
|
||||||
- C/C++ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should probably link to the branch |
||||||
- Typescript/Javascript | ||||||
- python | ||||||
- go | ||||||
- rust | ||||||
- bash | ||||||
- html | ||||||
- css | ||||||
- json | ||||||
- yaml | ||||||
- toml | ||||||
- dockerfile | ||||||
|
||||||
## Requirements | ||||||
|
||||||
Most of the language servers installation should happen automatically, but there | ||||||
is a few that are manually configured and may requires manual installation. | ||||||
|
||||||
Install them with the command below | ||||||
|
||||||
``` | ||||||
:MasonInstall clangd rust_analyzer gopls | ||||||
``` | ||||||
|
||||||
Binaries needed for diagnostics and formatting requires manual installation. | ||||||
You need to install them using the builtin `mason.nvim` or with your favorite package | ||||||
manager. | ||||||
|
||||||
use the command below to install them with mason | ||||||
|
||||||
``` | ||||||
:MasonInstall eslint_d prettier yamllint taplo goimports golangci-lint shellcheck shfmt hadolint flake8 black | ||||||
``` | ||||||
|
||||||
### Additional keybinds | ||||||
|
||||||
> **Note** | ||||||
> Leader is mapped to <kbd>Space</kbd> | ||||||
|
||||||
| Mode | Key | Action | | ||||||
| ------ | ------------------------------------------ | --------------------------------------------- | | ||||||
| visual | <kbd>Space</kbd>+<kbd>r</kbd>+<kbd>r</kbd> | Refactor selection | | ||||||
| normal | <kbd>Space</kbd>+<kbd>P</kbd> | Project menu | | ||||||
| normal | <kbd>Space</kbd>+<kbd>r</kbd>+<kbd>o</kbd> | Search and replace (open spectre panel) | | ||||||
| normal | <kbd>Space</kbd>+<kbd>r</kbd>+<kbd>f</kbd> | Search and replace (search current file) | | ||||||
| normal | <kbd>Space</kbd>+<kbd>r</kbd>+<kbd>c</kbd> | Search and replace (search word under cursor) | | ||||||
| normal | <kbd>Space</kbd>+<kbd>t</kbd>+<kbd>w</kbc> | Workspace diagnostics | | ||||||
| normal | <kbd>Space</kbd>+<kbd>t</kbd>+<kbd>d</kbc> | Document diagnostics | | ||||||
| normal | <kbd>Space</kbd>+<kbd>t</kbd>+<kbd>t</kbc> | LSP Type definitions | | ||||||
| normal | <kbd>Space</kbd>+<kbd>t</kbd>+<kbd>r</kbc> | LSP references | | ||||||
| normal | <kbd>Space</kbd>+<kbd>t</kbd>+<kbd>q</kbc> | Quickfix | | ||||||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,264 @@ | ||
lvim.format_on_save = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need this file as it overlaps with purpose with the branches and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kylo252 So no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To clarify, I'm talking about linking to this file instead: https://github.com/LunarVim/LunarVim/blob/d3ade21d85084634517848a7fd3582bbf2d6c278/utils/installer/config.example.lua We should ideally have a single "common" example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
lvim.builtin.treesitter.highlight.enable = true | ||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
lvim.builtin.treesitter.autotag.enable = true | ||
|
||
------------------------------------------------------------------------ | ||
-- auto install treesitter parsers | ||
------------------------------------------------------------------------ | ||
lvim.builtin.treesitter.ensure_installed = { | ||
"c", | ||
"cpp", | ||
"javascript", | ||
"typescript", | ||
"tsx", | ||
"json", | ||
"lua", | ||
"html", | ||
"python", | ||
"css", | ||
"scss", | ||
"yaml", | ||
"toml", | ||
"go", | ||
"bash", | ||
"dockerfile", | ||
"rust", | ||
} | ||
|
||
------------------------------------------------------------------------ | ||
-- LSP settings | ||
------------------------------------------------------------------------ | ||
lvim.lsp.diagnostics.virtual_text = false | ||
|
||
-- language servers added to the skipped_servers table will not be - | ||
-- automatically configured by LunarVim | ||
|
||
-- Add servers to the skipped_servers table when manual configuration | ||
-- of a language server is needed | ||
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "gopls", "rust_analyzer", "clangd" }) | ||
|
||
-- See below the examples of manual configuration of `gopls`, `clangd` - | ||
-- and `rust_analyzer` | ||
------------------------------------------------------------------------ | ||
-- Manual setup of language servers | ||
------------------------------------------------------------------------ | ||
|
||
local lsp_manager = require "lvim.lsp.manager" | ||
local on_init = require("lvim.lsp").common_on_init | ||
local on_attach = require("lvim.lsp").common_on_attach | ||
local capabilities = require("lvim.lsp").common_capabilities() | ||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
-- clangd | ||
local clangd_flags = { | ||
"--offset-encoding=utf-16", | ||
"--fallback-style=google", | ||
"--enable-config", | ||
"--clang-tidy", | ||
} | ||
|
||
local clangd_capabilities = vim.deepcopy(capabilities) | ||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
clangd_capabilities.offsetEncoding = { "utf-16" } | ||
|
||
-- clangd | ||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
lsp_manager.setup("clangd", { | ||
cmd = { "clangd", unpack(clangd_flags) }, | ||
on_init = on_init, | ||
on_attach = on_attach, | ||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
capabilities = clangd_capabilities, | ||
}) | ||
|
||
-- rust_analyzer | ||
lsp_manager.setup("rust_analyzer", { | ||
on_attach = on_attach, | ||
on_init = on_init, | ||
capabilities = capabilities, | ||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
settings = { | ||
["rust-analyzer"] = { | ||
checkOnSave = { | ||
enable = true, | ||
command = "clippy", | ||
}, | ||
}, | ||
}, | ||
}) | ||
|
||
-- gopls | ||
lsp_manager.setup("gopls", { | ||
on_attach = on_attach, | ||
on_init = on_init, | ||
capabilities = capabilities, | ||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
settings = { | ||
gopls = { | ||
gofumpt = true, | ||
codelenses = { | ||
gc_details = true, | ||
generate = true, | ||
test = true, | ||
tidy = true, | ||
upgrade_dependency = true, | ||
}, | ||
usePlaceholders = true, | ||
analyses = { | ||
fieldalignment = true, | ||
nilness = true, | ||
shadow = true, | ||
unusedparams = true, | ||
unusedwrite = true, | ||
}, | ||
staticcheck = true, | ||
}, | ||
}, | ||
}) | ||
|
||
------------------------------------------------------------------------ | ||
-- formatters | ||
------------------------------------------------------------------------ | ||
local formatters = require "lvim.lsp.null-ls.formatters" | ||
formatters.setup { | ||
{ | ||
command = "prettier", | ||
filetypes = { | ||
"json", | ||
"jsonc", | ||
"yaml", | ||
"markdown", | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact", | ||
"css", | ||
"scss", | ||
"html", | ||
}, | ||
}, | ||
{ command = "stylua", filetypes = { "lua" } }, | ||
{ command = "goimports", filetypes = { "go", "gomod" } }, | ||
{ command = "shfmt", filetypes = { "sh" } }, | ||
{ command = "black", filetypes = { "python" } }, | ||
} | ||
|
||
------------------------------------------------------------------------ | ||
-- linters | ||
------------------------------------------------------------------------ | ||
local linters = require "lvim.lsp.null-ls.linters" | ||
linters.setup { | ||
{ command = "flake8", filetypes = { "python" } }, | ||
{ command = "golangci_lint", filetypes = { "go" } }, | ||
{ command = "hadolint", filetypes = { "dockerfile" } }, | ||
{ command = "shellcheck", filetypes = { "sh" } }, | ||
{ | ||
command = "luacheck", | ||
filetypes = { "lua" }, | ||
args = { | ||
"--globals", | ||
"vim", | ||
"lvim", | ||
"--formatter", | ||
"plain", | ||
"--codes", | ||
"--ranges", | ||
"--filename", | ||
"$FILENAME", | ||
"-", | ||
}, | ||
}, | ||
|
||
{ command = "yamllint", filetypes = { "yaml" } }, | ||
{ command = "eslint_d", filetyps = { "javascript", "javascriptreact", "typescript", "typescriptreact" } }, | ||
} | ||
|
||
------------------------------------------------------------------------ | ||
-- codeactions | ||
------------------------------------------------------------------------ | ||
local codeactions = require "lvim.lsp.null-ls.code_actions" | ||
codeactions.setup { | ||
{ name = "gitsigns" }, | ||
{ name = "refactoring" }, | ||
{ command = "eslint_d", filetype = { "javascript", "javascriptreact", "typescript", "typescriptreact" } }, | ||
} | ||
|
||
------------------------------------------------------------------------ | ||
-- Plugins | ||
------------------------------------------------------------------------ | ||
lvim.plugins = { | ||
|
||
-- utility plugins | ||
{ "tpope/vim-surround", keys = { "c", "d", "y" } }, | ||
|
||
-- search and replace | ||
"windwp/nvim-spectre", | ||
|
||
-- diagnostics with trouble.nvim | ||
"folke/trouble.nvim", | ||
|
||
-- auto close html tags | ||
"windwp/nvim-ts-autotag", | ||
|
||
{ | ||
-- better UX with vim.ui.select and vim.ui.input | ||
"stevearc/dressing.nvim", | ||
config = function() | ||
require("dressing").setup { | ||
input = { | ||
prefer_width = 55, | ||
prompt_align = "center", | ||
min_width = 30, | ||
relative = "editor", | ||
}, | ||
select = { | ||
backend = { "telescope" }, | ||
telescope = require("telescope.themes").get_dropdown { hide_preview = false }, | ||
}, | ||
} | ||
end, | ||
}, | ||
|
||
{ | ||
-- required for refactoring codeactions (caveat: only works with few common languages) | ||
-- view supported languages at https://github.com/ThePrimeagen/refactoring.nvim#supported-languages | ||
"ThePrimeagen/refactoring.nvim", | ||
config = function() | ||
require("refactoring").setup { | ||
-- prompt for return type | ||
prompt_func_return_type = { | ||
go = true, | ||
cpp = true, | ||
c = true, | ||
java = true, | ||
}, | ||
-- prompt for function parameters | ||
prompt_func_param_type = { | ||
go = true, | ||
cpp = true, | ||
c = true, | ||
java = true, | ||
}, | ||
} | ||
end, | ||
}, | ||
} | ||
|
||
------------------------------------------------------------------------ | ||
-- custom which-key mappings | ||
------------------------------------------------------------------------ | ||
lvim.builtin.which_key.vmappings["r"] = { | ||
name = "+refactor", | ||
r = { "<Esc><cmd>lua require('telescope').extensions.refactoring.refactors()<CR>", "refactor selection" }, | ||
} | ||
|
||
lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" } | ||
lvim.builtin.which_key.mappings["r"] = { | ||
name = "+Search and Replace", | ||
o = { "<cmd>lua require('spectre').open()<cr>", "open" }, | ||
f = { "<cmd>lua require('spectre').open_file_search()<cr>", "file search" }, | ||
c = { "<cmd>lua require('spectre').open_visual({select_word=true})<cr>", "search word under cursor" }, | ||
} | ||
lvim.builtin.which_key.mappings["t"] = { | ||
name = "+Trouble", | ||
w = { "<cmd>Trouble workspace_diagnostics<cr>", "Workspace Diagnostics" }, | ||
d = { "<cmd>Trouble document_diagnostics<cr>", "Document Diagnostics" }, | ||
q = { "<cmd>Trouble quickfix<cr>", "QuickFix" }, | ||
r = { "<cmd>Trouble lsp_references<cr>", "LSP References" }, | ||
t = { "<cmd>Trouble lsp_type_definitions<cr>", "LSP Type definitions" }, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Submission Guidelines | ||
|
||
- Ideally one file! | ||
- IDE config must be added to its own branch named `lang-ide` | ||
- try to keep it focused on the language and not your biased keybindings/options | ||
LostNeophyte marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move this file into
.github/README.md