Skip to content

Commit

Permalink
regular checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Raghuveer Naraharisetti committed Jun 19, 2024
1 parent 0ffa6ee commit 477c6ba
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 169 deletions.
9 changes: 9 additions & 0 deletions .wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ local config = {}
if wezterm.config_builder then
config = wezterm.config_builder()
end
config.front_end = "WebGpu"
config.keys = {
{
key = 'r',
mods = 'CMD|SHIFT',
action = wezterm.action.ReloadConfiguration,
},
}


return config

4 changes: 4 additions & 0 deletions nvim/.netrwhist
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let g:netrw_dirhistmax =10
restore_upcoming_session = true,
let g:netrw_dirhistcnt =1
let g:netrw_dirhist_1='/home/rnaraharisetti/.config/nvim'
5 changes: 3 additions & 2 deletions nvim/lua/core/colorscheme.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vim.opt.termguicolors = true
vim.cmd('colorscheme mellow')

vim.opt.background = "dark"
-- vim.cmd('colorscheme github_dark_dimmed')
vim.cmd('colorscheme kanagawa-dragon')
3 changes: 2 additions & 1 deletion nvim/lua/core/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ vim.keymap.set('n', '<leader>h', ':wincmd h<CR>')
vim.keymap.set('n', '<leader>l', ':wincmd l<CR>')

-- clear search
vim.keymap.set('n', '<leader>ch', ':nohlsearch<CR>')
vim.keymap.set('n', '<leader>vnh', ':nohlsearch<CR>')


4 changes: 4 additions & 0 deletions nvim/lua/core/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ vim.cmd [[ set noswapfile ]]

--Line numbers
vim.wo.number = true
vim.wo.relativenumber = true

-- render
vim.opt.list = true
1 change: 1 addition & 0 deletions nvim/lua/core/plugin_config/comments.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions nvim/lua/core/plugin_config/gitworktree.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

297 changes: 163 additions & 134 deletions nvim/lua/core/plugin_config/lsp_config.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = { "lua_ls", "gopls", "clangd"}
ensure_installed = { "lua_ls", "gopls", "clangd", "terraformls"}
})
-- indent lines
require("ibl").setup()

vim.cmd("set scl=yes")
vim.cmd("set autoindent noexpandtab tabstop=4 shiftwidth=4 invlist")
vim.cmd("set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:␣")
vim.cmd("set list")

local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())

require('lspsaga').setup({
code_action_icon = "💡",
symbol_in_winbar = {
in_custom = false,
enable = true,
separator = '',
show_file = true,
file_formatter = ""
},
symbol_in_winbar = {
in_custom = false,
enable = true,
separator = '',
show_file = true,
file_formatter = ""
},
})


Expand All @@ -27,136 +33,159 @@ 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 keymap = vim.keymap.set

-- 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("n", "gh", "<cmd>Lspsaga lsp_finder<CR>")

-- Code action
keymap({"n","v"}, "<leader>ca", "<cmd>Lspsaga code_action<CR>")

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

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

-- 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("n", "gp", "<cmd>Lspsaga peek_definition<CR>")

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

-- Peek type definition
-- You can edit the file containing the type 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("n", "gt", "<cmd>Lspsaga peek_type_definition<CR>")

-- Go to type definition
keymap("n","gt", "<cmd>Lspsaga goto_type_definition<CR>")


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

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

-- Show workspace diagnostics
keymap("n", "<leader>sw", "<cmd>Lspsaga show_workspace_diagnostics<CR>")

-- Show cursor diagnostics
keymap("n", "<leader>sc", "<cmd>Lspsaga show_cursor_diagnostics<CR>")

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

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

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

-- 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("n", "K", "<cmd>Lspsaga hover_doc<CR>")

-- 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("n", "K", "<cmd>Lspsaga hover_doc ++keep<CR>")

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

-- Floating terminal
keymap({"n", "t"}, "<A-d>", "<cmd>Lspsaga term_toggle<CR>")
end,
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 keymap = vim.keymap.set

-- 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("n", "gh", "<cmd>Lspsaga lsp_finder<CR>")

-- Code action
keymap({ "n", "v" }, "<leader>ca", "<cmd>Lspsaga code_action<CR>")

-- Rename all occurrences of the hovered word for the entire file
keymap("n", "<leader>vrn", "<cmd>Lspsaga rename<CR>")

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

-- 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("n", "<leader>vpd", "<cmd>Lspsaga peek_definition<CR>")

-- Go to definition
keymap("n", "gd", "<cmd>Lspsaga goto_definition<CR>")
-- Show references
vim.keymap.set('n', 'gr', vim.lsp.buf.references)

-- Peek type definition
-- You can edit the file containing the type 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("n", "<leader>vpt", "<cmd>Lspsaga peek_type_definition<CR>")

-- Go to type definition
keymap("n", "<leader>vgt", "<cmd>Lspsaga goto_type_definition<CR>")


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

-- Show buffer diagnostics
keymap("n", "<leader>vdb", "<cmd>Lspsaga show_buf_diagnostics<CR>")

-- Show workspace diagnostics
keymap("n", "<leader>vdw", "<cmd>Lspsaga show_workspace_diagnostics<CR>")

-- Show cursor diagnostics
keymap("n", "<leader>vdc", "<cmd>Lspsaga show_cursor_diagnostics<CR>")

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

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

-- Toggle outline
keymap("n", "<leader>vso", "<cmd>Lspsaga outline<CR>")

-- 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("n", "K", "<cmd>Lspsaga hover_doc<CR>")

-- 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("n", "K", "<cmd>Lspsaga hover_doc ++keep<CR>")

-- Call hierarchy
keymap("n", "<leader>vci", "<cmd>Lspsaga incoming_calls<CR>")
keymap("n", "<leader>vco", "<cmd>Lspsaga outgoing_calls<CR>")

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


-- Lua
-- Lua
require("lspconfig").lua_ls.setup {
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.stdpath "config" .. "/lua"] = true,
},
},
},
}
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.stdpath "config" .. "/lua"] = true,
},
},
},
}
}

-- gopls
-- format on save

-- gopls
require("lsp-format").setup {}
require("lspconfig").gopls.setup { on_attach = require("lsp-format").on_attach }
require("lspconfig").gopls.setup {
cmd = {"gopls", "serve"},
filetypes = {"go", "gomod"},
root_dir = require("lspconfig/util").root_pattern("go.work", "go.mod", ".git"),
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
},
},
}
on_attach = require("lsp-format").on_attach,
cmd = { "gopls", "serve" },
filetypes = { "go", "gomod" },
root_dir = require("lspconfig/util").root_pattern("go.work", "go.mod", ".git"),
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
},
},
}

--terraform
require('lspconfig').terraformls.setup {}

vim.api.nvim_create_autocmd("BufWritePre", {
pattern = { "*.tf", "*.tfvars" },
callback = function()
vim.lsp.buf.format()
end
})

vim.api.nvim_create_autocmd('BufWritePre', {
pattern = '*.go',
callback = function()
vim.lsp.buf.code_action({ context = { only = { 'source.organizeImports' } }, apply = true })
end
})
6 changes: 5 additions & 1 deletion nvim/lua/core/plugin_config/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ require('lualine').setup {
'filename',
path = 1,
}
}
},
lualine_c = {},
lualine_x = {"diagnostics"},
lualine_y = {},
lualine_z = {},
}
}
Loading

0 comments on commit 477c6ba

Please sign in to comment.