Skip to content

Instantly share code, notes, and snippets.

@shikaan
Last active March 19, 2023 21:23
Show Gist options
  • Save shikaan/f3e269bad0cfefee3a47e30777a0c045 to your computer and use it in GitHub Desktop.
Save shikaan/f3e269bad0cfefee3a47e30777a0c045 to your computer and use it in GitHub Desktop.
tmux + Vim Configuration
set -g mouse on
set -g status-style "bg=default"
set -g window-status-current-style "bg=default,reverse"
set -g window-status-separator '|'
set -g window-status-format " #W#{?window_flags,#F, } (M-#I) "
set -g window-status-current-format " #W#{?window_flags,#F, } (M-#I) "
set -g base-index 1
set-window-option -g pane-base-index 1
set -g status-position top
# Don't slowdown mode change in vim
set -sg escape-time 0
set -g xterm-keys on
bind -n M-t new-window
bind -n M-1 selectw -t 1
bind -n M-2 selectw -t 2
bind -n M-3 selectw -t 3
bind -n M-4 selectw -t 4
bind -n M-5 selectw -t 5
bind -n M-6 selectw -t 6
bind -n M-7 selectw -t 7
bind -n M-8 selectw -t 8
bind -n M-9 selectw -t 9
bind -n M-0 selectw -t 0
bind r source-file ~/.tmux.conf \; display ".tmux.conf reloaded!"
set -g default-terminal tmux-256color
schemes:
light: &light
primary:
background: '0xf8f8f8'
foreground: '0x2a2b33'
normal:
black: '0x000000'
red: '0xde3d35'
green: '0x3e953a'
yellow: '0xd2b67b'
blue: '0x2f5af3'
magenta: '0xa00095'
cyan: '0x3e953a'
white: '0xbbbbbb'
bright:
black: '0x000000'
red: '0xde3d35'
green: '0x3e953a'
yellow: '0xd2b67b'
blue: '0x2f5af3'
magenta: '0xa00095'
cyan: '0x3e953a'
white: '0xffffff'
dark: &dark
primary:
background: '0x1e2127'
foreground: '0xabb2bf'
normal:
black: '0x1e2127'
red: '0xe06c75'
green: '0x98c379'
yellow: '0xd19a66'
blue: '0x61afef'
magenta: '0xc678dd'
cyan: '0x56b6c2'
white: '0xabb2bf'
bright:
black: '0x5c6370'
red: '0xe06c75'
green: '0x98c379'
yellow: '0xd19a66'
blue: '0x61afef'
magenta: '0xc678dd'
cyan: '0x56b6c2'
white: '0xffffff'
scrolling:
history: 1000
font:
size: 12
normal:
family: "Inconsolata"
selection:
save_to_clipboard: false
cursor:
style: Underline
draw_bold_text_with_bright_colors: false
shell:
program: tmux
colors: *dark
call plug#begin('~/.local/share/nvim/site/autoload')
Plug 'scrooloose/nerdtree'
Plug 'ryanoasis/vim-devicons'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'vim-airline/vim-airline'
Plug 'buoto/gotests-vim', { 'for': 'go' }
Plug 'rakr/vim-one'
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'williamboman/mason.nvim'
call plug#end()
lua require('lsp')
set number
set encoding=UTF-8
set completeopt=menu,menuone,noselect
" one config (instruction have to be in this order)
syntax on
set termguicolors
colorscheme one
let g:one_allow_italics = 1
set background=dark
" Use system clipboard
set clipboard^=unnamed,unnamedplus
" Highlight serach result
set hlsearch
" Fold based on syntax
set foldmethod=syntax
set foldlevel=20
" Intendation
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set smartindent
filetype indent on
set ignorecase
set smartcase
set incsearch
set hidden
set nobackup
set nowritebackup
set noswapfile
set mouse=a
" Airline
let g:airline#extensions#tabline#enabled = 1
" prevents slowing down switch to normal mode
if ! has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
endif
" scrooloose/nerdtree
let g:NERDTreeShowHidden=1
" junegun/fzf.vim
nnoremap <leader><leader>a :Rg<CR>
nnoremap <leader><leader>b :Buffers<CR>
nnoremap <leader><leader>g :GFiles?<CR>
"" Custom keybindings
nnoremap <A-Down> :m .+1<CR>==
nnoremap <A-Up> :m .-2<CR>==
vnoremap <A-Down> :m '>+1<CR>gv=gv
vnoremap <A-Up> :m '<-2<CR>gv=gv
nnoremap = zA
nnoremap <C-t> :NERDTreeToggle<CR>
require("mason").setup()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require('lspconfig')
local servers = { 'gopls', 'tsserver', 'lua_ls' }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
-- on_attach = my_custom_on_attach,
capabilities = capabilities,
}
end
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<Leader>B', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<Leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<Leader>a', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<Leader>b', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<Leader>f', function()
vim.lsp.buf.format { async = true }
end, opts)
end,
})
local cmp = require 'cmp'
cmp.setup {
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
},
mapping = cmp.mapping.preset.insert({
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm { select = true },
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'buffer' },
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment