Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lint.yml #2

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
name: lint

on:
pull_request:
branches:
- main
on: [push]
# on:
# pull_request:
# branches:
# - main

jobs:
lint:
runs-on: [ubuntu-latest]
steps:
# - name: Checkout sources
# uses: actions/checkout@v2
# - name: Setup luacheck
# run: |
# sudo apt update &&
# sudo apt install -y lua5.1 luarocks &&
# sudo luarocks install luacheck
# - name: Run luacheck
# run: |
# luacheck lua/*
- uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v3
- name: Checkout code
uses: actions/checkout@v2
- name: Setup
run: |
sudo apt-get update
sudo apt-get install luarocks
sudo luarocks install luacheck
- name: Lint
run: luacheck lua/

format:
runs-on: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run stylua
uses: JohnnyMorganz/stylua-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest # NOTE: we recommend pinning to a specific version in case of formatting changes
Expand Down
7 changes: 7 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
globals = {
"vim",
}
-- max_string_line_length = false
max_line_length = 140
exclude_files = { "**/*example.lua" }
ignore = { "211" }
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ repos:
args: ["--write-changes"]
exclude: CHANGELOG\.rst|\.(svg|pyc|drawio|dcf|eds)$|lazy-lock.json|example.lua

# - repo: https://github.com/Calinou/pre-commit-luacheck
# rev: v1.0.0
# hooks:
# - id: luacheck
- repo: https://github.com/Calinou/pre-commit-luacheck
rev: v1.0.0
hooks:
- id: luacheck

# - repo: https://github.com/JohnnyMorganz/StyLua
# rev: v0.19.1
# hooks:
# - id: stylua # or stylua-system / stylua-github
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v0.19.1
hooks:
- id: stylua # or stylua-system / stylua-github

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.38.0
Expand Down
40 changes: 20 additions & 20 deletions lua/config/general.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.g.loaded_netrwPlugin = 1 -- disable netrw
vim.g.loaded_netrw = 1 -- disable netrw
vim.g.loaded_netrw = 1 -- disable netrw

-- opt
local options = {
clipboard = "unnamedplus", -- connection to the system clipboard
colorcolumn = "120", -- show vertical column
expandtab = true, -- enable the use of space in tab
hlsearch = true, --
incsearch = true, --
ignorecase = true, -- case insensitive searching
number = true, -- show line numbers
relativenumber = false, -- relative numbers
scrolloff = 15, -- stop scrolling at the top and bottom until the end
shiftwidth = 2, -- number of spaces in indentation
sidescrolloff = 8, -- same for the sides
smartindent = true, --
softtabstop = 2, --
signcolumn = "yes", --
swapfile = false, -- no annoying swap file
tabstop = 2, -- number of spaces for tab
termguicolors = true, --
undofile = true, --
updatetime = 50, --
wrap = false, --
colorcolumn = "120", -- show vertical column
expandtab = true, -- enable the use of space in tab
hlsearch = true, --
incsearch = true, --
ignorecase = true, -- case insensitive searching
number = true, -- show line numbers
relativenumber = false, -- relative numbers
scrolloff = 15, -- stop scrolling at the top and bottom until the end
shiftwidth = 2, -- number of spaces in indentation
sidescrolloff = 8, -- same for the sides
smartindent = true, --
softtabstop = 2, --
signcolumn = "yes", --
swapfile = false, -- no annoying swap file
tabstop = 2, -- number of spaces for tab
termguicolors = true, --
undofile = true, --
updatetime = 50, --
wrap = false, --
}

for k, v in pairs(options) do
Expand Down
12 changes: 8 additions & 4 deletions lua/plugins/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ return {
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
-- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = "buffer" },
Expand All @@ -50,12 +51,15 @@ return {
formatting = {
format = lspkind.cmp_format({
mode = "symbol", -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
maxwidth = 50, -- prevent the popup from showing more than provided characters
-- (e.g 50 will not show more than 50 characters)
-- can also be a function to dynamically calculate max width such as
-- maxwidth = function() return math.floor(0.45 * vim.o.columns) end,
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char
-- instead (must define maxwidth first)
-- The function below will be called before any actual modifications from lspkind
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
-- so that you can provide more controls on popup customization.
-- (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
-- before = function (entry, vim_item)
-- ...
-- return vim_item
Expand Down
4 changes: 2 additions & 2 deletions lua/plugins/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ return {
config = function()
require("gitsigns").setup()
vim.keymap.set("n", "<leader>gp", ":Gitsigns preview_hunk<CR>", {})
end
end,
},
{
"tpope/vim-fugitive",
config = function()
require("gitsigns").setup()
vim.keymap.set("n", "<leader>gb", ":Git blame<CR>", {})
end
end,
},
}
2 changes: 1 addition & 1 deletion lua/plugins/startscreen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ return {
vim.cmd([[
autocmd FileType alpha setlocal nofoldenable
]])
end
end,
}
2 changes: 1 addition & 1 deletion lua/plugins/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ return {
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
vim.keymap.set("n", "<leader>fb", builtin.buffers, {})
vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
vim.keymap.set("n", "<leader>fr", ':Telescope oldfiles<CR>', {})
vim.keymap.set("n", "<leader>fr", ":Telescope oldfiles<CR>", {})
end,
}
4 changes: 4 additions & 0 deletions stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
Loading