Created
February 5, 2024 02:47
-
-
Save tomkrush/65a3198ad839d436f5a4ccb6d264634b to your computer and use it in GitHub Desktop.
Code Editor (NeoVim + Tmux)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------- My Neovim Configuration ---------- | |
-- This file contains my neovim configuration | |
-- including plugins and settings. | |
--------------------------------------------- | |
local Plug = vim.fn['plug#'] | |
----------------- Plugin Setup -------------- | |
-- Install plugins using vim-plug | |
--------------------------------------------- | |
vim.call('plug#begin', '~/.config/nvim/plugged') | |
-- Add autocompletion and linting | |
-- :CocInstall coc-html coc-yaml coc-sql coc-sh coc-rust-analyzer coc-python coc-phpls coc-docker coc-css | |
Plug('neoclide/coc.nvim', { branch = 'release' }) | |
-- Add Copilot for AI autocompletion | |
-- Requires auth token from GitHub | |
Plug('github/copilot.vim') | |
-- Add fzf for file finder | |
-- Important to do apt-get install fzf | |
Plug('junegunn/fzf') | |
Plug('junegunn/fzf.vim') | |
-- Add NERDCommenter for commenting | |
Plug('scrooloose/nerdcommenter') | |
-- Add NERDTree for file tree | |
-- Should install a font with icons. https://www.nerdfonts.com/ | |
-- I like FiraCode Nerd Font | |
Plug('nvim-tree/nvim-tree.lua') | |
-- Add rose-pine theme | |
Plug('rose-pine/neovim') | |
vim.call('plug#end') | |
--------- Default Settings ------------------- | |
vim.cmd('set number') | |
vim.cmd('syntax enable') | |
vim.cmd('set wrap') | |
vim.cmd('set incsearch') | |
vim.cmd('set hlsearch') | |
vim.cmd('set showmatch') | |
vim.cmd('set ignorecase') | |
vim.cmd('set smartcase') | |
vim.cmd('let mapleader = ","') | |
vim.cmd('set nobackup') | |
vim.cmd('set nowritebackup') | |
vim.cmd('set updatetime=300') | |
vim.cmd('set noswapfile') | |
----------------- Theme --------------------- | |
vim.cmd('colorscheme rose-pine') | |
vim.cmd('set background=dark') | |
----------------- FZF Setup ----------------- | |
-- Provides a file finder | |
--------------------------------------------- | |
-- Enable fzf.vim plugin. This plugin provides a file finder | |
vim.g.fzf_layout = { window = { width = 0.8, height = 0.8 } } | |
-- Key mapping to open fzf file finder | |
vim.api.nvim_set_keymap('n', '<C-p>', ':FZF<CR>', { noremap = true }) | |
vim.g.loaded_netrw = 1 | |
vim.g.loaded_netrwPlugin = 1 | |
-- optionally enable 24-bit colour | |
vim.opt.termguicolors = true | |
----------------- NVIM-TREE Setup ----------- | |
-- Provides a file tree | |
--------------------------------------------- | |
require("nvim-tree").setup({ | |
sort = { | |
sorter = "case_sensitive", | |
}, | |
view = { | |
width = 30, | |
}, | |
renderer = { | |
group_empty = true, | |
}, | |
filters = { | |
dotfiles = true, | |
}, | |
}) | |
----------------- COC Setup ----------------- | |
-- Provides autocompletion and linting | |
--------------------------------------------- | |
vim.g.coc_suggest_opts = { autoTrigger = 's' } | |
vim.api.nvim_set_keymap('i', '<Tab>', 'pumvisible() ? "\\<C-n>" : "\\<Tab>"', { expr = true, silent = true }) | |
vim.api.nvim_set_keymap('i', '<S-Tab>', 'pumvisible() ? "\\<C-p>" : "\\<S-Tab>"', { expr = true, silent = true }) | |
-- Key mappings for split navigation | |
vim.api.nvim_set_keymap('n', '<C-h>', '<C-w>h', { noremap = true }) | |
vim.api.nvim_set_keymap('n', '<C-j>', '<C-w>j', { noremap = true }) | |
vim.api.nvim_set_keymap('n', '<C-k>', '<C-w>k', { noremap = true }) | |
vim.api.nvim_set_keymap('n', '<C-l>', '<C-w>l', { noremap = true }) | |
-- Key mappings for creating splits | |
vim.api.nvim_set_keymap('n', '<leader>h', '<C-w>s', { noremap = true }) | |
vim.api.nvim_set_keymap('n', '<leader>v', '<C-w>v', { noremap = true }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remap prefix from 'C-b' to 'C-a' | |
unbind C-b | |
set-option -g prefix C-b | |
bind-key C-b send-prefix | |
# List of plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
run '/usr/share/tmux-plugin-manager/tpm' | |
# split panes using | and - | |
bind | split-window -h | |
bind - split-window -v | |
unbind '"' | |
unbind % | |
# reload config file (change file location to your the tmux.conf you want to use) | |
bind r source-file ~/.tmux.conf | |
# switch panes using Alt-arrow without prefix | |
bind -n M-Left select-pane -L | |
bind -n M-Right select-pane -R | |
bind -n M-Up select-pane -U | |
bind -n M-Down select-pane -D | |
# don't rename windows automatically | |
set-option -g allow-rename off | |
# DESIGN TWEAKS | |
# don't do anything when a 'bell' rings | |
set -g visual-activity off | |
set -g visual-bell off | |
set -g visual-silence off | |
setw -g monitor-activity off | |
set -g bell-action none | |
# clock mode | |
setw -g clock-mode-colour colour6 | |
# copy mode | |
setw -g mode-style 'fg=colour1 bg=colour18 bold' | |
# pane borders | |
set -g pane-border-style 'fg=colour6' | |
set -g pane-active-border-style 'fg=colour3' | |
# statusbar | |
set -g status-position bottom | |
set -g status-justify left | |
set -g status-style 'fg=colour6' | |
set -g status-left '' | |
set -g status-right '%Y-%m-%d %H:%M ' | |
set -g status-right-length 50 | |
set -g status-left-length 10 | |
setw -g window-status-current-style 'fg=colour0 bg=colour6 bold' | |
setw -g window-status-current-format ' #I #W #F ' | |
setw -g window-status-style 'fg=colour6 dim' | |
setw -g window-status-format ' #I #[fg=colour7]#W #[fg=colour1]#F ' | |
setw -g window-status-bell-style 'fg=colour6 bg=colour1 bold' | |
# messages | |
set -g message-style 'fg=colour6 bg=colour0 bold' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment