deprication, hide dot files and undotree
This commit is contained in:
14
init.lua
14
init.lua
@@ -7,7 +7,7 @@ vim.opt.shiftwidth = 2 -- Indent width
|
|||||||
vim.opt.expandtab = true -- Use spaces instead of tabs
|
vim.opt.expandtab = true -- Use spaces instead of tabs
|
||||||
vim.opt.wrap = true
|
vim.opt.wrap = true
|
||||||
|
|
||||||
--vim.cmd.colorscheme("retrobox")
|
vim.cmd.colorscheme("retrobox")
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
vim.opt.clipboard = 'unnamedplus' -- System clipboard
|
vim.opt.clipboard = 'unnamedplus' -- System clipboard
|
||||||
@@ -59,13 +59,5 @@ require("nvim-treesitter").setup({
|
|||||||
|
|
||||||
require("rakshit")
|
require("rakshit")
|
||||||
|
|
||||||
function _G.my_statusline()
|
vim.cmd("packadd nvim.undotree")
|
||||||
local w = vim.api.nvim_win_get_width(0)
|
vim.keymap.set("n", "<leader>u", require("undotree").open)
|
||||||
if w > 140 then
|
|
||||||
return "%F %y %m %= %l:%c %p%%"
|
|
||||||
else
|
|
||||||
return "%f %= %l:%c"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.o.statusline = "%!v:lua.my_statusline()"
|
|
||||||
|
|||||||
@@ -21,32 +21,29 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
-- shared keymaps when LSP attaches
|
-- shared keymaps when LSP attaches
|
||||||
local on_attach = function(_, bufnr)
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
callback = function(args)
|
||||||
local map = function(mode, lhs, rhs)
|
local map = function(mode, lhs, rhs)
|
||||||
vim.keymap.set(mode, lhs, rhs, { buffer = bufnr })
|
vim.keymap.set(mode, lhs, rhs, { buffer = args.buf })
|
||||||
end
|
end
|
||||||
|
|
||||||
map("n", "gd", vim.lsp.buf.definition)
|
map("n", "gd", vim.lsp.buf.definition)
|
||||||
map("n", "gD", vim.lsp.buf.declaration)
|
map("n", "gD", vim.lsp.buf.declaration)
|
||||||
map("n", "gr", vim.lsp.buf.references)
|
map("n", "gr", vim.lsp.buf.references)
|
||||||
map("n", "K", vim.lsp.buf.hover)
|
map("n", "K", vim.lsp.buf.hover)
|
||||||
end
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- helper to setup servers
|
-- shared config applied to all servers
|
||||||
local lspconfig = require('lspconfig')
|
vim.lsp.config('*', {
|
||||||
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
|
|
||||||
local function setup(server, opts)
|
-- per-server config
|
||||||
opts = opts or {}
|
vim.lsp.config('pyright', {})
|
||||||
opts.capabilities = capabilities
|
vim.lsp.config('rust_analyzer', {})
|
||||||
opts.on_attach = on_attach
|
|
||||||
lspconfig[server].setup(opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- servers
|
vim.lsp.config('lua_ls', {
|
||||||
setup("pyright")
|
|
||||||
setup("rust_analyzer")
|
|
||||||
|
|
||||||
setup("lua_ls", {
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
@@ -56,9 +53,9 @@ setup("lua_ls", {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
setup("html")
|
vim.lsp.config('html', {})
|
||||||
|
|
||||||
setup("gopls", {
|
vim.lsp.config('gopls', {
|
||||||
settings = {
|
settings = {
|
||||||
gopls = {
|
gopls = {
|
||||||
analyses = {
|
analyses = {
|
||||||
@@ -73,6 +70,9 @@ setup("gopls", {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
setup("clangd", {
|
vim.lsp.config('clangd', {
|
||||||
cmd = { "clangd", "--background-index", "--query-driver=/usr/bin/gcc,/usr/bin/g++",},
|
cmd = { "clangd", "--background-index", "--query-driver=/usr/bin/gcc,/usr/bin/g++"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- enable all configured servers
|
||||||
|
vim.lsp.enable({ 'pyright', 'rust_analyzer', 'lua_ls', 'html', 'gopls', 'clangd' })
|
||||||
|
|||||||
@@ -42,4 +42,8 @@ require("nvim-tree").setup({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
filters = {
|
||||||
|
dotfiles = true,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
12
lua/rakshit/plugins/unused.lua
Normal file
12
lua/rakshit/plugins/unused.lua
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
function _G.my_statusline()
|
||||||
|
local w = vim.api.nvim_win_get_width(0)
|
||||||
|
if w > 140 then
|
||||||
|
return "%F %y %m %= %l:%c %p%%"
|
||||||
|
else
|
||||||
|
return "%f %= %l:%c"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.o.statusline = "%!v:lua.my_statusline()"
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user