-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,000 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# my-nvim-config | ||
1. Clone with directory name `nvim` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
" set leader key | ||
let g:mapleader = "\<Space>" | ||
|
||
syntax enable " Enables syntax highlighing | ||
set hidden " Required to keep multiple buffers open multiple buffers | ||
set nowrap " Display long lines as just one line | ||
set encoding=utf-8 " The encoding displayed | ||
set pumheight=10 " Makes popup menu smaller | ||
set fileencoding=utf-8 " The encoding written to file | ||
set ruler " Show the cursor position all the time | ||
set cmdheight=2 " More space for displaying messages | ||
set iskeyword+=- " treat dash separated words as a word text object" | ||
set mouse=a " Enable your mouse | ||
set splitbelow " Horizontal splits will automatically be below | ||
set splitright " Vertical splits will automatically be to the right | ||
set t_Co=256 " Support 256 colors | ||
set conceallevel=0 " So that I can see `` in markdown files | ||
set tabstop=2 " Insert 2 spaces for a tab | ||
set shiftwidth=2 " Change the number of space characters inserted for indentation | ||
set smarttab " Makes tabbing smarter will realize you have 2 vs 4 | ||
set expandtab " Converts tabs to spaces | ||
set smartindent " Makes indenting smart | ||
set autoindent " Good auto indent | ||
set laststatus=0 " Always display the status line | ||
set number " Line numbers | ||
set cursorline " Enable highlighting of the current line | ||
set background=dark " tell vim what the background color looks like | ||
set showtabline=2 " Always show tabs | ||
set noshowmode " We don't need to see things like -- INSERT -- anymore | ||
set nobackup " This is recommended by coc | ||
set nowritebackup " This is recommended by coc | ||
set updatetime=300 " Faster completion | ||
set timeoutlen=500 " By default timeoutlen is 1000 ms | ||
set formatoptions=cro " Stop newline continution of comments | ||
set clipboard=unnamedplus " Copy paste between vim and everything else | ||
set autochdir " Your working directory will always be the same as your working directory | ||
set noswapfile " Turn off swap file | ||
set relativenumber " set relativenumber for great success | ||
|
||
au! BufWritePost $MYVIMRC source % " auto source when writing to init.vm alternatively you can run :source $MYVIMRC | ||
|
||
" You can't stop me | ||
cmap w!! w !sudo tee % | ||
" Change local working directory automatically, except when it's /tmp | ||
autocmd BufEnter * if expand("%:p:h") !~ '^/tmp' | silent! lcd %:p:h | endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
source $HOME/.config/nvim/vim-plug/plugins.vim | ||
|
||
source $HOME/.config/nvim/general/settings.vim | ||
|
||
" Choose themes by uncommenting/commenting: | ||
" source $HOME/.config/nvim/themes/onedark.vim | ||
" source $HOME/.config/nvim/themes/base16.vim | ||
" source $HOME/.config/nvim/themes/gruvbox.vim | ||
source $HOME/.config/nvim/themes/nightfox.vim | ||
" source $HOME/.config/nvim/themes/deus.vim | ||
" source $HOME/.config/nvim/themes/everforest.vim | ||
" source $HOME/.config/nvim/themes/tokyonight.vim | ||
" source $HOME/.config/nvim/themes/kanagawa.vim | ||
" source $HOME/.config/nvim/themes/oceanic-next.vim | ||
" source $HOME/.config/nvim/themes/catpuccin.vim | ||
" End themes | ||
|
||
source $HOME/.config/nvim/themes/airline.vim | ||
|
||
source $HOME/.config/nvim/keys/mappings.vim | ||
|
||
" Include all plugin config | ||
for f in split(glob($HOME . "/.config/nvim/plug-config/*.vim"), '\n') | ||
exe 'source' f | ||
endfor | ||
|
||
lua require 'general' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
" Better nav for omnicomplete | ||
inoremap <expr> <c-j> ("\<C-n>") | ||
inoremap <expr> <c-k> ("\<C-p>") | ||
" Use alt + hjkl to resize windows | ||
nnoremap <M-j> :resize -2<CR> | ||
nnoremap <M-k> :resize +2<CR> | ||
nnoremap <M-h> :vertical resize -2<CR> | ||
nnoremap <M-l> :vertical resize +2<CR> | ||
" I hate escape more than anything else | ||
inoremap jj <Esc> | ||
inoremap jj <Esc> | ||
" Easy CAPS | ||
" inoremap <c-u> <ESC>viwUi | ||
" nnoremap <c-u> viwU<Esc> | ||
|
||
" TAB in general mode will move to text buffer | ||
nnoremap <TAB> :bnext<CR> | ||
" SHIFT-TAB will go back | ||
nnoremap <S-TAB> :bprevious<CR> | ||
" Alternate way to save | ||
nnoremap <C-s> :w<CR> | ||
" Alternate way to quit | ||
nnoremap <C-Q> :wq!<CR> | ||
" Use control-c instead of escape | ||
nnoremap <C-c> <Esc> | ||
" <TAB>: completion. | ||
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | ||
" Better tabbing | ||
vnoremap < <gv | ||
vnoremap > >gv | ||
" Better window navigation | ||
nnoremap <C-h> <C-w>h | ||
nnoremap <C-j> <C-w>j | ||
nnoremap <C-k> <C-w>k | ||
nnoremap <C-l> <C-w>l | ||
" Shortcut to add a line above or below cursor | ||
nnoremap <Leader>o o<Esc>^Da | ||
nnoremap <Leader>O O<Esc>^Da | ||
" fzf | ||
let g:fzf_action = { | ||
\ 'ctrl-t': 'tab split', | ||
\ 'ctrl-x': 'split', | ||
\ 'ctrl-v': 'vsplit' } | ||
|
||
" Enable per-command history. | ||
" CTRL-N and CTRL-P will be automatically bound to next-history and | ||
" previous-history instead of down and up. If you don't like the change, | ||
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS. | ||
let g:fzf_history_dir = '~/.local/share/fzf-history' | ||
|
||
" FZF searching | ||
map <C-f> :Files<CR> | ||
let g:fzf_tags_command = 'ctags -R' | ||
" Border color | ||
let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } } | ||
|
||
let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline' | ||
let $FZF_DEFAULT_COMMAND="rg --files --hidden" | ||
|
||
" Customize fzf colors to match your color scheme | ||
let g:fzf_colors = | ||
\ { 'fg': ['fg', 'Normal'], | ||
\ 'bg': ['bg', 'Normal'], | ||
\ 'hl': ['fg', 'Comment'], | ||
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], | ||
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], | ||
\ 'hl+': ['fg', 'Statement'], | ||
\ 'info': ['fg', 'PreProc'], | ||
\ 'border': ['fg', 'Ignore'], | ||
\ 'prompt': ['fg', 'Conditional'], | ||
\ 'pointer': ['fg', 'Exception'], | ||
\ 'marker': ['fg', 'Keyword'], | ||
\ 'spinner': ['fg', 'Label'], | ||
\ 'header': ['fg', 'Comment'] } | ||
|
||
" Get Files | ||
command! -bang -nargs=? -complete=dir Files | ||
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0) | ||
|
||
" Get text in files with Rg | ||
command! -bang -nargs=* Rg | ||
\ call fzf#vim#grep( | ||
\ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(<q-args>), 1, | ||
\ fzf#vim#with_preview(), <bang>0) | ||
|
||
" Ripgrep advanced | ||
function! RipgrepFzf(query, fullscreen) | ||
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true' | ||
let initial_command = printf(command_fmt, shellescape(a:query)) | ||
let reload_command = printf(command_fmt, '{q}') | ||
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]} | ||
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) | ||
endfunction | ||
|
||
command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0) | ||
|
||
" Git grep | ||
command! -bang -nargs=* GGrep | ||
\ call fzf#vim#grep( | ||
\ 'git grep --line-number '.shellescape(<q-args>), 0, | ||
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require("utils") | ||
require("plug-colorizer") | ||
require("plug-config") | ||
require("lsp-config") | ||
require("mappings") | ||
|
||
-- Disable some built-in plugins | ||
local disabled_built_ins = { | ||
"netrwPlugin", | ||
"tohtml", | ||
"man", | ||
"tarPlugin", | ||
"zipPlugin", | ||
"gzip" | ||
} | ||
|
||
for i = 1, table.maxn(disabled_built_ins) do | ||
vim.g["loaded_" .. disabled_built_ins[i]] = 1 | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
require("mason").setup() | ||
local servers = { "solargraph", "gopls", "lua_ls" } | ||
|
||
require("mason-lspconfig").setup({ | ||
ensure_installed = servers | ||
}) | ||
|
||
local coq = require("coq") | ||
local nvim_lsp = require("lspconfig") | ||
|
||
local capabilities = vim.lsp.protocol.make_client_capabilities() | ||
capabilities.textDocument.completion.completionItem.snippetSupport = true | ||
|
||
-- Use an on_attach function to only map the following keys | ||
-- after the language server attaches to the current buffer | ||
local on_attach = function(client, bufnr) | ||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end | ||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end | ||
|
||
--Enable completion triggered by (c-x)<c-o> | ||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') | ||
|
||
-- Mappings. | ||
local opts = { noremap=true, silent=true } | ||
|
||
-- See `:help vim.lsp.*` for documentation on any of the below functions | ||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts) | ||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts) | ||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts) | ||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) | ||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) | ||
buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) | ||
buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) | ||
buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) | ||
buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) | ||
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) | ||
buf_set_keymap('n', '<leader>lca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) | ||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) | ||
buf_set_keymap('n', '<leader>lsd', '<cmd>lua vim.diagnostic.open_float()<CR>', opts) | ||
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) | ||
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) | ||
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts) | ||
buf_set_keymap("n", "<leader>f", '<cmd>lua vim.lsp.buf.format { async=true } <CR>', opts) | ||
end | ||
|
||
-- Custom Go Lang LS (gopls) setup | ||
nvim_lsp.gopls.setup { | ||
settings = { | ||
gopls = { | ||
completeUnignored = true, | ||
usePlaceholders = true, | ||
analyses = { | ||
unusedparams = true, | ||
} | ||
}, | ||
}, | ||
} | ||
|
||
-- Use a loop to conveniently call 'setup' on multiple servers and | ||
-- map buffer local keybindings when the language server attaches | ||
for _, lsp in ipairs(servers) do | ||
nvim_lsp[lsp].setup(coq.lsp_ensure_capabilities({ | ||
capabilities = capabilities, | ||
on_attach = on_attach, | ||
flags = { | ||
debounce_text_changes = 150, | ||
}, | ||
max_files = 0, | ||
}) | ||
) | ||
end |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require'colorizer'.setup( | ||
{'*';}, | ||
{ | ||
RGB = true; -- #RGB hex codes | ||
RRGGBB = true; -- #RRGGBB hex codes | ||
names = true; -- "Name" codes like Blue | ||
RRGGBBAA = true; -- #RRGGBBAA hex codes | ||
rgb_fn = true; -- CSS rgb() and rgba() functions | ||
hsl_fn = true; -- CSS hsl() and hsla() functions | ||
css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB | ||
css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
-- require('copilot').setup({ | ||
-- panel = { | ||
-- enabled = true, | ||
-- auto_refresh = true, | ||
-- keymap = { | ||
-- jump_prev = "[[", | ||
-- jump_next = "]]", | ||
-- accept = "<CR>", | ||
-- refresh = "gr", | ||
-- open = "<M-CR>" | ||
-- }, | ||
-- layout = { | ||
-- position = "bottom", -- | top | left | right | ||
-- ratio = 0.4 | ||
-- }, | ||
-- }, | ||
-- suggestion = { | ||
-- enabled = true, | ||
-- auto_trigger = true, | ||
-- debounce = 75, | ||
-- keymap = { | ||
-- accept = "<M-c>", | ||
-- accept_word = false, | ||
-- accept_line = false, | ||
-- next = "<M-]>", | ||
-- prev = "<M-[>", | ||
-- dismiss = "<C-]>", | ||
-- }, | ||
-- }, | ||
-- filetypes = { | ||
-- yaml = false, | ||
-- markdown = false, | ||
-- help = false, | ||
-- gitcommit = false, | ||
-- gitrebase = false, | ||
-- hgcommit = false, | ||
-- svn = false, | ||
-- cvs = false, | ||
-- ["."] = false, | ||
-- }, | ||
-- copilot_node_command = 'node', -- Node.js version must be > 16.x | ||
-- server_opts_overrides = {}, | ||
-- }) | ||
|
||
-- generate a random integer below |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require("coq_3p") { | ||
{ src = "copilot", short_name = "COP", accept_key = "<m-c>" }, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require "plug-config/nvim-tree" | ||
require "plug-config/which-key" | ||
require "plug-config/which-key-mappings" | ||
require "plug-config/winshift" | ||
require "plug-config/copilot" | ||
require "plug-config/coq_thirdparty" |
Oops, something went wrong.