Skip to content

Commit

Permalink
Additional work to nvim config
Browse files Browse the repository at this point in the history
  • Loading branch information
mpriscella committed Mar 30, 2024
1 parent 2f28fde commit e2d7726
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 37 deletions.
87 changes: 55 additions & 32 deletions .config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,81 +25,104 @@ require("lazy").setup({
ft = { "markdown" },
build = function() vim.fn["mkdp#util#install"]() end,
},
{
"junegunn/fzf.vim",
enabled = not vim.g.vscode
},
{
"nvim-lualine/lualine.nvim",
enabled = not vim.g.vscode,
dependencies = { "nvim-tree/nvim-web-devicons" }
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require('lualine').setup()
end
},
{
"nvim-tree/nvim-tree.lua",
enabled = not vim.g.vscode,
version = "*",
lazy = false,
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("nvim-tree").setup()
end,
},
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")

configs.setup({
ensure_installed = { "c", "lua", "vim", "vimdoc", "javascript", "html", "terraform", "go", "yaml", "jsonc" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end
},
{
"tpope/vim-commentary",
enabled = not vim.g.vscode
'numToStr/Comment.nvim',
lazy = false,
config = function()
require('Comment').setup()
end
},
{ "tpope/vim-sensible" },
{ "tpope/vim-surround" },
{
"kylechui/nvim-surround",
version = "*",
event = "VeryLazy",
config = function()
require("nvim-surround").setup()
end
}
})


----------------
--- SETTINGS ---
----------------

if vim.g.vscode then
-- VSCode extension
vim.g.clipboard = vim.g.vscode_clipboard
else
-- ordinary Neovim
vim.opt.termguicolors = true
vim.opt.mouse = "a"
vim.opt.number = true -- Show line numbers.
vim.opt.relativenumber = false -- Show the line number relative to the line with the cursor in front of each line.
vim.opt.number = true -- Show line numbers.
vim.opt.relativenumber = true -- Show the line number relative to the line with the cursor in front of each line.
end

vim.g.mapleader = ","

----------------
-- various.txt -
----------------

vim.opt.clipboard = "unnamed,unnamedplus"

----------------
-- options.txt -
----------------
vim.g.mapleader = ","

vim.opt.expandtab = true -- Use spaces instead of tabs.
vim.opt.ignorecase = true -- Ignore case when searching.
-- vim.opt.linebreak = true
vim.opt.smartindent = true -- Autoindent when starting a new line.
vim.opt.shiftwidth = 2 -- Number of spaces per indent.
vim.opt.softtabstop = 2
vim.opt.tabstop = 2
vim.opt.clipboard = "unnamedplus"
vim.opt.splitright = true
vim.opt.splitbelow = true

----------------
--- MAPPINGS ---
----------------
-- Tabs.
vim.keymap.set("n", "<Leader>t", ":tabnew<CR>", { silent = true })
vim.keymap.set("n", "<Leader>w", ":tabclose<CR>", { silent = true })

-- Map <Leader>[1-9] to switch between open tabs.
for i = 1,9,1
do
vim.keymap.set("n", string.format("<Leader>%d", i), string.format("%dgt<CR>", i), { noremap = true, silent = true })
end

vim.keymap.set("n", "<Leader>t", ":tabnew<cr>")
vim.keymap.set("n", "<Leader>w", ":tabclose<cr>")
vim.keymap.set("n", "<Leader>e", ':NvimTreeToggle<CR>', { noremap = true, silent = true })

-- Search mappings: These will make it so that going to the next one in a
-- search will center on the line it's found in.
vim.keymap.set("n", "n", "nzzzv", { noremap = true })
vim.keymap.set("n", "N", "Nzzzv", { noremap = true })




vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

-- Map Ctrl-(h|j|k|l) to move between panes.
vim.keymap.set("n", "<C-h>", ":wincmd h<CR>", { silent = true })
vim.keymap.set("n", "<C-j>", ":wincmd j<CR>", { silent = true })
vim.keymap.set("n", "<C-k>", ":wincmd k<CR>", { silent = true })
vim.keymap.set("n", "<C-l>", ":wincmd l<CR>", { silent = true })
8 changes: 5 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"name": "Dotfiles",
"image": "mcr.microsoft.com/devcontainers/base:jammy",
// Uncomment below to skip installing dotfiles. Used for debugging.
// "remoteEnv": {
// "DEBUG_DOTFILES": "true"
// },
// "remoteEnv": {
// "DEBUG_DOTFILES": "true"
// },
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -29,3 +29,5 @@
},
"remoteUser": "vscode"
}

/* vim: set filetype=jsonc : */
2 changes: 2 additions & 0 deletions .dotfiles.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ rebase = false
[core]
editor = nvim
attributesFile = ~/.gitattributes

# vim: set filetype=gitconfig :
3 changes: 3 additions & 0 deletions .tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ if-shell -b '[ ! -d $HOME/.tmux/plugins/tpm ]' {
run-shell 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'
}

# Restore <Ctrl-L> to clear screen.
bind C-l send-keys 'C-l'

run-shell '~/.tmux/plugins/tpm/tpm'
2 changes: 1 addition & 1 deletion .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ if [ -n "$AWS_PROFILE" ]; then
gen_prompt='%{$fg[green]%}${AWS_PROFILE}%{$reset_color%}'
fi

if type "kubectl" >/dev/null; then
if type "kubectl" >/dev/null && $(kubectl config current-context >/dev/null 2>&1); then
gen_prompt="$gen_prompt%::$(kube_ps1)"
fi

Expand Down
3 changes: 2 additions & 1 deletion dotfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ clean_up() {
#######################################
install_dependencies() {
if [ "${ADJUSTED_ID}" = "debian" ]; then
check_packages ack curl exuberant-ctags gawk git jq locales python3 tar tmux vim virt-what zsh
check_packages ack curl exuberant-ctags gawk git jq locales python3 tar tmux vim virt-what zsh nodejs npm # Maybe not nodejs? Maybe npm installs it for us.
npm install -g tree-sitter-cli
install_neovim >/dev/null 2>&1
elif [ "${ADJUSTED_ID}" = "darwin" ]; then
brew tap homebrew/cask-fonts
Expand Down

0 comments on commit e2d7726

Please sign in to comment.