refactor nvim
This commit is contained in:
parent
da47cf5192
commit
ee5e687a2d
@ -25,6 +25,7 @@ vim.o.clipboard = 'unnamedplus'
|
||||
-- View.
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.netrw_liststyle = 3
|
||||
vim.o.termguicolors = true
|
||||
|
||||
vim.o.list = true
|
||||
vim.opt.listchars:append 'space:⋅'
|
||||
@ -44,7 +45,7 @@ vim.keymap.set('n', '<C-d>', '<C-d>zz')
|
||||
vim.keymap.set('n', '<C-u>', '<C-u>zz')
|
||||
|
||||
-- Diagnostic keymaps.
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
||||
|
@ -47,6 +47,10 @@ local on_attach = function(_, bufnr)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help)
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = 'Format current buffer with LSP' })
|
||||
end
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||
|
@ -1,5 +1,10 @@
|
||||
local status = pcall(require, 'nightfox')
|
||||
|
||||
if status then
|
||||
vim.cmd [[colorscheme terafox]]
|
||||
-- Apply theme.
|
||||
vim.cmd.colorscheme('terafox')
|
||||
|
||||
-- Transparency.
|
||||
vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' })
|
||||
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' })
|
||||
end
|
||||
|
@ -9,13 +9,5 @@ local formatting = null_ls.builtins.formatting
|
||||
null_ls.setup {
|
||||
sources = {
|
||||
formatting.prettier.with({ extra_args = { "--config", prettier_config } })
|
||||
},
|
||||
on_attach = function (client, bufnr)
|
||||
if client.supports_method('textDocument/formatting') then
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = 'Format current buffer with LSP' })
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
|
@ -14,18 +14,16 @@ telescope.setup {
|
||||
}
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files)
|
||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string)
|
||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep)
|
||||
|
||||
vim.keymap.set('n', '<leader>?', builtin.oldfiles)
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user