Skip to content

Commit

Permalink
Add lua config for Neovim and change autostart from dwm.
Browse files Browse the repository at this point in the history
  • Loading branch information
brunomontezano committed Mar 8, 2023
1 parent df93b53 commit 0637a4c
Show file tree
Hide file tree
Showing 16 changed files with 484 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .config/dwm/autostart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
picom &
feh --bg-scale ~/img/wallpaper.jpg &
dwmblocks &
dualmonitor &
aoc_monitor &
xset r rate 300 50 &
redshift -l -31.8:-52.3 -t 4500:3000 -b 1.0:1.0 -g 0.8 -m randr &
9 changes: 9 additions & 0 deletions nvim-lua/after/plugin/colors.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function ColorMyPencils(color)
color = color or "material"
vim.cmd.colorscheme(color)

vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
end

ColorMyPencils()
1 change: 1 addition & 0 deletions nvim-lua/after/plugin/fugitive.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);
10 changes: 10 additions & 0 deletions nvim-lua/after/plugin/harpoon.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")

vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)

vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end)
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)
49 changes: 49 additions & 0 deletions nvim-lua/after/plugin/iron.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
local iron = require("iron.core")
local view = require("iron.view")

iron.setup {
config = {
-- Whether a repl should be discarded or not
scratch_repl = true,
-- Your repl definitions come here
repl_definition = {
sh = {
-- Can be a table or a function that
-- returns a table (see below)
command = {"bash"}
},
r = {
command = {"R"}
}
},
repl_open_cmd = view.split.vertical.botright(0.5),
},
-- Iron doesn't set keymaps by default anymore.
-- You can set them here or manually add keymaps to the functions in iron.core
keymaps = {
send_motion = "<space>sc",
visual_send = "<space>sc",
send_file = "<space>sf",
send_line = "<space>sl",
send_mark = "<space>sm",
mark_motion = "<space>mc",
mark_visual = "<space>mc",
remove_mark = "<space>md",
cr = "<space>s<cr>",
interrupt = "<space>s<space>",
exit = "<space>sq",
clear = "<space>cl",
},
-- If the highlight is on, you can change how it looks
-- For the available options, check nvim_set_hl
highlight = {
italic = true
},
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
}

-- iron also has a list of commands, see :h iron-commands for all available commands
vim.keymap.set('n', '<space>rs', '<cmd>IronRepl<cr>')
vim.keymap.set('n', '<space>rr', '<cmd>IronRestart<cr>')
vim.keymap.set('n', '<space>rf', '<cmd>IronFocus<cr>')
vim.keymap.set('n', '<space>rh', '<cmd>IronHide<cr>')
58 changes: 58 additions & 0 deletions nvim-lua/after/plugin/lsp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
local lsp = require('lsp-zero')

lsp.preset('recommended')

local cmp = require('cmp')
local cmp_select = {behavior = cmp.SelectBehavior.Select}
local cmp_mappings = lsp.defaults.cmp_mappings({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
})

-- disable completion with tab
-- this helps with copilot setup
cmp_mappings['<Tab>'] = nil
cmp_mappings['<S-Tab>'] = nil

lsp.setup_nvim_cmp({
mapping = cmp_mappings
})

lsp.set_preferences({
suggest_lsp_servers = false,
sign_icons = {
error = 'E',
warn = 'W',
hint = 'H',
info = 'I'
}
})

vim.diagnostic.config({
virtual_text = true,
})

lsp.on_attach(function(client, bufnr)
local opts = {buffer = bufnr, remap = false}

if client.name == "eslint" then
vim.cmd [[ LspStop eslint ]]
return
end

vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
end)

lsp.preset('recommended')
lsp.setup()
6 changes: 6 additions & 0 deletions nvim-lua/after/plugin/telescope.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") });
end)
23 changes: 23 additions & 0 deletions nvim-lua/after/plugin/treesitter.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = { "help", "javascript", "typescript", "r", "sql", "bash", "bibtex", "cmake", "cpp", "css", "gitignore", "go", "html", "java", "julia", "latex", "markdown", "make", "python", "yaml", "perl", "arduino", "c", "lua", "rust" },

-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,

-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,

highlight = {
-- `false` will disable the whole extension
enable = true,
disable = { "latex" },

-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}
1 change: 1 addition & 0 deletions nvim-lua/after/plugin/undotree.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
1 change: 1 addition & 0 deletions nvim-lua/after/plugin/vimtex.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vim.g.vimtex_view_method = 'zathura'
1 change: 1 addition & 0 deletions nvim-lua/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("bruno")
3 changes: 3 additions & 0 deletions nvim-lua/lua/bruno/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require("bruno.packer")
require("bruno.remap")
require("bruno.set")
50 changes: 50 additions & 0 deletions nvim-lua/lua/bruno/packer.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
return require('packer').startup(function(use)

use 'wbthomason/packer.nvim'

use {
'nvim-telescope/telescope.nvim', tag = '0.1.0',
requires = { {'nvim-lua/plenary.nvim'} }
}

use('marko-cerovac/material.nvim')

use('nvim-treesitter/nvim-treesitter', {run = ':TsUpdate'})

use('nvim-treesitter/playground')

use('theprimeagen/harpoon')

use('mbbill/undotree')

use('tpope/vim-fugitive')

use {
'VonHeikemen/lsp-zero.nvim',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'},
{'williamboman/mason.nvim'},
{'williamboman/mason-lspconfig.nvim'},

-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-buffer'},
{'hrsh7th/cmp-path'},
{'saadparwaiz1/cmp_luasnip'},
{'hrsh7th/cmp-nvim-lsp'},
{'hrsh7th/cmp-nvim-lua'},

-- Snippets
{'L3MON4D3/LuaSnip'},
{'rafamadriz/friendly-snippets'},
}
}

use('chrisbra/csv.vim')

use('hkupty/iron.nvim')

use('lervag/vimtex')

end)
24 changes: 24 additions & 0 deletions nvim-lua/lua/bruno/remap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)

vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")

vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")

-- greatest remap ever
vim.keymap.set("x", "<leader>p", "\"_dP")

-- next greatest remap ever : asbjornHaland
vim.keymap.set("n", "<leader>y", "\"+y")
vim.keymap.set("n", "<leader>Y", "\"+Y")

vim.keymap.set("n", "<leader>d", "\"_d")
vim.keymap.set("v", "<leader>d", "\"_d")

vim.keymap.set("n", "<leader>s", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>")
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
31 changes: 31 additions & 0 deletions nvim-lua/lua/bruno/set.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
vim.opt.nu = true
vim.opt.relativenumber = true

vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true

vim.opt.smartindent = true

vim.opt.wrap = false

vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undofile = true

vim.opt.incsearch = true
vim.opt.ignorecase = true

vim.opt.termguicolors = true

vim.opt.scrolloff = 8
vim.opt.signcolumn = 'yes'
vim.opt.isfname:append('@-@')

vim.opt.updatetime = 50

vim.opt.colorcolumn = '80'

vim.g.material_style = 'deep ocean'
vim.cmd 'colorscheme material'
Loading

0 comments on commit 0637a4c

Please sign in to comment.