diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6fa2256 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +configs/nvim/plugin/packer_compiled.lua \ No newline at end of file diff --git a/configs/lazygit/config.yml b/configs/lazygit/config.yml new file mode 100644 index 0000000..e3679f8 --- /dev/null +++ b/configs/lazygit/config.yml @@ -0,0 +1,3 @@ +git: + pull: + mode: 'rebase' # one of 'auto' | 'merge' | 'rebase' | 'ff-only', auto reads from git configuration \ No newline at end of file diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua new file mode 100644 index 0000000..cf59ffd --- /dev/null +++ b/configs/nvim/init.lua @@ -0,0 +1,11 @@ +-------------------- HELPERS ------------------------------- +local helpers = require('helpers') + +-------------------- OPTIONS ------------------------------- +helpers.call_with_helpers(require('options').init) + +-------------------- PLUGINS ------------------------------- +helpers.call_with_helpers(require('plugins').init) + +-------------------- MAPPINGS ------------------------------ +helpers.call_with_helpers(require('mappings').init) \ No newline at end of file diff --git a/configs/nvim/init.vim b/configs/nvim/init.vim deleted file mode 100644 index 84f9819..0000000 --- a/configs/nvim/init.vim +++ /dev/null @@ -1,54 +0,0 @@ -" auto toggle relativenumber -set number! relativenumber! -augroup numbertoggle - autocmd! - autocmd BufEnter,FocusGained,InsertLeave * set relativenumber - autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber -augroup END - -" Tab options -set tabstop=4 softtabstop=4 -set shiftwidth=4 -set expandtab -set smartindent - -set signcolumn=yes - -set noerrorbells - -set nobackup -set nowrap -set undodir=~/.vim/undodir -set undofile - -set updatetime=500 - -let mapleader = " " - -lua require("adopi") - -" smartsearch -set smartcase ignorecase -set incsearch - -" toggle nu column -augroup vimrc-incsearch-highlight - autocmd! - autocmd CmdlineEnter /,\? :set hlsearch - autocmd CmdlineLeave /,\? :set nohlsearch -augroup END - -command! LogPath :lua print(vim.inspect(vim.lsp.get_log_path())) - -nnoremap ps :lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For >")}) - -" Find files using Telescope command-line sugar. -nnoremap ff Telescope find_files -nnoremap fg Telescope live_grep -nnoremap fb Telescope buffers -nnoremap fh Telescope help_tags - -" NvimTreeToggle -nnoremap tt :NvimTreeToggle -nnoremap tr :NvimTreeRefresh - diff --git a/configs/nvim/lua/adopi/init.lua b/configs/nvim/lua/adopi/init.lua deleted file mode 100644 index 29b49f5..0000000 --- a/configs/nvim/lua/adopi/init.lua +++ /dev/null @@ -1,140 +0,0 @@ -local execute = vim.api.nvim_command -local fn = vim.fn - -local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim' - -if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path}) - execute 'packadd packer.nvim' -end - -vim.cmd [[packadd packer.nvim]] - - -require('packer').startup(function() - -- Packer can manage itself - use 'wbthomason/packer.nvim' - - use {'dracula/vim'} - use {'whatyouhide/vim-gotham'} - use {'neovim/nvim-lspconfig'} - use {'hrsh7th/nvim-compe'} - use {'shaunsingh/moonlight.nvim'} - - -- Telescope project search - use { - 'nvim-telescope/telescope.nvim', - requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}} - } - - use {'nvim-treesitter/nvim-treesitter'} - - use 'kyazdani42/nvim-web-devicons' -- removing this line doesn't change the error - use 'kyazdani42/nvim-tree.lua' -end) - - -vim.cmd('colorscheme moonlight') - --- Setup LSP servers -local system_name -if vim.fn.has("mac") == 1 then - system_name = "macOS" -elseif vim.fn.has("unix") == 1 then - system_name = "Linux" -elseif vim.fn.has('win32') == 1 then - system_name = "Windows" -else - print("Unsupported system for sumneko") -end - -local sumneko_root_path = vim.fn.stdpath('cache')..'/lspconfig/sumneko_lua/lua-language-server' -local sumneko_binary = sumneko_root_path.."/bin/"..system_name.."/lua-language-server" - -require'lspconfig'.sumneko_lua.setup{ - cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}; - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT', - -- Setup your lua path - path = vim.split(package.path, ';'), - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = {'vim'}, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = { - [vim.fn.expand('$VIMRUNTIME/lua')] = true, - [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, - }, - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - }, -} - - -require'lspconfig'.rls.setup { - settings = { - rust = { - unstable_features = true, - build_on_save = false, - all_features = true, - }, - }, -} - -require'lspconfig'.tsserver.setup{} - -require'lspconfig'.pyls.setup{} - -vim.o.completeopt = "menuone,noselect" -require'compe'.setup { - enabled = true; - autocomplete = true; - debug = false; - min_length = 1; - preselect = 'enable'; - throttle_time = 80; - source_timeout = 200; - incomplete_delay = 400; - max_abbr_width = 100; - max_kind_width = 100; - max_menu_width = 100; - documentation = true; - - source = { - path = true; - buffer = true; - calc = true; - nvim_lsp = true; - nvim_lua = true; - vsnip = true; - ultisnips = true; - }; -} - - - -require'lspconfig'.solargraph.setup{} ---require'lspconfig'.sorbet.setup{} - - ---nvim treesitter -require'nvim-treesitter.configs'.setup { - ensure_installed = "maintained", -- list of languages - highlight = { - enable = true, - }, - rainbow = { - enable = true, - extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean - } -} diff --git a/configs/nvim/lua/helpers.lua b/configs/nvim/lua/helpers.lua new file mode 100644 index 0000000..4090abe --- /dev/null +++ b/configs/nvim/lua/helpers.lua @@ -0,0 +1,42 @@ +local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd') +local fn = vim.fn -- to call Vim functions e.g. fn.bufnr() +local g = vim.g -- a table to access global variables +local opt = vim.opt -- to set options +local o = vim.o -- to set options + +local function map(mode, lhs, rhs, opts) + local options = {noremap = true} + if opts then options = vim.tbl_extend('force', options, opts) end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +local function dump(...) + local objects = vim.tbl_map(vim.inspect, {...}) + print(unpack(objects)) +end + +local function call_with_helpers(user_func) + setfenv(user_func, + vim.tbl_extend('force', getfenv(), get_helpers())) + local status, err = pcall(user_func) + if not status then + print('Failure running setup function: ' .. vim.inspect(err)) + else + return status + end +end + +function get_helpers() + return { + map = map, + cmd = cmd, + fn = fn, + g = g, + opt = opt, + o = o, + dump = dump, + call_with_helpers = call_with_helpers, + } +end + +return get_helpers() \ No newline at end of file diff --git a/configs/nvim/lua/mappings.lua b/configs/nvim/lua/mappings.lua new file mode 100644 index 0000000..0b6dad2 --- /dev/null +++ b/configs/nvim/lua/mappings.lua @@ -0,0 +1,48 @@ +local function init() + -- command! LogPath :lua print(vim.inspect(vim.lsp.get_log_path())) + + -------------------- Telescope ----------------------------- + map('n', 'ff', 'Telescope find_files') + map('n', 'fg', 'Telescope live_grep') + map('n', 'fb', 'Telescope buffers') + map('n', 'fh', 'Telescope help_tags') + map('n', 'ps', [[lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For >")})]]) + + -------------------- NvimTreeToggle ------------------------ + map('n', '', 'NvimTreeToggle') + map('n', '', 'NvimTreeRefresh') + + -------------------- LSP ----------------------------------- + map('n', ',', 'lua vim.lsp.diagnostic.goto_prev()') + map('n', ';', 'lua vim.lsp.diagnostic.goto_next()') + map('n', 'a', 'lua vim.lsp.buf.code_action()') + map('n', 'd', 'lua vim.lsp.buf.definition()') + map('n', 'f', 'lua vim.lsp.buf.formatting()') + map('n', 'h', 'lua vim.lsp.buf.hover()') + map('n', 'm', 'lua vim.lsp.buf.rename()') + map('n', 'r', 'lua vim.lsp.buf.references()') + map('n', 's', 'lua vim.lsp.buf.document_symbol()') + + -------------------- HlsLens ------------------------------- + map('n', 'n', "execute('normal! ' . v:count1 . 'n')lua require('hlslens').start()") + map('n', 'N', "execute('normal! ' . v:count1 . 'N')lua require('hlslens').start()") + map('n', '*', "*lua require('hlslens').start()") + map('n', '#', "#lua require('hlslens').start()") + map('n', 'g*', "g*lua require('hlslens').start()") + map('n', 'g#', "g#lua require('hlslens').start()") + + -------------------- FTerm --------------------------------- + map('n', '', 'lua require("FTerm").toggle()') + map('t', '', 'lua require("FTerm").toggle()') + + -------------------- LAZYGIT ------------------------------- + -- Install docs : https://github.com/jesseduffield/lazygit + map('n', '', 'LazyGit') + + -------------------- COMMANDS ------------------------------ + cmd 'au TextYankPost * lua vim.highlight.on_yank {on_visual = false}' -- disabled in visual mode +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/options.lua b/configs/nvim/lua/options.lua new file mode 100644 index 0000000..6299a1d --- /dev/null +++ b/configs/nvim/lua/options.lua @@ -0,0 +1,29 @@ +local function init() + cmd('colorscheme moonlight') + + opt.completeopt = {'menuone', 'noinsert', 'noselect'} -- Completion options (for deoplete) + opt.expandtab = true -- Use spaces instead of tabs + opt.hidden = true -- Enable background buffers + opt.ignorecase = true -- Ignore case + opt.joinspaces = false -- No double spaces with join + opt.list = true -- Show some invisible characters + opt.number = true -- Show line numbers + opt.relativenumber = true -- Relative line numbers + opt.scrolloff = 4 -- Lines of context + opt.shiftround = true -- Round indent + opt.shiftwidth = 2 -- Size of an indent + opt.sidescrolloff = 8 -- Columns of context + opt.smartcase = true -- Do not ignore case with capitals + opt.autoindent = true -- Insert indents automatically + opt.splitbelow = true -- Put new windows below current + opt.splitright = true -- Put new windows right of current + opt.tabstop = 2 -- Number of spaces tabs count for + opt.termguicolors = true -- True color support + opt.wildmode = {'list', 'longest'} -- Command-line completion mode + opt.wrap = false -- Disable line wrap + opt.mouse = 'a' -- Enable mouse for all previous modes +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/compe.lua b/configs/nvim/lua/plugins/compe.lua new file mode 100644 index 0000000..0877dbd --- /dev/null +++ b/configs/nvim/lua/plugins/compe.lua @@ -0,0 +1,31 @@ +local function init() + vim.o.completeopt = "menuone,noselect" + require'compe'.setup { + enabled = true; + autocomplete = true; + debug = false; + min_length = 1; + preselect = 'enable'; + throttle_time = 80; + source_timeout = 200; + incomplete_delay = 400; + max_abbr_width = 100; + max_kind_width = 100; + max_menu_width = 100; + documentation = true; + + source = { + path = true; + buffer = true; + calc = true; + nvim_lsp = true; + nvim_lua = true; + vsnip = true; + ultisnips = true; + }; + } +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/init.lua b/configs/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..24b19f0 --- /dev/null +++ b/configs/nvim/lua/plugins/init.lua @@ -0,0 +1,145 @@ +function configure_packages() + call_with_helpers(require('plugins.lspconfig').init) + call_with_helpers(require('plugins.compe').init) + call_with_helpers(require('plugins.nvim-treesitter').init) + call_with_helpers(require('plugins.nvim-web-devicons').init) + call_with_helpers(require('plugins.nvim-autopairs').init) + call_with_helpers(require('plugins.nvim-notify').init) + call_with_helpers(require('plugins.nvim-hlslens').init) + call_with_helpers(require('plugins.nvim-flutter-tools').init) + call_with_helpers(require('plugins.nvim-fterm').init) + call_with_helpers(require('plugins.nvim-feline').init) + call_with_helpers(require('plugins.nvim-todo-comments').init) + call_with_helpers(require('plugins.nvim-lightspeed').init) + call_with_helpers(require('plugins.nvim-numb').init) + call_with_helpers(require('plugins.nvim-neoscroll').init) + call_with_helpers(require('plugins.nvim-lspkind').init) + call_with_helpers(require('plugins.nvim-signature').init) + call_with_helpers(require('plugins.nvim-gutentags').init) + call_with_helpers(require('plugins.nvim-indent-blankline').init) + call_with_helpers(require('plugins.nvim-editorconfig').init) + call_with_helpers(require('plugins.nvim-ctrlsf').init) +end + +function install_packages() + -- Packer can manage itself as an optional plugin + use 'wbthomason/packer.nvim' + + -- LSP + use 'neovim/nvim-lspconfig' + use 'onsails/lspkind-nvim' + use 'kabouzeid/nvim-lspinstall' + + -- Autocomplete + use 'hrsh7th/nvim-compe' + use 'SirVer/ultisnips' + use 'honza/vim-snippets' + use 'windwp/nvim-autopairs' + use 'AndrewRadev/tagalong.vim' + use 'andymass/vim-matchup' + + -- Treesitter + use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } + use 'p00f/nvim-ts-rainbow' + use 'lukas-reineke/indent-blankline.nvim' + use 'JoosepAlviste/nvim-ts-context-commentstring' + use 'romgrk/nvim-treesitter-context' + + -- Syntax + use 'moll/vim-node' + use 'zinit-zsh/zplugin-vim-syntax' + use 'editorconfig/editorconfig-vim' + use 'chrisbra/csv.vim' + use 'npxbr/glow.nvim' + use 'junegunn/vim-easy-align' + + -- Icons + use 'kyazdani42/nvim-web-devicons' + use 'ryanoasis/vim-devicons' + + -- Status Line and Bufferline + use 'famiu/feline.nvim' -- A minimal, stylish and customizable statusline for Neovim written in Lua + use 'romgrk/barbar.nvim' -- Tabs, as understood by any other editor. + + -- Telescope project search + use 'nvim-lua/popup.nvim' + use 'nvim-lua/plenary.nvim' + use 'nvim-telescope/telescope.nvim' + use 'nvim-telescope/telescope-fzy-native.nvim' + use 'nvim-telescope/telescope-project.nvim' + use 'fhill2/telescope-ultisnips.nvim' + + -- Explorer + use 'kyazdani42/nvim-tree.lua' + + -- Git + use 'kdheepak/lazygit.nvim' + + -- Flutter + use 'akinsho/flutter-tools.nvim' + + -- Move & Search & replace + use 'windwp/nvim-spectre' + use 'nacro90/numb.nvim' + use 'dyng/ctrlsf.vim' + use 'kevinhwang91/nvim-hlslens' -- nvim-hlslens helps you better glance at matched information, seamlessly jump between matched instances. + use 'ggandor/lightspeed.nvim' + use 'kshenoy/vim-signature' + use 'karb94/neoscroll.nvim' + use 'dstein64/nvim-scrollview' + use 'chaoren/vim-wordmotion' + + -- Tim Pope docet + use 'tpope/vim-sensible' + use 'tpope/vim-rails' + use 'tpope/vim-abolish' + use 'tpope/vim-surround' + use 'tpope/vim-bundler' + use 'tpope/vim-capslock' + use 'tpope/vim-repeat' + use 'tpope/vim-endwise' -- auto complete block with end + use 'tpope/vim-rvm' + use 'tpope/vim-dispatch' + use 'tpope/vim-dadbod' + use 'tpope/vim-jdaddy' + use 'tpope/vim-fugitive' + use 'tpope/vim-commentary' + + -- Tmux + use 'christoomey/vim-tmux-navigator' + + -- Colorschema + use 'dracula/vim' + use 'whatyouhide/vim-gotham' + use 'shaunsingh/moonlight.nvim' + + -- Tags + use 'ludovicchabant/vim-gutentags' + + -- General Plugins + use 'rcarriga/nvim-notify' -- fancy notification + use 'mfussenegger/nvim-dap' -- debugger + use 'numtostr/FTerm.nvim' -- Floating terminal + use 'folke/todo-comments.nvim' + use 'lambdalisue/suda.vim' + use 'mhinz/vim-startify' -- The fancy start screen for Vim. +end + +function init() + local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim' + + if fn.empty(fn.glob(install_path)) > 0 then + fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path}) + cmd 'packadd packer.nvim' + end + + cmd 'packadd packer.nvim' + + require('packer').startup(install_packages) + + call_with_helpers(configure_packages) +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/lspconfig/dart.lua b/configs/nvim/lua/plugins/lspconfig/dart.lua new file mode 100644 index 0000000..c358c1e --- /dev/null +++ b/configs/nvim/lua/plugins/lspconfig/dart.lua @@ -0,0 +1,7 @@ +local function init() + require'lspconfig'.dartls.setup{} +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/lspconfig/init.lua b/configs/nvim/lua/plugins/lspconfig/init.lua new file mode 100644 index 0000000..50b16eb --- /dev/null +++ b/configs/nvim/lua/plugins/lspconfig/init.lua @@ -0,0 +1,12 @@ +local function init() + call_with_helpers(require('plugins.lspconfig.lua').init) + call_with_helpers(require('plugins.lspconfig.rust').init) + call_with_helpers(require('plugins.lspconfig.typescript').init) + call_with_helpers(require('plugins.lspconfig.ruby').init) + call_with_helpers(require('plugins.lspconfig.php').init) + call_with_helpers(require('plugins.lspconfig.dart').init) +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/lspconfig/lua.lua b/configs/nvim/lua/plugins/lspconfig/lua.lua new file mode 100644 index 0000000..8175d4f --- /dev/null +++ b/configs/nvim/lua/plugins/lspconfig/lua.lua @@ -0,0 +1,48 @@ +local function init() + local system_name + if vim.fn.has("mac") == 1 then + system_name = "macOS" + elseif vim.fn.has("unix") == 1 then + system_name = "Linux" + elseif vim.fn.has('win32') == 1 then + system_name = "Windows" + else + print("Unsupported system for sumneko") + end + + local sumneko_root_path = fn.stdpath('cache')..'/lspconfig/sumneko_lua/lua-language-server' + local sumneko_binary = sumneko_root_path.."/bin/"..system_name.."/lua-language-server" + + require'lspconfig'.sumneko_lua.setup{ + cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}; + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT', + -- Setup your lua path + path = vim.split(package.path, ';'), + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = {'vim'}, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = { + [vim.fn.expand('$VIMRUNTIME/lua')] = true, + [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, + }, + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, + } +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/lspconfig/php.lua b/configs/nvim/lua/plugins/lspconfig/php.lua new file mode 100644 index 0000000..cba5eaa --- /dev/null +++ b/configs/nvim/lua/plugins/lspconfig/php.lua @@ -0,0 +1,7 @@ +local function init() + require'lspconfig'.phpactor.setup{} +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/lspconfig/ruby.lua b/configs/nvim/lua/plugins/lspconfig/ruby.lua new file mode 100644 index 0000000..4f0a939 --- /dev/null +++ b/configs/nvim/lua/plugins/lspconfig/ruby.lua @@ -0,0 +1,7 @@ +local function init() + require'lspconfig'.solargraph.setup{} +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/lspconfig/rust.lua b/configs/nvim/lua/plugins/lspconfig/rust.lua new file mode 100644 index 0000000..97572cc --- /dev/null +++ b/configs/nvim/lua/plugins/lspconfig/rust.lua @@ -0,0 +1,7 @@ +local function init() + require'lspconfig'.rust_analyzer.setup{} +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/lspconfig/typescript.lua b/configs/nvim/lua/plugins/lspconfig/typescript.lua new file mode 100644 index 0000000..b41fa45 --- /dev/null +++ b/configs/nvim/lua/plugins/lspconfig/typescript.lua @@ -0,0 +1,7 @@ +local function init() + require'lspconfig'.tsserver.setup{} +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-autopairs.lua b/configs/nvim/lua/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..a054985 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-autopairs.lua @@ -0,0 +1,11 @@ +local function init() + require('nvim-autopairs').setup() + require("nvim-autopairs.completion.compe").setup({ + map_cr = true, -- map on insert mode + map_complete = true -- it will auto insert `(` after select function or method item + }) +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-ctrlsf.lua b/configs/nvim/lua/plugins/nvim-ctrlsf.lua new file mode 100644 index 0000000..c97c136 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-ctrlsf.lua @@ -0,0 +1,9 @@ +local function init() + g.ctrlsf_ackprg = 'rg' + g.ctrls_auto_preview = 1 + g.ctrlsf_search_mode = 'async' +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-editorconfig.lua b/configs/nvim/lua/plugins/nvim-editorconfig.lua new file mode 100644 index 0000000..edcc6fd --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-editorconfig.lua @@ -0,0 +1,7 @@ +local function init() + g.EditorConfig_exclude_patterns = { 'fugitive://.*', 'scp://.*' } +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-feline.lua b/configs/nvim/lua/plugins/nvim-feline.lua new file mode 100644 index 0000000..2ca3ac9 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-feline.lua @@ -0,0 +1,7 @@ +local function init() + require('feline').setup() +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-flutter-tools.lua b/configs/nvim/lua/plugins/nvim-flutter-tools.lua new file mode 100644 index 0000000..5ce349b --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-flutter-tools.lua @@ -0,0 +1,7 @@ +local function init() + require('flutter-tools').setup() +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-fterm.lua b/configs/nvim/lua/plugins/nvim-fterm.lua new file mode 100644 index 0000000..e35f4f6 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-fterm.lua @@ -0,0 +1,15 @@ +local function init() + require('FTerm').setup { + dimensions = { + height = 0.8, + width = 0.8, + x = 0.5, + y = 0.5 + }, + border = 'double' + } +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-gutentags.lua b/configs/nvim/lua/plugins/nvim-gutentags.lua new file mode 100644 index 0000000..bf733b9 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-gutentags.lua @@ -0,0 +1,17 @@ +local function init() + cmd('set tags+=tags,.git/tags') + g.gutentags_enabled = 1 + g.gutentags_generate_on_missing = 1 + g.gutentags_generate_on_write = 1 + g.gutentags_resolve_symlinks = 1 + g.gutentags_ctags_tagfile = '.git/tags' + g.gutentags_project_root = { '.git' } + g.gutentags_ctags_extra_args = { '--fields=+l' } + g.gutentags_add_default_project_roots = 0 + g.gutentags_ctags_executable_ruby = 'ripper-tags' + g.gutentags_ctags_extra_args = { '--ignore-unsupported-options', '--recursive' } +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-hlslens.lua b/configs/nvim/lua/plugins/nvim-hlslens.lua new file mode 100644 index 0000000..53d1031 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-hlslens.lua @@ -0,0 +1,36 @@ +local function init() + require('hlslens').setup { + calm_down = true, + override_lens = function(render, plist, nearest, idx, r_idx) + local sfw = vim.v.searchforward == 1 + local indicator, text, chunks + local abs_r_idx = math.abs(r_idx) + if abs_r_idx > 1 then + indicator = string.format('%d%s', abs_r_idx, sfw ~= (r_idx > 1) and '' or '') + elseif abs_r_idx == 1 then + indicator = sfw ~= (r_idx == 1) and '' or '' + else + indicator = '' + end + + local lnum, col = unpack(plist[idx]) + if nearest then + local cnt = #plist + if indicator ~= '' then + text = string.format('[%s %d/%d]', indicator, idx, cnt) + else + text = string.format('[%d/%d]', idx, cnt) + end + chunks = {{' ', 'Ignore'}, {text, 'HlSearchLensNear'}} + else + text = string.format('[%s %d]', indicator, idx) + chunks = {{' ', 'Ignore'}, {text, 'HlSearchLens'}} + end + render.set_virt(0, lnum - 1, col - 1, chunks, nearest) + end + } +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-indent-blankline.lua b/configs/nvim/lua/plugins/nvim-indent-blankline.lua new file mode 100644 index 0000000..9c5a278 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-indent-blankline.lua @@ -0,0 +1,12 @@ +local function init() + g.indent_blankline_show_current_context = true + g.indent_blankline_buftype_exclude = {'terminal'} + g.indent_blankline_filetype_exclude = {'help', 'startify', 'dashboard', 'packer', 'neogitstatus', 'NvimTree'} + g.indent_blankline_char = '▏' + g.indent_blankline_use_treesitter = true + g.indent_blankline_show_trailing_blankline_indent = false +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-lightspeed.lua b/configs/nvim/lua/plugins/nvim-lightspeed.lua new file mode 100644 index 0000000..e3fbd94 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-lightspeed.lua @@ -0,0 +1,7 @@ +local function init() + require("lightspeed").setup {} +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-lspkind.lua b/configs/nvim/lua/plugins/nvim-lspkind.lua new file mode 100644 index 0000000..b240e21 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-lspkind.lua @@ -0,0 +1,9 @@ +local function init() + require('lspkind').init { + with_text = true, + } +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-neoscroll.lua b/configs/nvim/lua/plugins/nvim-neoscroll.lua new file mode 100644 index 0000000..45c4efe --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-neoscroll.lua @@ -0,0 +1,7 @@ +local function init() + require('neoscroll').setup() +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-notify.lua b/configs/nvim/lua/plugins/nvim-notify.lua new file mode 100644 index 0000000..b3b52d4 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-notify.lua @@ -0,0 +1,7 @@ +local function init() + vim.notify = require("notify") +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-numb.lua b/configs/nvim/lua/plugins/nvim-numb.lua new file mode 100644 index 0000000..a2cec5a --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-numb.lua @@ -0,0 +1,10 @@ +local function init() + require('numb').setup { + show_numbers = true, -- Enable 'number' for the window while peeking + show_cursorline = true -- Enable 'cursorline' for the window while peeking + } +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-signature.lua b/configs/nvim/lua/plugins/nvim-signature.lua new file mode 100644 index 0000000..9f93972 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-signature.lua @@ -0,0 +1,8 @@ +local function init() + g.SignatureMarkTextHLDynamic = 1 + g.SignatureMarkerTextHLDynamic = 1 +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-todo-comments.lua b/configs/nvim/lua/plugins/nvim-todo-comments.lua new file mode 100644 index 0000000..29274e3 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-todo-comments.lua @@ -0,0 +1,7 @@ +local function init() + require("todo-comments").setup {} +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-treesitter.lua b/configs/nvim/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..1f64e47 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,16 @@ +local function init() + require'nvim-treesitter.configs'.setup { + ensure_installed = "all", -- list of languages + highlight = { + enable = true, + }, + rainbow = { + enable = true, + extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean + } + } +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/lua/plugins/nvim-web-devicons.lua b/configs/nvim/lua/plugins/nvim-web-devicons.lua new file mode 100644 index 0000000..77e6749 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-web-devicons.lua @@ -0,0 +1,12 @@ +local function init() + require'nvim-web-devicons'.setup { + -- globally enable default icons (default to false) + -- will get overriden by `get_icons` option + default = true; + } + require'nvim-web-devicons'.get_icons() +end + +return { + init = init +} \ No newline at end of file diff --git a/configs/nvim/plugin/packer_compiled.vim b/configs/nvim/plugin/packer_compiled.vim deleted file mode 100644 index 0395896..0000000 --- a/configs/nvim/plugin/packer_compiled.vim +++ /dev/null @@ -1,127 +0,0 @@ -" Automatically generated packer.nvim plugin loader code - -if !has('nvim-0.5') - echohl WarningMsg - echom "Invalid Neovim version for packer.nvim!" - echohl None - finish -endif - -packadd packer.nvim - -try - -lua << END - local time - local profile_info - local should_profile = false - if should_profile then - local hrtime = vim.loop.hrtime - profile_info = {} - time = function(chunk, start) - if start then - profile_info[chunk] = hrtime() - else - profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 - end - end - else - time = function(chunk, start) end - end - -local function save_profiles(threshold) - local sorted_times = {} - for chunk_name, time_taken in pairs(profile_info) do - sorted_times[#sorted_times + 1] = {chunk_name, time_taken} - end - table.sort(sorted_times, function(a, b) return a[2] > b[2] end) - local results = {} - for i, elem in ipairs(sorted_times) do - if not threshold or threshold and elem[2] > threshold then - results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' - end - end - - _G._packer = _G._packer or {} - _G._packer.profile_output = results -end - -time([[Luarocks path setup]], true) -local package_path_str = "/home/matcha/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/matcha/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/matcha/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/matcha/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/home/matcha/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" -if not string.find(package.path, package_path_str, 1, true) then - package.path = package.path .. ';' .. package_path_str -end - -if not string.find(package.cpath, install_cpath_pattern, 1, true) then - package.cpath = package.cpath .. ';' .. install_cpath_pattern -end - -time([[Luarocks path setup]], false) -time([[try_loadstring definition]], true) -local function try_loadstring(s, component, name) - local success, result = pcall(loadstring(s)) - if not success then - vim.schedule(function() - vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) - end) - end - return result -end - -time([[try_loadstring definition]], false) -time([[Defining packer_plugins]], true) -_G.packer_plugins = { - ["moonlight.nvim"] = { - loaded = true, - path = "/home/matcha/.local/share/nvim/site/pack/packer/start/moonlight.nvim" - }, - ["nvim-compe"] = { - loaded = true, - path = "/home/matcha/.local/share/nvim/site/pack/packer/start/nvim-compe" - }, - ["nvim-lspconfig"] = { - loaded = true, - path = "/home/matcha/.local/share/nvim/site/pack/packer/start/nvim-lspconfig" - }, - ["nvim-treesitter"] = { - loaded = true, - path = "/home/matcha/.local/share/nvim/site/pack/packer/start/nvim-treesitter" - }, - ["packer.nvim"] = { - loaded = true, - path = "/home/matcha/.local/share/nvim/site/pack/packer/start/packer.nvim" - }, - ["plenary.nvim"] = { - loaded = true, - path = "/home/matcha/.local/share/nvim/site/pack/packer/start/plenary.nvim" - }, - ["popup.nvim"] = { - loaded = true, - path = "/home/matcha/.local/share/nvim/site/pack/packer/start/popup.nvim" - }, - ["telescope.nvim"] = { - loaded = true, - path = "/home/matcha/.local/share/nvim/site/pack/packer/start/telescope.nvim" - }, - vim = { - loaded = true, - path = "/home/matcha/.local/share/nvim/site/pack/packer/start/vim" - }, - ["vim-gotham"] = { - loaded = true, - path = "/home/matcha/.local/share/nvim/site/pack/packer/start/vim-gotham" - } -} - -time([[Defining packer_plugins]], false) -if should_profile then save_profiles() end - -END - -catch - echohl ErrorMsg - echom "Error in packer_compiled: " .. v:exception - echom "Please check your config for correctness" - echohl None -endtry diff --git a/configs/powershell/ohmyposh.json b/configs/powershell/ohmyposh.json new file mode 100644 index 0000000..01db766 --- /dev/null +++ b/configs/powershell/ohmyposh.json @@ -0,0 +1,86 @@ +{ + "final_space": true, + "console_title": true, + "console_title_style": "folder", + "blocks": [ + { + "type": "prompt", + "alignment": "left", + "horizontal_offset": 0, + "vertical_offset": 0, + "segments": [ + { + "type": "path", + "style": "diamond", + "powerline_symbol": "", + "invert_powerline": false, + "foreground": "#ffffff", + "background": "#ff479c", + "leading_diamond": "", + "trailing_diamond": "", + "properties": { + "prefix": "  ", + "style": "folder" + } + }, + { + "type": "git", + "style": "powerline", + "powerline_symbol": "", + "invert_powerline": false, + "foreground": "#193549", + "background": "#fffb38", + "leading_diamond": "", + "trailing_diamond": "", + "properties": { + "display_status": true, + "display_stash_count": true, + "display_upstream_icon": true + } + }, + { + "type": "dotnet", + "style": "powerline", + "powerline_symbol": "", + "invert_powerline": false, + "foreground": "#ffffff", + "background": "#6CA35E", + "leading_diamond": "", + "trailing_diamond": "", + "properties": { + "display_version": true, + "prefix": "  " + } + }, + { + "type": "root", + "style": "powerline", + "powerline_symbol": "", + "invert_powerline": false, + "foreground": "#ffffff", + "background": "#ffff66", + "leading_diamond": "", + "trailing_diamond": "", + "properties": null + }, + { + "type": "exit", + "style": "powerline", + "powerline_symbol": "", + "invert_powerline": false, + "foreground": "#ffffff", + "background": "#2e9599", + "leading_diamond": "", + "trailing_diamond": "", + "properties": { + "always_enabled": true, + "color_background": true, + "display_exit_code": false, + "error_color": "#f1184c", + "prefix": " " + } + } + ] + } + ] +} \ No newline at end of file diff --git a/fonts/CONF.md b/fonts/CONF.md new file mode 100644 index 0000000..c4eb710 --- /dev/null +++ b/fonts/CONF.md @@ -0,0 +1,31 @@ +# Fonts + +- Cascadia Code PL => IDE Best font with ligatures +- Delugia Complete => Cascadia Code PL + Nerd font (not work in few IDE) + +# Configuration VSCode + +```json +{ + "editor.fontFamily": "'Cascadia Code PL', Consolas, 'Courier New', monospace", + "editor.fontLigatures": true, + [...] +} +``` + +# Configuration Windows Terminal + +```json +{ + "profiles": + { + "defaults": + { + "fontFace": "Delugia Complete", + [...] + }, + [...] + }, + [...] +} +``` \ No newline at end of file diff --git a/fonts/CascadiaCodePL.ttf b/fonts/CascadiaCodePL.ttf new file mode 100644 index 0000000..a1e73eb Binary files /dev/null and b/fonts/CascadiaCodePL.ttf differ diff --git a/fonts/CascadiaCodePLItalic.ttf b/fonts/CascadiaCodePLItalic.ttf new file mode 100644 index 0000000..b72dca5 Binary files /dev/null and b/fonts/CascadiaCodePLItalic.ttf differ diff --git a/fonts/DelugiaComplete-Bold.ttf b/fonts/DelugiaComplete-Bold.ttf new file mode 100644 index 0000000..7fdc280 Binary files /dev/null and b/fonts/DelugiaComplete-Bold.ttf differ diff --git a/fonts/DelugiaComplete-BoldItalic.ttf b/fonts/DelugiaComplete-BoldItalic.ttf new file mode 100644 index 0000000..ae3d727 Binary files /dev/null and b/fonts/DelugiaComplete-BoldItalic.ttf differ diff --git a/fonts/DelugiaComplete-Italic.ttf b/fonts/DelugiaComplete-Italic.ttf new file mode 100644 index 0000000..292e0ca Binary files /dev/null and b/fonts/DelugiaComplete-Italic.ttf differ diff --git a/fonts/DelugiaComplete.ttf b/fonts/DelugiaComplete.ttf new file mode 100644 index 0000000..25b1a6e Binary files /dev/null and b/fonts/DelugiaComplete.ttf differ diff --git a/fonts/DelugiaCompleteLight-Italic.ttf b/fonts/DelugiaCompleteLight-Italic.ttf new file mode 100644 index 0000000..ad180e9 Binary files /dev/null and b/fonts/DelugiaCompleteLight-Italic.ttf differ diff --git a/fonts/DelugiaCompleteLight.ttf b/fonts/DelugiaCompleteLight.ttf new file mode 100644 index 0000000..34d14d6 Binary files /dev/null and b/fonts/DelugiaCompleteLight.ttf differ diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..2b2769d --- /dev/null +++ b/install.ps1 @@ -0,0 +1,63 @@ +# Install OhMyPosh +winget list -q JanDeDobbeleer.OhMyPosh +if ($? -eq $False) { + winget install JanDeDobbeleer.OhMyPosh +} + +# Reload path +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") + +# Install modules +if (-not (Get-Module -ListAvailable -Name Terminal-Icons)) { + Install-Module -Name Terminal-Icons -Repository PSGallery -Force +} +if (-not (Get-Module -ListAvailable -Name PSReadLine)) { + Install-Module -Name PSReadLine -AllowPrerelease -Force +} + +# Update profile configuration + +# 1. Import all required params +$powershellConfig = (Get-Location).Path + "\configs\powershell\phmyposh.json" +Write-Output @' +function Reload-Path { + $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") +} + +Reload-Path +'@ | Out-File -FilePath $PROFILE +Write-Output 'Import-Module -Name Terminal-Icons' | Out-File -FilePath $PROFILE -Append +Write-Output @' +if ($host.Name -eq 'ConsoleHost') +{ + Import-Module -Name PSReadLine +} +'@ | Out-File -FilePath $PROFILE -Append +Write-Output "oh-my-posh --init --shell pwsh --config '$powershellConfig' | Invoke-Expression" | Out-File -FilePath $PROFILE -Append + +# 2. Configure PSReadLine | Predictive Intellisense +Write-Output @' +$PSReadLineOptions = @{ + EditMode = "Windows" + HistoryNoDuplicates = $True + PredictionSource = "History" + CompletionQueryItems = 5 + ShowToolTips = $True +} +Set-PSReadLineOption @PSReadLineOptions +'@ | Out-File -FilePath $PROFILE -Append + +# Reload profile +. $PROFILE + +# Configure WSL +Get-Command wsl +if ($? -eq $True) { + $linuxWindowsConfPath = (Get-Location).Path.Replace('C:', '/mnt/c').Replace('\', '/') + $linuxHomeConfPath = "/home/$(wsl -e 'whoami')/myconf" + + bash -c "ln -s $linuxWindowsConfPath $linuxHomeConfPath" + bash -c "$linuxHomeConfPath/install.sh" +} else { + Write-Output 'WSL is not installed. Ignore...' +} \ No newline at end of file diff --git a/install.sh b/install.sh old mode 100755 new mode 100644 diff --git a/install_scripts/ubuntu.sh b/install_scripts/ubuntu.sh old mode 100755 new mode 100644 diff --git a/useful_scripts/cleanup_wsl_mem.sh b/useful_scripts/cleanup_wsl_mem.sh new file mode 100644 index 0000000..75c5841 --- /dev/null +++ b/useful_scripts/cleanup_wsl_mem.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sudo bash -c "echo 1 > /proc/sys/vm/drop_caches" +sudo bash -c "echo 1 > /proc/sys/vm/compact_memory" \ No newline at end of file