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.wrap = true
|
||||
|
||||
--vim.cmd.colorscheme("retrobox")
|
||||
vim.cmd.colorscheme("retrobox")
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.opt.clipboard = 'unnamedplus' -- System clipboard
|
||||
@@ -59,13 +59,5 @@ require("nvim-treesitter").setup({
|
||||
|
||||
require("rakshit")
|
||||
|
||||
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()"
|
||||
vim.cmd("packadd nvim.undotree")
|
||||
vim.keymap.set("n", "<leader>u", require("undotree").open)
|
||||
|
||||
@@ -21,32 +21,29 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
-- 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)
|
||||
vim.keymap.set(mode, lhs, rhs, { buffer = bufnr })
|
||||
vim.keymap.set(mode, lhs, rhs, { buffer = args.buf })
|
||||
end
|
||||
|
||||
map("n", "gd", vim.lsp.buf.definition)
|
||||
map("n", "gD", vim.lsp.buf.declaration)
|
||||
map("n", "gr", vim.lsp.buf.references)
|
||||
map("n", "K", vim.lsp.buf.hover)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- helper to setup servers
|
||||
local lspconfig = require('lspconfig')
|
||||
-- shared config applied to all servers
|
||||
vim.lsp.config('*', {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
local function setup(server, opts)
|
||||
opts = opts or {}
|
||||
opts.capabilities = capabilities
|
||||
opts.on_attach = on_attach
|
||||
lspconfig[server].setup(opts)
|
||||
end
|
||||
-- per-server config
|
||||
vim.lsp.config('pyright', {})
|
||||
vim.lsp.config('rust_analyzer', {})
|
||||
|
||||
-- servers
|
||||
setup("pyright")
|
||||
setup("rust_analyzer")
|
||||
|
||||
setup("lua_ls", {
|
||||
vim.lsp.config('lua_ls', {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
@@ -56,9 +53,9 @@ setup("lua_ls", {
|
||||
}
|
||||
})
|
||||
|
||||
setup("html")
|
||||
vim.lsp.config('html', {})
|
||||
|
||||
setup("gopls", {
|
||||
vim.lsp.config('gopls', {
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
@@ -73,6 +70,9 @@ setup("gopls", {
|
||||
},
|
||||
})
|
||||
|
||||
setup("clangd", {
|
||||
cmd = { "clangd", "--background-index", "--query-driver=/usr/bin/gcc,/usr/bin/g++",},
|
||||
vim.lsp.config('clangd', {
|
||||
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