-
Notifications
You must be signed in to change notification settings - Fork 2
Nvim 0.12 using native pack; minimal set of plugins #81
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| return { | ||
| settings = { | ||
| Lua = { | ||
| runtime = { version = 'LuaJIT' }, | ||
| diagnostics = { | ||
| globals = { 'vim' }, | ||
| }, | ||
| workspace = { | ||
| checkThirdParty = false, | ||
| library = { | ||
| vim.env.VIMRUNTIME, | ||
| '${3rd}/luv/library', | ||
| }, | ||
| }, | ||
| telemetry = { enable = false }, | ||
| }, | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| local api = vim.api | ||
| local opt = vim.opt | ||
|
|
||
| local augroup = api.nvim_create_augroup("user.commands", { clear = true }) | ||
|
|
||
| api.nvim_create_autocmd("TextYankPost", { | ||
| group = augroup, | ||
| pattern = "*", | ||
| desc = "Highlight when yanking (copying) text", | ||
| callback = function() | ||
| vim.hl.on_yank() | ||
| end, | ||
| }) | ||
|
|
||
| api.nvim_create_autocmd("WinEnter", { | ||
| group = augroup, | ||
| pattern = "*", | ||
| callback = function() | ||
| local function count_non_floating_wins() | ||
| local count = 0 | ||
| for _, win in ipairs(api.nvim_tabpage_list_wins(0)) do | ||
| local cfg = api.nvim_win_get_config(win) | ||
| if cfg.relative == "" then -- Empty means it's not floating | ||
| count = count + 1 | ||
| end | ||
| end | ||
| return count | ||
| end | ||
|
|
||
| local locWins = count_non_floating_wins() | ||
| if locWins > 1 then | ||
| opt.winbar = "%f %m" | ||
| else | ||
| opt.winbar = "" | ||
| end | ||
| end | ||
| }) | ||
|
|
||
|
|
||
|
|
||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| local cmd = vim.cmd | ||
| local set = vim.keymap.set | ||
| local diag = vim.diagnostic | ||
|
|
||
| -- diagnostics: | ||
| diag.config({ | ||
| -- float = { | ||
| -- border = 'rounded', | ||
| -- source = 'if_many', | ||
| -- }, | ||
| severity_sort = true, | ||
| virtual_text = { | ||
| prefix = '●', | ||
| source = 'if_many', | ||
| spacing = 6, | ||
| }, | ||
| signs = { | ||
| active = true, | ||
| text = { | ||
| [vim.diagnostic.severity.ERROR] = "", -- icon for error | ||
| [vim.diagnostic.severity.WARN] = "", -- icon for warning | ||
| [vim.diagnostic.severity.INFO] = "", -- icon for info | ||
| [vim.diagnostic.severity.HINT] = "", -- icon for hint | ||
| }, | ||
| }, | ||
| }) | ||
|
|
||
| require('mason-lspconfig').setup({ | ||
| ensure_installed = { 'jsonls', 'lua_ls', 'roslyn_ls', 'rust_analyzer' }, | ||
| }) | ||
| -- local toolsToInstall = { 'stylua' } | ||
| local toolsToInstall = { } | ||
| for _, tool in ipairs(toolsToInstall) do | ||
| if vim.fn.executable(tool) == 0 then | ||
| cmd([[MasonInstall ]] .. tool) | ||
| end | ||
| end | ||
|
|
||
| set("n", "<leader>q", function() | ||
| diag.setloclist({ open = true }) | ||
| end, { desc = "Open diagnostic list" }) | ||
|
|
||
| vim.lsp.enable({ 'jsonls', 'lua_ls' }) | ||
|
|
||
| vim.o.autocomplete = false | ||
|
|
||
| vim.api.nvim_create_autocmd('LspAttach', { | ||
| group = vim.api.nvim_create_augroup('my.lsp', {}), | ||
| callback = function(ev) | ||
| local client = assert(vim.lsp.get_client_by_id(ev.data.client_id)) | ||
| -- if client:supports_method('textDocument/implementation') then | ||
| -- -- Create a keymap for vim.lsp.buf.implementation ... | ||
| -- end | ||
|
|
||
| if client:supports_method('textDocument/completion') then | ||
| vim.lsp.completion.enable(true, client.id, ev.buf, {autotrigger = false}) | ||
|
|
||
| local function feedkeys(keys) | ||
| vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(keys, true, false, true), 'n', true) | ||
| end | ||
|
|
||
| local function pumvisible() | ||
| return tonumber(vim.fn.pumvisible()) ~= 0 | ||
| end | ||
|
|
||
| -- vim.lsp.handlers["textDocument/hover"] = function(_, _, _, config) | ||
| -- config = config or {} | ||
| -- config.border = 'rounded' | ||
| -- vim.lsp.buf.signature_help( { config }) | ||
| -- end | ||
| set("i", "<c-space>", function() vim.lsp.completion.get() end, { desc = 'Start completion popup menu'}) | ||
|
|
||
| set('i', '<cr>', function() | ||
| if pumvisible() then feedkeys '<C-y>' else feedkeys '<cr>' end | ||
| end, { desc = 'Accept current selected completion' }) | ||
|
|
||
| set('i', '/', function() | ||
| if pumvisible() then feedkeys '<C-e>' else feedkeys '/' end | ||
| end, { desc = 'Dismiss completion menu' }) | ||
|
|
||
| -- LSP key mappings: | ||
| set('i', '<C-u>', '<C-x><C-n>', { desc = 'Buffer completions' }) | ||
|
|
||
| set({ 'i', 's' }, '<Tab>', function() | ||
| if pumvisible() then | ||
| feedkeys '<C-n>' | ||
| elseif vim.snippet.active { direction = 1 } then | ||
| vim.snippet.jump(1) | ||
| else | ||
| feedkeys '<Tab>' | ||
| end | ||
| end, { desc = 'Select next completion' }) | ||
|
|
||
| set({ 'i', 's' }, '<S-Tab>', function() | ||
| if pumvisible() then | ||
| feedkeys '<C-p>' | ||
| elseif vim.snippet.active { direction = -1 } then | ||
| vim.snippet.jump(-1) | ||
| else | ||
| feedkeys '<S-Tab>' | ||
| end | ||
| end, { desc = 'Select previous completion' }) | ||
|
|
||
| -- Inside a snippet, use backspace to remove the placeholder. | ||
| set('s', '<BS>', '<C-o>s', { desc = 'Remove snippet placeholder' }) | ||
| end | ||
|
|
||
| -- Auto-format ("lint") on save. | ||
| -- if not client:supports_method('textDocument/willSaveWaitUntil') | ||
| -- and client:supports_method('textDocument/formatting') then | ||
| -- vim.api.nvim_create_autocmd('BufWritePre', { | ||
| -- group = vim.api.nvim_create_augroup('my.lsp', {clear=false}), | ||
| -- buffer = ev.buf, | ||
| -- callback = function() | ||
| -- vim.lsp.buf.format({ bufnr = ev.buf, id = client.id, timeout_ms = 1000 }) | ||
| -- end, | ||
| -- }) | ||
| -- end | ||
| end, | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.