mirror of
https://github.com/mentos1386/dotfiles.git
synced 2025-01-31 00:35:42 +00:00
feat: more changes
This commit is contained in:
parent
59f50c658e
commit
a937938345
4 changed files with 114 additions and 78 deletions
|
@ -22,12 +22,13 @@ Plug 'koenverburg/peepsight.nvim'
|
||||||
Plug 'norcalli/nvim-colorizer.lua'
|
Plug 'norcalli/nvim-colorizer.lua'
|
||||||
Plug 'j-hui/fidget.nvim'
|
Plug 'j-hui/fidget.nvim'
|
||||||
" Git
|
" Git
|
||||||
Plug 'airblade/vim-gitgutter'
|
Plug 'lewis6991/gitsigns.nvim'
|
||||||
" Search/Files
|
" Search/Files
|
||||||
Plug 'nvim-lua/plenary.nvim'
|
Plug 'nvim-lua/plenary.nvim'
|
||||||
Plug 'nvim-telescope/telescope.nvim'
|
Plug 'nvim-telescope/telescope.nvim'
|
||||||
Plug 'ANGkeith/telescope-terraform-doc.nvim'
|
Plug 'ANGkeith/telescope-terraform-doc.nvim'
|
||||||
Plug 'fannheyward/telescope-coc.nvim'
|
Plug 'fannheyward/telescope-coc.nvim'
|
||||||
|
Plug 'FeiyouG/commander.nvim'
|
||||||
" Ignore/Edit files
|
" Ignore/Edit files
|
||||||
Plug 'vim-scripts/gitignore'
|
Plug 'vim-scripts/gitignore'
|
||||||
" Languages
|
" Languages
|
||||||
|
@ -47,6 +48,7 @@ Plug 'hrsh7th/cmp-cmdline'
|
||||||
Plug 'hrsh7th/cmp-buffer'
|
Plug 'hrsh7th/cmp-buffer'
|
||||||
Plug 'hrsh7th/cmp-path'
|
Plug 'hrsh7th/cmp-path'
|
||||||
Plug 'hrsh7th/nvim-cmp'
|
Plug 'hrsh7th/nvim-cmp'
|
||||||
|
Plug 'folke/trouble.nvim'
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
|
@ -154,27 +156,8 @@ EOF
|
||||||
" Using SPACE as <leader> key
|
" Using SPACE as <leader> key
|
||||||
nnoremap <SPACE> <Nop>
|
nnoremap <SPACE> <Nop>
|
||||||
let mapleader = " "
|
let mapleader = " "
|
||||||
|
lua require('keybindings')
|
||||||
|
|
||||||
" Telescope
|
|
||||||
nnoremap <c-p> <cmd>Telescope git_files<cr>
|
|
||||||
nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
|
||||||
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
|
||||||
" Telescope git
|
|
||||||
nnoremap <leader>fgc <cmd>Telescope git_commits<cr>
|
|
||||||
nnoremap <leader>fgb <cmd>Telescope git_branches<cr>
|
|
||||||
nnoremap <leader>fgs <cmd>Telescope git_status<cr>
|
|
||||||
" Telescope Terraform
|
|
||||||
nnoremap <leader>ftf <cmd>Telescope terraform_doc<cr>
|
|
||||||
nnoremap <leader>ftm <cmd>Telescope terraform_doc modules<cr>
|
|
||||||
nnoremap <leader>ftfa <cmd>Telescope terraform_doc full_name=hashicorp/aws<cr>
|
|
||||||
nnoremap <leader>ftfk <cmd>Telescope terraform_doc full_name=hashicorp/kubernetes<cr>
|
|
||||||
" Telescope coc
|
|
||||||
nnoremap <leader>fca <cmd>Telescope coc code_actions<cr>
|
|
||||||
nnoremap <leader>fcr <cmd>Telescope coc references<cr>
|
|
||||||
nnoremap <leader>fcdi <cmd>Telescope coc diagnostics<cr>
|
|
||||||
nnoremap <leader>fcde <cmd>Telescope coc definitions<cr>
|
|
||||||
nnoremap <leader>fcds <cmd>Telescope coc document_symbols<cr>
|
|
||||||
nnoremap <leader>fcws <cmd>Telescope coc workspace_symbols<cr>
|
|
||||||
|
|
||||||
"""""
|
"""""
|
||||||
"- Visuals
|
"- Visuals
|
||||||
|
|
|
@ -110,7 +110,6 @@ require("mason-lspconfig").setup({
|
||||||
"helm_ls", -- helm
|
"helm_ls", -- helm
|
||||||
"jsonls", -- json
|
"jsonls", -- json
|
||||||
"tsserver", -- javascript/typescript
|
"tsserver", -- javascript/typescript
|
||||||
"autotools-language-server", -- make
|
|
||||||
"marksman", -- markdown
|
"marksman", -- markdown
|
||||||
"vale_ls", -- markdown/prose
|
"vale_ls", -- markdown/prose
|
||||||
"swift_mesonls", -- meson
|
"swift_mesonls", -- meson
|
||||||
|
@ -133,72 +132,16 @@ require("mason-lspconfig").setup_handlers({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
|
||||||
|
|
||||||
local function quickfix()
|
|
||||||
vim.lsp.buf.code_action({
|
|
||||||
filter = function(a)
|
|
||||||
return a.isPreferred
|
|
||||||
end,
|
|
||||||
apply = true,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Global mappings.
|
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
|
||||||
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float)
|
|
||||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
|
||||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
|
||||||
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist)
|
|
||||||
|
|
||||||
-- Use LspAttach autocommand to only map the following keys
|
|
||||||
-- after the language server attaches to the current buffer
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
|
||||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
|
||||||
callback = function(ev)
|
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
|
||||||
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
|
||||||
|
|
||||||
-- Buffer local mappings.
|
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
|
||||||
local opts = { buffer = ev.buf }
|
|
||||||
vim.keymap.set("n", "<leader>qf", quickfix, opts)
|
|
||||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
|
||||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
|
||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
|
||||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
|
||||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
|
||||||
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
|
||||||
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
|
||||||
vim.keymap.set("n", "<space>wl", function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
|
|
||||||
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
|
|
||||||
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
|
||||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
|
||||||
vim.keymap.set("n", "<space>f", function()
|
|
||||||
vim.lsp.buf.format({ async = true })
|
|
||||||
end, opts)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Formatter
|
-- Formatter
|
||||||
local util = require("formatter.util")
|
local util = require("formatter.util")
|
||||||
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
|
|
||||||
require("formatter").setup({
|
require("formatter").setup({
|
||||||
-- Enable or disable logging
|
|
||||||
logging = true,
|
logging = true,
|
||||||
-- Set the log level
|
|
||||||
log_level = vim.log.levels.WARN,
|
log_level = vim.log.levels.WARN,
|
||||||
-- All formatter configurations are opt-in
|
-- All formatter configurations are opt-in
|
||||||
filetype = {
|
filetype = {
|
||||||
-- Formatter configurations for filetype "lua" go here
|
|
||||||
-- and will be executed in order
|
|
||||||
lua = {
|
lua = {
|
||||||
require("formatter.filetypes.lua").stylua,
|
require("formatter.filetypes.lua").stylua,
|
||||||
},
|
},
|
||||||
|
|
||||||
javascript = {
|
javascript = {
|
||||||
require("formatter.filetypes.javascript").prettier,
|
require("formatter.filetypes.javascript").prettier,
|
||||||
},
|
},
|
||||||
|
@ -246,3 +189,5 @@ autocmd("BufWritePost", {
|
||||||
group = "__formatter__",
|
group = "__formatter__",
|
||||||
command = ":FormatWrite",
|
command = ":FormatWrite",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
require("trouble").setup({})
|
||||||
|
|
|
@ -56,3 +56,12 @@ require("peepsight").enable()
|
||||||
|
|
||||||
-- Transforms hex colors to their respective color
|
-- Transforms hex colors to their respective color
|
||||||
require("colorizer").setup()
|
require("colorizer").setup()
|
||||||
|
|
||||||
|
-- Git blame line
|
||||||
|
require("gitsigns").setup({
|
||||||
|
current_line_blame = true,
|
||||||
|
current_line_blame_opts = {
|
||||||
|
delay = 500,
|
||||||
|
virt_text_pos = "eol",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
99
nvim/lua/keybindings.lua
Normal file
99
nvim/lua/keybindings.lua
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
require("commander").setup({
|
||||||
|
integration = {
|
||||||
|
telescope = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
-- Use LspAttach autocommand to only map the following keys
|
||||||
|
-- after the language server attaches to the current buffer
|
||||||
|
local lsp_antach_done = false
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||||
|
callback = function(ev)
|
||||||
|
-- Buffer local mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local opts = { buffer = ev.buf }
|
||||||
|
|
||||||
|
require("commander").add({
|
||||||
|
{
|
||||||
|
desc = "LSP Quickfix",
|
||||||
|
cmd = function()
|
||||||
|
vim.lsp.buf.code_action({
|
||||||
|
filter = function(a)
|
||||||
|
return a.kind ~= "quickfix" or a.isPreferred
|
||||||
|
end,
|
||||||
|
apply = true,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
keys = { "n", "qf", opts },
|
||||||
|
},
|
||||||
|
{ desc = "LSP Declaration", cmd = vim.lsp.buf.declaration, keys = { "n", "gD", opts } },
|
||||||
|
{ desc = "LSP Definition", cmd = vim.lsp.buf.definition, keys = { "n", "gd", opts } },
|
||||||
|
{ desc = "LSP Hover", cmd = vim.lsp.buf.hover, keys = { "n", "K", opts } },
|
||||||
|
{ desc = "LSP Rename", cmd = vim.lsp.buf.rename, keys = { "n", "rn", opts } },
|
||||||
|
{ desc = "LSP Implementation", cmd = vim.lsp.buf.implementation, keys = { "n", "gi", opts } },
|
||||||
|
{ desc = "LSP Signature Help", cmd = vim.lsp.buf.signature_help, keys = { "n", "<C-k>", opts } },
|
||||||
|
{ desc = "LSP Code Action", cmd = vim.lsp.buf.code_action, keys = { "n", "<space>ca", opts } },
|
||||||
|
{
|
||||||
|
desc = "LSP Format",
|
||||||
|
cmd = function()
|
||||||
|
vim.lsp.buf.format({ async = true })
|
||||||
|
end,
|
||||||
|
keys = { "n", "<space>f", opts },
|
||||||
|
},
|
||||||
|
{ desc = "LSP References", cmd = "<CMD>Telescope lsp_references<CR>", keys = { "n", "<leader>gr" } },
|
||||||
|
{
|
||||||
|
desc = "LSP Diagnostics",
|
||||||
|
cmd = "<CMD>Telescope diagnostics bufnr=0<CR>",
|
||||||
|
keys = { "n", "<leader>fcdi" },
|
||||||
|
},
|
||||||
|
{ desc = "LSP Definitions", cmd = "<CMD>Telescope lsp_definitions<CR>", keys = { "n", "<leader>fcde" } },
|
||||||
|
{
|
||||||
|
desc = "LSP Document Symbols",
|
||||||
|
cmd = "<CMD>Telescope lsp_document_symbols<CR>",
|
||||||
|
keys = { "n", "<leader>fcds" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
desc = "LSP Workspace Symbols",
|
||||||
|
cmd = "<CMD>Telescope lsp_workspace_symbols<CR>",
|
||||||
|
keys = { "n", "<leader>fcws" },
|
||||||
|
},
|
||||||
|
}, { show = not lsp_attach_done })
|
||||||
|
|
||||||
|
lsp_attach_done = true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
require("commander").add({
|
||||||
|
{
|
||||||
|
desc = "Open Help",
|
||||||
|
cmd = require("commander").show,
|
||||||
|
keys = { "n", "<Leader>h" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
desc = "Search for files in git",
|
||||||
|
cmd = "<CMD>Telescope git_files<CR>",
|
||||||
|
keys = { "n", "<c-p>" },
|
||||||
|
},
|
||||||
|
{ desc = "Search for files", cmd = "<CMD>Telescope find_files<CR>", keys = { "n", "<leader>ff" } },
|
||||||
|
{ desc = "Search for string", cmd = "<CMD>Telescope live_grep<CR>", keys = { "n", "<leader>fg" } },
|
||||||
|
{ desc = "Git Commits", cmd = "<CMD>Telescope git_commits<CR>", keys = { "n", "<leader>fgc" } },
|
||||||
|
{ desc = "Git Branches", cmd = "<CMD>Telescope git_branches<CR>", keys = { "n", "<leader>fgb" } },
|
||||||
|
{ desc = "Git Status", cmd = "<CMD>Telescope git_status<CR>", keys = { "n", "<leader>fgs" } },
|
||||||
|
{ desc = "Terraform Doc", cmd = "<CMD>Telescope terraform_doc<CR>", keys = { "n", "<leader>ftf" } },
|
||||||
|
{ desc = "Terraform Modules", cmd = "<CMD>Telescope terraform_doc modules<CR>", keys = { "n", "<leader>ftm" } },
|
||||||
|
{
|
||||||
|
desc = "Terraform AWS",
|
||||||
|
cmd = "<CMD>Telescope terraform_doc full_name=hashicorp/aws<CR>",
|
||||||
|
keys = { "n", "<leader>ftfa" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
desc = "Terraform Kubernetes",
|
||||||
|
cmd = "<CMD>Telescope terraform_doc full_name=hashicorp/kubernetes<CR>",
|
||||||
|
keys = { "n", "<leader>ftfk" },
|
||||||
|
},
|
||||||
|
})
|
Loading…
Reference in a new issue