commit
8c369f629b
85
README.md
85
README.md
@ -59,12 +59,9 @@ Lua fork of vim devicons which lets me change icons of filetypes
|
||||
### nvim-treesitter
|
||||
Better syntax highlighting for programming languages ( my config just has html,css,js support for now ).
|
||||
|
||||
without Treesitter :
|
||||
without / with Treesitter :
|
||||
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/woTree.png"></kbd>
|
||||
|
||||
with Treesitter :
|
||||
<kbd> <img src = "https://raw.githubusercontent.com/siduck76/dotfiles/master/rice%20flex/wiTree.png"></kbd><hr>
|
||||
|
||||
### nvim-base16 -
|
||||
|
||||
contains a collection of all base16 themes for vim , plugin written in lua (comparison of base16-vim and nvim-base16):
|
||||
@ -82,12 +79,13 @@ nvim-base16 doesnt even take time to load unlike base16-vim which was eating hal
|
||||
nvim
|
||||
├──init.lua
|
||||
└──lua
|
||||
└──foo
|
||||
└──lua.lua
|
||||
└──anything.lua
|
||||
```
|
||||
|
||||
- The init.lua is used instead of init.vim.
|
||||
- The lua folder contains modules , in the example above "foo" could be considered as a module and it contains a lua.lua file in which you could write your config in lua , its like splitting the overall config into small bit . To load/source that "foo" module , you need to specify it in init.lua like this : require('foo.lua').
|
||||
- The lua folder contains modules ( config files ) , in the example above anything.lua file in lua folder could be considered as a module.
|
||||
- The anything.lua file is supposed to have any neovim config written in lua , its like splitting the overall config into small bits and make it more organized , like one module for highlights and colors , another one for statusline and so on!.
|
||||
- To load or source that "anything" module (like making it load with init.lua ) ,add this is in init.lua : require "anything".
|
||||
|
||||
# Features
|
||||
|
||||
@ -109,6 +107,7 @@ nvim-base16 doesnt even take time to load unlike base16-vim which was eating hal
|
||||
- packer.nvim as package manager
|
||||
- indent-blankline.Nvim for indentlines
|
||||
- smooth scrolling
|
||||
- Snip support from VSCode through vsnip supporting custom and predefined snips (friendly-snippets)
|
||||
|
||||
# Guides to migrate your nvim configs to init.lua -
|
||||
|
||||
@ -120,17 +119,24 @@ nvim-base16 doesnt even take time to load unlike base16-vim which was eating hal
|
||||
|
||||
- https://icyphox.sh/blog/nvim-lua/
|
||||
|
||||
- https://github.com/rafamadriz/friendly-snippets/wiki
|
||||
|
||||
# Clone my setup -
|
||||
|
||||
- Install neovim-nightly , also use a nerdfont on your terminal.
|
||||
- run the install.sh (this might work only on nix systems) and open neovim , do :PackerInstall
|
||||
- or do it manually :
|
||||
- Use these [colors](https://github.com/siduck76/dotfiles/blob/master/thinkpad/.Xresources) for your terminal , Its in xresources format so it'd would be easier to use a terminal that supports xresources like st , urxvt , xterm , My [st build](https://github.com/siduck76/st).
|
||||
- run the install.sh (this might work only on nix systems),this opens neovim (press enter or y to skip the errors , the errors will only show once).
|
||||
- Install ripgrep , fd , ueberzug for telescope media extension to work.
|
||||
|
||||
- Manual installation , incase the install.sh doesnt work for you :
|
||||
|
||||
- Install packer.nvim
|
||||
|
||||
```shell
|
||||
```
|
||||
|
||||
git clone https://github.com/wbthomason/packer.nvim\
|
||||
~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
||||
|
||||
```
|
||||
|
||||
- copy lua folder and init.lua into ~/.config/nvim
|
||||
@ -138,7 +144,10 @@ git clone https://github.com/wbthomason/packer.nvim\
|
||||
- Install language servers and prettier ( for autocompletion etc and code formatting , nodejs should be installed too!) , this usually depends on the language support you want to add in your neovim config.
|
||||
|
||||
```
|
||||
sudo npm install -g vscode-html-languageserver-bin typescript typescript-language-server vscode-css-languageserver-bin prettier
|
||||
npm config set prefix=~/.node_modules
|
||||
npm install -g vscode-html-languageserver-bin typescript typescript-language-server vscode-css-languageserver-bin prettier
|
||||
|
||||
(ADD ~/.node_modules at your PATH)
|
||||
```
|
||||
|
||||
To setup any language server , follow this guide https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md and search up the needed LSP. For example if I needed clangd's lsp server :
|
||||
@ -152,29 +161,61 @@ I'd install it first and add its setup line :
|
||||
|
||||
require'lspconfig'.clangd.setup{} ``
|
||||
|
||||
# Default Mappings to make stuffs easier!
|
||||
# Default Mappings
|
||||
|
||||
<kbd> space </kbd> is the leader key
|
||||
<kbd> space </kbd> is the **leader** key.
|
||||
|
||||
- Opening terminals!
|
||||
- <kbd> Ctrl </kbd> <kbd> l </kbd> Open terminal vertically over right
|
||||
- <kbd> Ctrl </kbd> <kbd> x </kbd> Open terminal horizontally below the current window
|
||||
|
||||
- **File tree (nvim-tree)**
|
||||
|
||||
- <kbd> Ctrl </kbd> <kbd> n </kbd> toggle neovim tree
|
||||
|
||||
- <kbd> Shift </kbd> <kbd> h </kbd> show hidden files (use these keybinds when cursor's in the filetree, same for the keybinds below).
|
||||
- <kbd> Ctrl </kbd> + <kbd> v </kbd> open files in vertical split
|
||||
- <kbd> Ctrl </kbd> + <kbd> x </kbd> open files in horizontal split
|
||||
|
||||
- **Toggling stuffs**
|
||||
|
||||
- leader + <kbd> n </kbd> toggle line number
|
||||
- leader + <kbd> z </kbd> toggle truezen.nvim's Ataraxis mode
|
||||
- leader + <kbd> m </kbd> toggle truezen.nvim's minimalistic mode
|
||||
|
||||
- **Copy text**
|
||||
|
||||
- <kbd> Ctrl </kbd> <kbd> a </kbd> copies everything in the current file
|
||||
- select any text + <kbd> y </kbd> copies the selected text
|
||||
- leader + <kbd> f </kbd> <kbd> b </kbd> open all buffers , with telescope
|
||||
- leader + <kbd> f </kbd> <kbd> p </kbd> search and preview images with telescope
|
||||
- leader + <kbd> f </kbd> <kbd> f </kbd> find files in the current DIR , with telescope
|
||||
- leader + <kbd> f </kbd> <kbd> o </kbd> open recently edited files , with telescope
|
||||
- leader + <kbd> f </kbd> <kbd> f </kbd> find files in the current DIR , with telescope
|
||||
- leader + <kbd> f </kbd> <kbd> h </kbd> opens up a manpage like thing but for all vim related things , with telescope
|
||||
|
||||
- **Telescope**
|
||||
|
||||
- leader + <kbd> f </kbd> <kbd> b </kbd> open all buffers
|
||||
- leader + <kbd> f </kbd> <kbd> f </kbd> find files in the current DIR
|
||||
- leader + <kbd> f </kbd> <kbd> o </kbd> open recently edited files
|
||||
- leader + <kbd> f </kbd> <kbd> h </kbd> opens up a help page like thing
|
||||
- <kbd> Ctrl </kbd> + <kbd> v </kbd> open files in vertical split
|
||||
- <kbd> Ctrl </kbd> + <kbd> x </kbd> open files in horizontal split
|
||||
|
||||
- **Formatting code**
|
||||
|
||||
- leader + <kbd> f </kbd> <kbd> m </kbd> formats or beautifies the code in current window via neoformat
|
||||
(currently only html ,css , js can be formatted . To be able to use this keybind you need to install the formatter locally for your language , in my case prettier was required only so I installed it. check this <a> https://github.com/sbdchd/neoformat</a>).
|
||||
(currently only html ,css , js can be formatted . To be able to use this keybind you need to install the formatter locally for your language , in my case prettier was required only so I installed it. check (this)[https://github.com/sbdchd/neoformat].
|
||||
|
||||
- **Neoscroll**
|
||||
|
||||
- `<C-u>`, `<C-d>`, `<C-b>`, `<C-f>`, `<C-y>` and `<C-e>` : Smooth scrolling for window movement commands.
|
||||
|
||||
- **Managing tabs with bufferline!**
|
||||
|
||||
- <kbd> Shift </kbd> <kbd> l or s </kbd> cycle through opened tabs
|
||||
- <kbd> Shift </kbd> <kbd> d </kbd> close current tab
|
||||
- <kbd> Shift </kbd> <kbd> b </kbd> open new tab
|
||||
|
||||
# TODO
|
||||
|
||||
- add snippets support
|
||||
- show statusline in inactive windows
|
||||
- Make the statusline more elegant.
|
||||
- Add more themes.
|
||||
|
||||
# Contact -
|
||||
|
||||
|
77
init.lua
77
init.lua
@ -1,25 +1,23 @@
|
||||
-- load all plugins
|
||||
require("pluginsList.lua")
|
||||
require("file-icons.lua")
|
||||
require "pluginList"
|
||||
require "file-icons"
|
||||
|
||||
require("misc-utils.lua")
|
||||
require("nvimTree.lua")
|
||||
require("bufferline.lua")
|
||||
require("statusline.lua")
|
||||
require("telescope.lua")
|
||||
require "misc-utils"
|
||||
require "top-bufferline"
|
||||
require "statusline"
|
||||
|
||||
require("gitsigns.lua")
|
||||
require "colorizer".setup()
|
||||
require("colorizer").setup()
|
||||
require("neoscroll").setup() -- smooth scroll
|
||||
|
||||
-- lsp
|
||||
require("lspconfig.lua")
|
||||
require("compe.lua")
|
||||
require "nvim-lspconfig"
|
||||
require "compe-completion"
|
||||
|
||||
local cmd = vim.cmd
|
||||
local g = vim.g
|
||||
|
||||
g.mapleader = " "
|
||||
g.auto_save = 1
|
||||
g.auto_save = 0
|
||||
|
||||
-- colorscheme related stuff
|
||||
|
||||
@ -36,7 +34,7 @@ local indent = 2
|
||||
g.indentLine_enabled = 1
|
||||
g.indent_blankline_char = "▏"
|
||||
|
||||
cmd("hi IndentBlanklineChar guifg=#2a2e36")
|
||||
cmd "hi IndentBlanklineChar guifg=#2a2e36"
|
||||
|
||||
g.indent_blankline_filetype_exclude = {"help", "terminal"}
|
||||
g.indent_blankline_buftype_exclude = {"terminal"}
|
||||
@ -44,43 +42,29 @@ g.indent_blankline_buftype_exclude = {"terminal"}
|
||||
g.indent_blankline_show_trailing_blankline_indent = false
|
||||
g.indent_blankline_show_first_indent_level = false
|
||||
|
||||
require("treesitter.lua")
|
||||
require("mappings.lua")
|
||||
require "treesitter-nvim"
|
||||
require "mappings"
|
||||
|
||||
-- highlights --
|
||||
cmd("hi LineNr guifg=#383c44 guibg=NONE")
|
||||
cmd("hi Comment guifg=#3d4149")
|
||||
cmd "hi LineNr guifg=#42464e guibg=NONE"
|
||||
cmd "hi Comment guifg=#42464e"
|
||||
|
||||
cmd("hi SignColumn guibg=NONE")
|
||||
cmd("hi VertSplit guibg=NONE guifg=#2a2e36")
|
||||
cmd("hi DiffAdd guifg=#81A1C1 guibg = none")
|
||||
cmd("hi DiffChange guifg =#3A3E44 guibg = none")
|
||||
cmd("hi DiffModified guifg = #81A1C1 guibg = none")
|
||||
cmd("hi EndOfBuffer guifg=#1e222a")
|
||||
cmd "hi SignColumn guibg=NONE"
|
||||
cmd "hi VertSplit guibg=NONE guifg=#2a2e36"
|
||||
cmd "hi EndOfBuffer guifg=#1e222a"
|
||||
cmd "hi PmenuSel guibg=#98c379"
|
||||
cmd "hi Pmenu guibg=#282c34"
|
||||
|
||||
-- telescope stuff and popupmenu
|
||||
cmd("hi TelescopeBorder guifg=#2a2e36")
|
||||
cmd("hi TelescopePromptBorder guifg=#2a2e36")
|
||||
cmd("hi TelescopeResultsBorder guifg=#2a2e36")
|
||||
cmd("hi TelescopePreviewBorder guifg=#525865")
|
||||
cmd("hi PmenuSel guibg=#98c379")
|
||||
cmd("hi Pmenu guibg=#282c34")
|
||||
cmd "hi Normal guibg=NONE ctermbg=NONE"
|
||||
-- cmd "hi Normal guibg=#1e222a"
|
||||
|
||||
-- tree folder name , icon color
|
||||
cmd("hi NvimTreeFolderIcon guifg = #61afef")
|
||||
cmd("hi NvimTreeFolderName guifg = #61afef")
|
||||
cmd("hi NvimTreeIndentMarker guifg=#383c44")
|
||||
|
||||
cmd("hi Normal guibg=NONE ctermbg=NONE")
|
||||
require "telescope-nvim"
|
||||
require "nvimTree"
|
||||
|
||||
-- git signs , lsp symbols etc
|
||||
require "gitsigns-nvim"
|
||||
require("nvim-autopairs").setup()
|
||||
require("lspkind").init(
|
||||
{
|
||||
File = " "
|
||||
}
|
||||
)
|
||||
|
||||
-- nvimTree bg color
|
||||
require("lspkind").init()
|
||||
|
||||
-- hide line numbers in terminal windows
|
||||
vim.api.nvim_exec([[
|
||||
@ -90,5 +74,8 @@ vim.api.nvim_exec([[
|
||||
-- inactive statuslines as thin splitlines
|
||||
cmd("highlight! StatusLineNC gui=underline guibg=NONE guifg=#383c44")
|
||||
|
||||
-- smooth scroll
|
||||
require("neoscroll").setup()
|
||||
cmd "hi clear CursorLine"
|
||||
cmd "hi cursorlinenr guibg=NONE guifg=#abb2bf"
|
||||
|
||||
-- setup for TrueZen.nvim
|
||||
require "zenmode"
|
||||
|
72
install.sh
72
install.sh
@ -2,22 +2,22 @@
|
||||
BASE=$(git rev-parse --show-toplevel)
|
||||
LSP_BIN_PATH=$HOME/.local/bin
|
||||
|
||||
default_lsp_langs="css html ts rust python"
|
||||
default_lsp_langs="css html ts rust python bash"
|
||||
lsp_langs=""
|
||||
|
||||
choose_langs() {
|
||||
read -p "Would you like to install $1 lsp?(y/n)" lang
|
||||
if [ "$lang" = "y" ]
|
||||
then
|
||||
if [ "$lang" = "y" ]; then
|
||||
lsp_langs+="$1 "
|
||||
fi
|
||||
}
|
||||
|
||||
for lang in $default_lsp_langs
|
||||
do
|
||||
for lang in $default_lsp_langs; do
|
||||
choose_langs $lang
|
||||
done
|
||||
|
||||
npm config set prefix=~/.node_modules # for global npm pkg installation
|
||||
|
||||
pfx="~~~~~ "
|
||||
heading() {
|
||||
echo
|
||||
@ -26,11 +26,11 @@ heading() {
|
||||
|
||||
get_platform() {
|
||||
case "$(uname -s)" in
|
||||
Linux*) platform=Linux;;
|
||||
Darwin*) platform=Mac;;
|
||||
CYGWIN*) platform=Cygwin;;
|
||||
MINGW*) platform=MinGw;;
|
||||
*) platform="UNKNOWN:${unameOut}"
|
||||
Linux*) platform=Linux ;;
|
||||
Darwin*) platform=Mac ;;
|
||||
CYGWIN*) platform=Cygwin ;;
|
||||
MINGW*) platform=MinGw ;;
|
||||
*) platform="UNKNOWN:${unameOut}" ;;
|
||||
esac
|
||||
echo $platform
|
||||
}
|
||||
@ -39,17 +39,29 @@ heading "installing packer"
|
||||
|
||||
if [[ ! -e ~/.local/share/nvim/site/pack/packer/start/packer.nvim ]]; then
|
||||
heading "Installing packer"
|
||||
git clone https://github.com/wbthomason/packer.nvim\
|
||||
git clone https://github.com/wbthomason/packer.nvim \
|
||||
~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
||||
fi
|
||||
|
||||
heading "Linking config"
|
||||
heading "old nvim config will be deleted so watchout :0"
|
||||
|
||||
# copying config
|
||||
# copying config
|
||||
|
||||
rm -rf ~/.config/nvim/ && mkdir -p ~/.config/nvim
|
||||
cp -r init.lua ~/.config/nvim && cp -r lua ~/.config/nvim
|
||||
cp -r init.lua ~/.config/nvim && cp -r lua ~/.config/nvim
|
||||
|
||||
# change shell for nvim
|
||||
read -p "which shell do you use?: " shellname
|
||||
echo "$shellname"
|
||||
|
||||
if [ "$(get_platform)" = "Mac" ]; then
|
||||
gsed -i "s/bash/$shellname/g" ~/.config/nvim/lua/mappings/lua.lua
|
||||
else
|
||||
sed -i "s/bash/$shellname/g" ~/.config/nvim/lua/mappings/lua.lua
|
||||
fi
|
||||
|
||||
echo "shell changed to $shellname on nvim successfully!"
|
||||
|
||||
#for f in `find -E . -regex ".*\.vim$|.*\.lua$"`; do
|
||||
# p=${f#*/}
|
||||
@ -65,24 +77,18 @@ cp -r init.lua ~/.config/nvim && cp -r lua ~/.config/nvim
|
||||
#nvim --headless +TSUpdate +qa
|
||||
echo
|
||||
|
||||
fn_exists() { declare -F "$1" > /dev/null; }
|
||||
fn_exists() { declare -F "$1" >/dev/null; }
|
||||
warn_path=false
|
||||
|
||||
install_node_deps () {
|
||||
install_node_deps() {
|
||||
if [[ -z $(which npm) ]]; then
|
||||
echo "npm not installed"
|
||||
return
|
||||
fi
|
||||
sudo npm install -g $@
|
||||
npm install -g $@
|
||||
}
|
||||
|
||||
install_python_deps () {
|
||||
if [[ -z $(which pip) && -z $(which pip3) ]]; then
|
||||
echo "python/pip not installed"
|
||||
return
|
||||
fi
|
||||
sudo python3 -m pip install $@
|
||||
}
|
||||
# install languages
|
||||
|
||||
install_ts() {
|
||||
install_node_deps typescript typescript-language-server prettier
|
||||
@ -107,21 +113,31 @@ install_rust() {
|
||||
fi
|
||||
}
|
||||
|
||||
install_python(){
|
||||
install_python_deps 'python-language-server[all]'
|
||||
install_python() {
|
||||
install_node_deps pyright
|
||||
}
|
||||
|
||||
install_bash() {
|
||||
install_node_deps bash-language-server
|
||||
}
|
||||
|
||||
for lang in ${lsp_langs}; do
|
||||
if fn_exists install_$lang ; then
|
||||
if fn_exists install_$lang; then
|
||||
heading "Installing $lang language server"
|
||||
install_$lang
|
||||
else
|
||||
echo $lang setup not implemented
|
||||
echo
|
||||
echo
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${warn_path} = true ]]; then
|
||||
if [[ ${warn_path} == true ]]; then
|
||||
echo ""
|
||||
echo "Ensure ${LSP_BIN_PATH} is available in your \$PATH variable"
|
||||
fi
|
||||
|
||||
echo "add ~/.node_modules/bin at PATH!"
|
||||
|
||||
# install all plugins via packer
|
||||
|
||||
nvim +PackerInstall
|
||||
|
@ -1,6 +1,3 @@
|
||||
vim.cmd [[packadd nvim-lspconfig]]
|
||||
vim.cmd [[packadd nvim-compe]]
|
||||
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
|
||||
require "compe".setup {
|
||||
@ -18,9 +15,9 @@ require "compe".setup {
|
||||
documentation = true,
|
||||
source = {
|
||||
path = true,
|
||||
buffer = true,
|
||||
buffer = {kind = "" , true},
|
||||
calc = true,
|
||||
vsnip = true,
|
||||
vsnip = {kind = ""}, --replace to what sign you prefer
|
||||
nvim_lsp = true,
|
||||
nvim_lua = true,
|
||||
spell = true,
|
@ -1,5 +1,3 @@
|
||||
vim.cmd [[packadd nvim-web-devicons]]
|
||||
|
||||
require "nvim-web-devicons".setup {
|
||||
override = {
|
||||
html = {
|
||||
@ -96,6 +94,16 @@ require "nvim-web-devicons".setup {
|
||||
icon = "",
|
||||
color = "#EBCB8B",
|
||||
name = "xz"
|
||||
},
|
||||
deb = {
|
||||
icon = "",
|
||||
color = "#a3b8ef",
|
||||
name = "deb"
|
||||
},
|
||||
rpm = {
|
||||
icon = "",
|
||||
color = "#fca2aa",
|
||||
name = "rpm"
|
||||
}
|
||||
}
|
||||
}
|
@ -25,3 +25,9 @@ require("gitsigns").setup {
|
||||
sign_priority = 5,
|
||||
status_formatter = nil -- Use default
|
||||
}
|
||||
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd "hi DiffAdd guifg=#81A1C1 guibg = none"
|
||||
cmd "hi DiffChange guifg =#3A3E44 guibg = none"
|
||||
cmd "hi DiffModified guifg = #81A1C1 guibg = none"
|
@ -1,45 +0,0 @@
|
||||
vim.cmd [[packadd nvim-lspconfig]]
|
||||
vim.cmd [[packadd nvim-compe]]
|
||||
|
||||
local nvim_lsp = require("lspconfig")
|
||||
|
||||
function on_attach(client)
|
||||
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
|
||||
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
-- Mappings.
|
||||
local opts = {noremap = true, silent = true}
|
||||
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", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||
buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
||||
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
||||
|
||||
-- Set some keybinds conditional on server capabilities
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
elseif client.resolved_capabilities.document_range_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||
end
|
||||
end
|
||||
|
||||
local servers = {"tsserver", "cssls", "html" , "pyls"}
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {on_attach = on_attach}
|
||||
end
|
@ -6,6 +6,17 @@ local function map(mode, lhs, rhs, opts)
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
local opt = {}
|
||||
|
||||
-- dont copy any deleted text , this is disabled by default so uncomment the below mappings if you want them!
|
||||
--[[
|
||||
|
||||
map("n", "dd", [=[ "_dd ]=], opt)
|
||||
map("v", "dd", [=[ "_dd ]=], opt)
|
||||
map("v", "x", [=[ "_x ]=], opt)
|
||||
|
||||
]]
|
||||
|
||||
-- copy any selected text with pressing y
|
||||
map("", "<leader>c", '"+y')
|
||||
|
||||
@ -15,3 +26,11 @@ map("n", "<C-x>", [[<Cmd> split term://bash | resize 10 <CR>]], opt) -- open ter
|
||||
|
||||
-- COPY EVERYTHING --
|
||||
map("n", "<C-a>", [[ <Cmd> %y+<CR>]], opt)
|
||||
|
||||
-- toggle numbers ---
|
||||
map("n", "<leader>n", [[ <Cmd> set nu!<CR>]], opt)
|
||||
|
||||
-- toggle truezen.nvim's ataraxis and minimalist mode
|
||||
map("n", "<leader>z", [[ <Cmd> TZAtaraxis<CR>]], opt)
|
||||
map("n", "<leader>m", [[ <Cmd> TZMinimalist<CR>]], opt)
|
||||
|
@ -14,19 +14,19 @@ opt("o", "splitright", true)
|
||||
opt("o", "termguicolors", true)
|
||||
opt("w", "number", true)
|
||||
opt("o", "numberwidth", 2)
|
||||
opt("w", "cul", true)
|
||||
|
||||
opt("o", "mouse", "a")
|
||||
|
||||
opt("w", "signcolumn", "yes")
|
||||
opt("o", "cmdheight", 1)
|
||||
|
||||
opt("o", "updatetime", 250) -- update interval for gitsigns
|
||||
opt("o", "updatetime", 250) -- update interval for gitsigns
|
||||
opt("o", "clipboard", "unnamedplus")
|
||||
|
||||
-- for indenline
|
||||
opt("b", "expandtab", true )
|
||||
opt("b", "shiftwidth", 2 )
|
||||
|
||||
opt("b", "expandtab", true)
|
||||
opt("b", "shiftwidth", 2)
|
||||
|
||||
local M = {}
|
||||
|
100
lua/nvim-lspconfig.lua
Normal file
100
lua/nvim-lspconfig.lua
Normal file
@ -0,0 +1,100 @@
|
||||
function on_attach(client)
|
||||
local function map(...)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
-- Mappings.
|
||||
local opts = {noremap = true, silent = true, normal = true}
|
||||
map("gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
map("gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
map("K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
map("gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
map("<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
map("<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||
map("<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||
map("<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||
map("<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
map("<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
map("gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
map("<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||
map("[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
||||
map("]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
||||
map("<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
||||
|
||||
-- Set some keybinds conditional on server capabilities
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
map("<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
elseif client.resolved_capabilities.document_range_formatting then
|
||||
map("<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||
end
|
||||
end
|
||||
|
||||
local lspconf = require "lspconfig"
|
||||
local servers = {"html", "cssls", "tsserver", "pyright", "bashls"}
|
||||
|
||||
for k, lang in pairs(servers) do
|
||||
lspconf[lang].setup {
|
||||
root_dir = vim.loop.cwd
|
||||
}
|
||||
end
|
||||
|
||||
-- lua lsp settings
|
||||
USER = "/home/" .. vim.fn.expand("$USER")
|
||||
|
||||
local sumneko_root_path = USER .. "/.config/lua-language-server"
|
||||
local sumneko_binary = USER .. "/.config/lua-language-server/bin/Linux/lua-language-server"
|
||||
|
||||
require "lspconfig".sumneko_lua.setup {
|
||||
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
|
||||
root_dir = function()
|
||||
return vim.loop.cwd()
|
||||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
path = vim.split(package.path, ";")
|
||||
},
|
||||
diagnostics = {
|
||||
globals = {"vim"}
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true
|
||||
}
|
||||
},
|
||||
telemetry = {
|
||||
enable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- replace the default lsp diagnostic letters with prettier symbols
|
||||
vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"})
|
||||
|
||||
-- diagnostics highlights
|
||||
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd "hi LspDiagnosticsSignError guifg=#f9929b"
|
||||
cmd "hi LspDiagnosticsVirtualTextError guifg=#BF616A"
|
||||
|
||||
cmd "hi LspDiagnosticsSignWarning guifg=#EBCB8B"
|
||||
cmd "hi LspDiagnosticsVirtualTextWarning guifg=#EBCB8B"
|
||||
|
||||
cmd "hi LspDiagnosticsSignInformation guifg=#A3BE8C"
|
||||
cmd "hi LspDiagnosticsVirtualTextInformation guifg=#A3BE8C"
|
||||
|
||||
cmd "hi LspDiagnosticsSignHint guifg=#b6bdca"
|
||||
cmd "hi LspDiagnosticsVirtualTextHint guifg=#b6bdca"
|
@ -1,9 +1,8 @@
|
||||
vim.cmd [[packadd nvim-tree.lua]]
|
||||
local cmd = vim.cmd
|
||||
local g = vim.g
|
||||
|
||||
vim.o.termguicolors = true
|
||||
|
||||
local g = vim.g
|
||||
|
||||
g.nvim_tree_side = "left"
|
||||
g.nvim_tree_width = 25
|
||||
g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
|
||||
@ -84,3 +83,7 @@ g.nvim_tree_bindings = {
|
||||
["-"] = get_lua_cb("dir_up"),
|
||||
["q"] = get_lua_cb("close")
|
||||
}
|
||||
|
||||
cmd "hi NvimTreeFolderIcon guifg = #61afef"
|
||||
cmd "hi NvimTreeFolderName guifg = #61afef"
|
||||
cmd "hi NvimTreeIndentMarker guifg=#383c44"
|
@ -1,36 +1,47 @@
|
||||
-- check if packer is installed (~/local/share/nvim/site/pack)
|
||||
local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]])
|
||||
local packer = require("packer")
|
||||
local use = packer.use
|
||||
|
||||
-- using { } when using a different branch of the plugin or loading the plugin with certain commands
|
||||
-- using { } for using different branch , loading plugin with certain commands etc
|
||||
return require("packer").startup(
|
||||
function()
|
||||
use {"wbthomason/packer.nvim", opt = true}
|
||||
use {"lukas-reineke/indent-blankline.nvim", branch = "lua"}
|
||||
use "wbthomason/packer.nvim"
|
||||
|
||||
-- color related stuff
|
||||
use "norcalli/nvim-base16.lua"
|
||||
use "kyazdani42/nvim-web-devicons"
|
||||
use "kyazdani42/nvim-tree.lua"
|
||||
use "norcalli/nvim-colorizer.lua"
|
||||
|
||||
-- lsp stuff
|
||||
use "nvim-treesitter/nvim-treesitter"
|
||||
use "neovim/nvim-lspconfig"
|
||||
use "hrsh7th/nvim-compe"
|
||||
use "onsails/lspkind-nvim"
|
||||
use "sbdchd/neoformat"
|
||||
use "nvim-lua/plenary.nvim"
|
||||
|
||||
use "lewis6991/gitsigns.nvim"
|
||||
use "akinsho/nvim-bufferline.lua"
|
||||
use "glepnir/galaxyline.nvim"
|
||||
use "907th/vim-auto-save"
|
||||
use "nvim-treesitter/nvim-treesitter"
|
||||
use "norcalli/nvim-colorizer.lua"
|
||||
use "ryanoasis/vim-devicons"
|
||||
use "sbdchd/neoformat"
|
||||
use "neovim/nvim-lspconfig"
|
||||
use "hrsh7th/nvim-compe"
|
||||
use "windwp/nvim-autopairs"
|
||||
use "alvan/vim-closetag"
|
||||
use "tweekmonster/startuptime.vim"
|
||||
use "onsails/lspkind-nvim"
|
||||
|
||||
-- snippet support
|
||||
use "hrsh7th/vim-vsnip"
|
||||
use "rafamadriz/friendly-snippets"
|
||||
|
||||
-- file managing , picker etc
|
||||
use "kyazdani42/nvim-tree.lua"
|
||||
use "kyazdani42/nvim-web-devicons"
|
||||
use "ryanoasis/vim-devicons"
|
||||
use "nvim-telescope/telescope.nvim"
|
||||
use "nvim-telescope/telescope-media-files.nvim"
|
||||
use "nvim-lua/popup.nvim"
|
||||
use "karb94/neoscroll.nvim"
|
||||
|
||||
use "nekonako/xresources-nvim"
|
||||
|
||||
-- misc
|
||||
use "tweekmonster/startuptime.vim"
|
||||
use "907th/vim-auto-save"
|
||||
use "karb94/neoscroll.nvim"
|
||||
use "kdav5758/TrueZen.nvim"
|
||||
|
||||
use {"lukas-reineke/indent-blankline.nvim", branch = "lua"}
|
||||
end
|
||||
)
|
@ -73,3 +73,12 @@ vim.api.nvim_set_keymap("n", "<Leader>fb", [[<Cmd>lua require('telescope.builtin
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt)
|
||||
|
||||
-- highlights
|
||||
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd "hi TelescopeBorder guifg=#2a2e36"
|
||||
cmd "hi TelescopePromptBorder guifg=#2a2e36"
|
||||
cmd "hi TelescopeResultsBorder guifg=#2a2e36"
|
||||
cmd "hi TelescopePreviewBorder guifg=#525865"
|
@ -1,10 +1,12 @@
|
||||
vim.o.termguicolors = true
|
||||
-- colors
|
||||
|
||||
local bar_fg = "#565c64"
|
||||
local activeBuffer_fg = "#c8ccd4"
|
||||
|
||||
-- colors for active , inactive uffer tabs
|
||||
require "bufferline".setup {
|
||||
options = {
|
||||
buffer_close_icon = "",
|
||||
modified_icon = "●",
|
||||
modified_icon = "",
|
||||
close_icon = "",
|
||||
left_trunc_marker = "",
|
||||
right_trunc_marker = "",
|
||||
@ -18,29 +20,31 @@ require "bufferline".setup {
|
||||
},
|
||||
highlights = {
|
||||
background = {
|
||||
guifg = comment_fg,
|
||||
guifg = bar_fg,
|
||||
guibg = "#1e222a"
|
||||
},
|
||||
fill = {
|
||||
guifg = comment_fg,
|
||||
guifg = bar_fg,
|
||||
guibg = "#1e222a"
|
||||
},
|
||||
-- focused window
|
||||
buffer_selected = {
|
||||
guifg = normal_fg,
|
||||
guibg = "#282c34",
|
||||
guifg = activeBuffer_fg,
|
||||
guibg = "#353b45",
|
||||
gui = "bold"
|
||||
},
|
||||
separator_selected = {
|
||||
guifg = "#353b45",
|
||||
guibg = "#353b45"
|
||||
},
|
||||
-- unfocused opened window
|
||||
buffer_visible = {
|
||||
guifg = "#3e4451",
|
||||
guibg = "#1e222a"
|
||||
guifg = "#9298a0",
|
||||
guibg = "#282c34"
|
||||
},
|
||||
separator_visible = {
|
||||
guifg = "#1e222a",
|
||||
guibg = "#1e222a"
|
||||
},
|
||||
separator_selected = {
|
||||
guifg = "#1e222a",
|
||||
guibg = "#1e222a"
|
||||
guifg = "#282c34",
|
||||
guibg = "#282c34"
|
||||
},
|
||||
separator = {
|
||||
guifg = "#1e222a",
|
||||
@ -51,7 +55,7 @@ require "bufferline".setup {
|
||||
guibg = "#1e222a"
|
||||
},
|
||||
modified_selected = {
|
||||
guifg = string_fg,
|
||||
guifg = "#d0f5c2",
|
||||
guibg = "#353b45"
|
||||
}
|
||||
}
|
||||
@ -59,15 +63,15 @@ require "bufferline".setup {
|
||||
|
||||
local opt = {silent = true}
|
||||
|
||||
local map = vim.api.nvim_set_keymap
|
||||
vim.g.mapleader = " "
|
||||
|
||||
--command that adds new buffer and moves to it
|
||||
vim.api.nvim_command "com -nargs=? -complete=file_in_path New badd <args> | blast"
|
||||
vim.api.nvim_set_keymap("n", "<S-b>", ":New ", opt)
|
||||
map("n", "<S-t>", [[<Cmd>tabnew<CR>]], opt)
|
||||
|
||||
--removing a buffer
|
||||
vim.api.nvim_set_keymap("n", "<S-f>", [[<Cmd>bdelete<CR>]], opt)
|
||||
map("n", "<S-x>", [[<Cmd>bdelete<CR>]], opt)
|
||||
|
||||
-- tabnew and tabprev
|
||||
vim.api.nvim_set_keymap("n", "<S-l>", [[<Cmd>BufferLineCycleNext<CR>]], opt)
|
||||
vim.api.nvim_set_keymap("n", "<S-s>", [[<Cmd>BufferLineCyclePrev<CR>]], opt)
|
||||
map("n", "<S-l>", [[<Cmd>BufferLineCycleNext<CR>]], opt)
|
||||
map("n", "<S-p>", [[<Cmd>BufferLineCyclePrev<CR>]], opt)
|
@ -6,9 +6,11 @@ ts_config.setup {
|
||||
"html",
|
||||
"css",
|
||||
"bash",
|
||||
"cpp",
|
||||
"rust",
|
||||
"lua"
|
||||
"lua",
|
||||
"json",
|
||||
"python"
|
||||
-- "cpp",
|
||||
-- "rust",
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
47
lua/zenmode.lua
Normal file
47
lua/zenmode.lua
Normal file
@ -0,0 +1,47 @@
|
||||
local true_zen = require("true-zen")
|
||||
|
||||
true_zen.setup(
|
||||
{
|
||||
true_false_commands = false,
|
||||
cursor_by_mode = false,
|
||||
before_minimalist_mode_shown = true,
|
||||
before_minimalist_mode_hidden = true,
|
||||
after_minimalist_mode_shown = true,
|
||||
after_minimalist_mode_hidden = true,
|
||||
bottom = {
|
||||
hidden_laststatus = 0,
|
||||
hidden_ruler = false,
|
||||
hidden_showmode = false,
|
||||
hidden_showcmd = false,
|
||||
hidden_cmdheight = 1,
|
||||
shown_laststatus = 2,
|
||||
shown_ruler = true,
|
||||
shown_showmode = false,
|
||||
shown_showcmd = false,
|
||||
shown_cmdheight = 1
|
||||
},
|
||||
top = {
|
||||
hidden_showtabline = 0,
|
||||
shown_showtabline = 2
|
||||
},
|
||||
left = {
|
||||
hidden_number = false,
|
||||
hidden_relativenumber = false,
|
||||
hidden_signcolumn = "no",
|
||||
shown_number = true,
|
||||
shown_relativenumber = false,
|
||||
shown_signcolumn = "no"
|
||||
},
|
||||
ataraxis = {
|
||||
just_do_it_for_me = false,
|
||||
left_padding = 37,
|
||||
right_padding = 37,
|
||||
top_padding = 2,
|
||||
bottom_padding = 2,
|
||||
custome_bg = "#1e222a"
|
||||
},
|
||||
integrations = {
|
||||
integration_galaxyline = true
|
||||
}
|
||||
}
|
||||
)
|
Loading…
Reference in New Issue
Block a user